mirror of
https://github.com/Unitech/pm2.git
synced 2026-02-01 16:57:09 +00:00
#29 Minor code cleanup.
This commit is contained in:
parent
22a520501e
commit
1941a69a7b
74
lib/CLI.js
74
lib/CLI.js
@ -286,32 +286,6 @@ CLI.actionFromJson = function(action, file, jsonVia, cb) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Extend the app.env object of with the properties taken from the app.env_[envName].
|
||||
* @param {object} app The app object.
|
||||
* @param {string} envName The given environment name.
|
||||
* @param {object} deployConf Deployment configuration object (from JSON file or whatever).
|
||||
* @returns {object} The app.env variables object.
|
||||
*/
|
||||
function mergeEnvironmentVariables(app, envName, deployConf) {
|
||||
app.env = app.env || {};
|
||||
|
||||
// First merge variables from deploy.production.env object as least priority.
|
||||
if (deployConf && deployConf[envName] && deployConf[envName]['env']) {
|
||||
util._extend(app.env, deployConf[envName]['env']);
|
||||
}
|
||||
|
||||
if (envName && 'env_' + envName in app) {
|
||||
/**
|
||||
* Merge specific environment variables
|
||||
* `--env production` will merge `env_production` with the env
|
||||
*/
|
||||
util._extend(app.env, app['env_' + envName]);
|
||||
}
|
||||
|
||||
return app.env;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process and start a JSON file
|
||||
* @method startJson
|
||||
@ -1380,7 +1354,7 @@ var Version = require('./tools/VersionManagement.js');
|
||||
*/
|
||||
CLI.pullAndRestart = function (process_name, cb) {
|
||||
Version._pull({process_name: process_name, action: 'restart'}, cb);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CLI method for updating a repository
|
||||
@ -1390,7 +1364,7 @@ CLI.pullAndRestart = function (process_name, cb) {
|
||||
*/
|
||||
CLI.pullAndReload = function (process_name, cb) {
|
||||
Version._pull({process_name: process_name, action: 'reload'}, cb);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CLI method for updating a repository
|
||||
@ -1400,7 +1374,7 @@ CLI.pullAndReload = function (process_name, cb) {
|
||||
*/
|
||||
CLI.pullAndGracefulReload = function (process_name, cb) {
|
||||
Version._pull({process_name: process_name, action: 'gracefulReload'}, cb);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CLI method for updating a repository to a specific commit id
|
||||
@ -1410,7 +1384,7 @@ CLI.pullAndGracefulReload = function (process_name, cb) {
|
||||
*/
|
||||
CLI.pullCommitId = function (opts, cb) {
|
||||
Version.pullCommitId(opts.pm2_name, opts.commit_id);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* CLI method for downgrading a repository to the previous commit (older)
|
||||
@ -1428,6 +1402,10 @@ CLI.backward = Version.backward;
|
||||
*/
|
||||
CLI.forward = Version.forward;
|
||||
|
||||
//
|
||||
// Private methods
|
||||
//
|
||||
|
||||
/**
|
||||
* Description
|
||||
* @method getInteractInfo
|
||||
@ -1455,10 +1433,6 @@ function getInteractInfo(cb) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Private methods
|
||||
//
|
||||
var gl_retry = 0;
|
||||
/**
|
||||
* Description
|
||||
@ -1501,10 +1475,36 @@ function speedList() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the app.env object of with the properties taken from the app.env_[envName].
|
||||
* @param {Object} app The app object.
|
||||
* @param {string} envName The given environment name.
|
||||
* @param {Object} deployConf Deployment configuration object (from JSON file or whatever).
|
||||
* @returns {Object} The app.env variables object.
|
||||
*/
|
||||
function mergeEnvironmentVariables(app, envName, deployConf) {
|
||||
app.env = app.env || {};
|
||||
|
||||
// First merge variables from deploy.production.env object as least priority.
|
||||
if (deployConf && deployConf[envName] && deployConf[envName]['env']) {
|
||||
util._extend(app.env, deployConf[envName]['env']);
|
||||
}
|
||||
|
||||
if (envName && 'env_' + envName in app) {
|
||||
/**
|
||||
* Merge specific environment variables
|
||||
* `--env production` will merge `env_production` with the env
|
||||
*/
|
||||
util._extend(app.env, app['env_' + envName]);
|
||||
}
|
||||
|
||||
return app.env;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description
|
||||
* @method resolvePaths
|
||||
* @param {} appConf
|
||||
* @param {object} appConf
|
||||
* @return app
|
||||
*/
|
||||
function resolvePaths(appConf) {
|
||||
@ -1519,7 +1519,6 @@ function resolvePaths(appConf) {
|
||||
if (app instanceof Error) {
|
||||
printError(cst.PREFIX_MSG_ERR + app.message);
|
||||
throw new Error(app.message);
|
||||
return null;
|
||||
}
|
||||
return app;
|
||||
}
|
||||
@ -1656,13 +1655,14 @@ function prepareInterpreter(conf){
|
||||
conf.exec_interpreter = betterInterpreter || 'none';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show warnings
|
||||
* @param {String} warning
|
||||
*/
|
||||
function warn(warning){
|
||||
printOut(cst.PREFIX_MSG_WARNING + warning);
|
||||
};
|
||||
}
|
||||
|
||||
function deployHelp() {
|
||||
console.log('');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user