pm2-deploy
Advanced tools
Comparing version 0.3.8 to 0.3.9
@@ -18,7 +18,7 @@ var fs = require('fs'); | ||
proc.on('error', function(e) { | ||
proc.on('error', function (e) { | ||
return cb(e.stack || e); | ||
}); | ||
proc.on('close', function(code) { | ||
proc.on('close', function (code) { | ||
if (code == 0) return cb(null, args); | ||
@@ -40,8 +40,8 @@ else return cb(code); | ||
var piped_data = JSON.stringify(deploy_conf[env]); | ||
var piped_data = JSON.stringify(deploy_conf[env]); | ||
var target_conf = JSON.parse(piped_data); //effectively clones the conf | ||
if(target_conf.ssh_options) { | ||
if (target_conf.ssh_options) { | ||
var ssh_opt = ''; | ||
if(Array.isArray(target_conf.ssh_options)) { | ||
if (Array.isArray(target_conf.ssh_options)) { | ||
ssh_opt = '-o ' + target_conf.ssh_options.join(' -o '); | ||
@@ -90,4 +90,4 @@ } else { | ||
if (Array.isArray(target_conf.host)) { | ||
async.series(target_conf.host.reduce(function(jobs, host) { | ||
jobs.push(function(done) { | ||
async.series(target_conf.host.reduce(function (jobs, host) { | ||
jobs.push(function (done) { | ||
@@ -99,3 +99,3 @@ if (process.env.NODE_ENV !== 'test') { | ||
target_conf.host = host; | ||
target_conf['post-deploy'] = 'export ' + objectToEnvVars(target_conf.env) + ' && ' + target_conf['post-deploy'] | ||
var custom_data = JSON.stringify(target_conf); | ||
@@ -112,2 +112,4 @@ | ||
} | ||
target_conf['post-deploy'] = 'export ' + objectToEnvVars(target_conf.env) + ' && ' + target_conf['post-deploy'] | ||
spawn(JSON.stringify(target_conf), args, cb); | ||
@@ -119,5 +121,11 @@ } | ||
function objectToEnvVars(obj) { | ||
return !obj ? '' : Object.keys(obj).map(function (key) { | ||
return key.toUpperCase() + '=' + obj[key]; | ||
}).join(' ') | ||
} | ||
function run() { | ||
var conf = JSON.parse(fs.readFileSync('app.json')); | ||
var args = process.argv; | ||
var conf = JSON.parse(fs.readFileSync('app.json')); | ||
var args = process.argv; | ||
@@ -131,3 +139,3 @@ if (args.indexOf('deploy') == -1) | ||
Deploy.deployForEnv(conf.deploy, env, args, function(err, data) { | ||
Deploy.deployForEnv(conf.deploy, env, args, function (err, data) { | ||
console.log(arguments); | ||
@@ -134,0 +142,0 @@ }); |
{ | ||
"name": "pm2-deploy", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"description": "Deployment system for PM2", | ||
@@ -15,8 +15,8 @@ "main": "deploy.js", | ||
"async": "^1.5", | ||
"tv4": "^1.2" | ||
"tv4": "^1.3" | ||
}, | ||
"devDependencies": { | ||
"better-assert": "^1.0.0", | ||
"mocha": "^1.20.1", | ||
"should": "^4.0.0" | ||
"mocha": "^3.5", | ||
"should": "^11" | ||
}, | ||
@@ -23,0 +23,0 @@ "author": "Alexandre Strzelewicz", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15087
148
8
Updatedtv4@^1.3