Skip to content

Commit

Permalink
Merge pull request #285 from MitocGroup/dev
Browse files Browse the repository at this point in the history
upgrade to node.js v7.3
  • Loading branch information
Scripnic Alexandru authored Jan 3, 2017
2 parents 49c4dfe + de1008f commit bd7f86d
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
node_js:
- '4.3'
- '6.9'
- '7.1'
- '7.3'
cache:
edge: true
directories:
Expand Down
50 changes: 34 additions & 16 deletions src/bin/commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module.exports = function(mainPath) {
let cfgBucket = this.opts.locate('cfg-bucket').value;
let appEnv = isProd ? 'prod' : this.opts.locate('env').value;
let microservicesToDeploy = this.opts.locate('partial').value;
let frontendOnly = this.opts.locate('frontend').exists ? Property.DEPLOY_FRONTEND : 0;
let backendOnly = this.opts.locate('backend').exists ? Property.DEPLOY_BACKEND : 0;
let validateNodeVersion = require('./helper/validate-node-version');
let undeployRunning = false;

Expand All @@ -45,6 +47,10 @@ module.exports = function(mainPath) {
let propertyInstance = Property.create(mainPath);
let configFile = path.join(propertyInstance.path, Config.DEFAULT_FILENAME);
let config = propertyInstance.config;

if (frontendOnly || backendOnly) {
propertyInstance.deployFlags = frontendOnly | backendOnly;
}

appEnv = appEnv ? appEnv.toLowerCase() : null;

Expand Down Expand Up @@ -103,27 +109,39 @@ module.exports = function(mainPath) {
return cb(null);
}

let baseHash = propertyInstance.configObj.baseHash;
let prompt = new Prompt('Do you want to undeploy deployed resources?');

prompt.readConfirm(result => {
if (!result) {
return cb(null);
}

console.log(`Start undeploying resources for ${baseHash}`);
let baseHash = propertyInstance.configObj.baseHash;

let undeployCmd = new Exec(
Bin.node,
this.scriptPath,
'undeploy',
propertyInstance.path,
`--resource=${baseHash}`
);
console.log(`Start undeploying resources for ${baseHash}`);

undeployCmd.run(() => {
if (undeployCmd.failed) {
return cb(undeployCmd.error);
let undeployCmd = new Exec(
Bin.node,
this.scriptPath,
'undeploy',
propertyInstance.path,
`--resource=${baseHash}`
);

if (isProd) {
undeployCmd.addArg('--prod');
}

cb(null);
}, true);
undeployCmd.run(() => {
if (undeployCmd.failed) {
return cb(undeployCmd.error);
}

cb(null);
}, true);

undeployRunning = true;
undeployRunning = true;
});
});
};

Expand Down Expand Up @@ -363,7 +381,7 @@ module.exports = function(mainPath) {
let prepareProduction = (propertyPath, cb) => {
if (isProd) {
doCompileProd(propertyPath, cb);
} else if (!localOnly) {
} else if (!localOnly && !frontendOnly) {
let prompt = new Prompt('Prepare for production?');

prompt.readConfirm((result) => {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ module.exports = function(dependency, dumpPath) {
// @todo: remove on the next major release
// the following code is here for back compatibility
depName = depName.replace(/^(?:https?:\/\/)github\.com\/([^\/]+\/[^\/]+)(?:\.git)$/i, 'github://$1');
depName = depName.replace(/^github:\/\/([^#]+)(#[\d\.]+)?$/, (_, _depRepo, _depVersion) => {
depName = depName.replace(/^github:\/\/([^#]+)(#[\w\.]+)?$/, (_, _depRepo, _depVersion) => {
let depName = path.basename(_depRepo.replace('/', path.sep));
depName = depName.replace(/-microservices?/, '');
depVersion = `github://${_depRepo}${_depVersion || '#*'}`;
Expand Down
8 changes: 8 additions & 0 deletions src/bin/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ module.exports = {
description: 'Invalidate deep dependencies cache',
required: false,
},
frontend: {
description: 'Deploy only frontend resource',
required: false,
},
backend: {
description: 'Deploy only backend resource',
required: false,
}
},
args: {
path: {
Expand Down
26 changes: 16 additions & 10 deletions src/lib/Server/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,22 @@ export class Instance {

this._log(`Creating server on port ${port}`);

// @todo abstract this
let sslKeysDir = Path.join(__dirname, '..', '..', 'assets');
let options = {
key: FileSystem.readFileSync(Path.join(sslKeysDir, 'localhost.key')),
cert: FileSystem.readFileSync(Path.join(sslKeysDir, 'localhost.cert')),
};

this._server = (isSecured ? Https : Http).createServer(options, (...args) => {
this._handler(...args);
});
if (isSecured) {
// @todo abstract this
let sslKeysDir = Path.join(__dirname, '..', '..', 'assets');
let options = {
key: FileSystem.readFileSync(Path.join(sslKeysDir, 'localhost.key')),
cert: FileSystem.readFileSync(Path.join(sslKeysDir, 'localhost.cert')),
};

this._server = Https.createServer(options, (...args) => {
this._handler(...args);
});
} else {
this._server = Http.createServer((...args) => {
this._handler(...args);
});
}

var localDbInstance = null;

Expand Down
4 changes: 2 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "deepify",
"version": "1.8.32",
"buildDate": "Wed Oct 26 19:13:04 EEST 2016",
"version": "1.8.37",
"buildDate": "Wed Nov 30 12:48:39 EET 2016",
"description": "DEEP Development Tools",
"keywords": [
"Digital Enterprise End-To-End Platform",
Expand Down

0 comments on commit bd7f86d

Please sign in to comment.