diff --git a/doc/CLI.md b/doc/CLI.md new file mode 100644 index 00000000..3f843bbb --- /dev/null +++ b/doc/CLI.md @@ -0,0 +1,96 @@ + +# CLI.js + +.pm2Init + +.connect +.lauchBus +.disconnectBus +.disconnect + +.start +._startScript +._startJson + +.deploy + +.getVersion +.actionFromJson +.startup + +.logrotate + +.ping +.reset + +.resurrect + +.update / .updatePM2 + +.dump +.web +.gracefulReload +.reload + +._reloadAll +._reloadProcessName +.remote +.remoteV2 + +._jsonStartOrAction + +._operate +.restart +._restart + +.delete +._stop +.generateSample + +.list +.jlist +.scale + +.flush + +.describe +.reloadLogs + +.sendDataToProcessId +.sendSignalToProcessName + +.sendSignalToProcessId + +.monit + +.streamLogs + +.killDaemon / .kill + +.install +.uninstall +.publish +.generateModuleSample +.killAllModules +.deleteModule + +.get +.set +.multiset +.unset +.conf + +.interact +.killInteract + +.infoInteract + +.pullAndRestart +.pullAndReload +.pullAngGracefulReload +.pullComitId +.backward +.forward +.forceGc / .gc + +.deepUpdate diff --git a/lib/CLI.js b/lib/CLI.js index 3d69e6a7..1466d482 100644 --- a/lib/CLI.js +++ b/lib/CLI.js @@ -29,6 +29,9 @@ var Utility = require('./Utility.js'); var Modularizer = require('./Modularizer.js'); var Configuration = require('../lib/Configuration.js'); +var CliHelper = require('./CLI/helper.js'); + + var Deploy = require('pm2-deploy'); var exitCli = Common.exitCli; @@ -452,7 +455,7 @@ CLI._startJson = function(cmd, opts, jsonVia, cb) { */ CLI.deploy = function(file, commands, cb) { if (file == 'help') { - deployHelp(); + CliHelper.deployHelp(); return cb ? cb() : exitCli(cst.SUCCESS_EXIT); } @@ -484,7 +487,7 @@ CLI.deploy = function(file, commands, cb) { } if (!env) { - deployHelp(); + CliHelper.deployHelp(); return cb ? cb() : exitCli(cst.SUCCESS_EXIT); } @@ -2525,44 +2528,3 @@ function parseConfig(confString, filename) { function warn(warning){ printOut(cst.PREFIX_MSG_WARNING + warning); } - -function deployHelp() { - console.log(''); - console.log('-----> Helper: Deployment with PM2'); - console.log(''); - console.log(' Generate a sample ecosystem.json with the command'); - console.log(' $ pm2 ecosystem'); - console.log(' Then edit the file depending on your needs'); - console.log(''); - console.log(' Commands:'); - console.log(' setup run remote setup commands'); - console.log(' update update deploy to the latest release'); - console.log(' revert [n] revert to [n]th last deployment or 1'); - console.log(' curr[ent] output current release commit'); - console.log(' prev[ious] output previous release commit'); - console.log(' exec|run execute the given '); - console.log(' list list previous deploy commits'); - console.log(' [ref] deploy to [ref], the "ref" setting, or latest tag'); - console.log(''); - console.log(''); - console.log(' Basic Examples:'); - console.log(''); - console.log(' First initialize remote production host:'); - console.log(' $ pm2 deploy ecosystem.json production setup'); - console.log(''); - console.log(' Then deploy new code:'); - console.log(' $ pm2 deploy ecosystem.json production'); - console.log(''); - console.log(' If I want to revert to the previous commit:'); - console.log(' $ pm2 deploy ecosystem.json production revert 1'); - console.log(''); - console.log(' Execute a command on remote server:'); - console.log(' $ pm2 deploy ecosystem.json production exec "pm2 restart all"'); - console.log(''); - console.log(' PM2 will look by default to the ecosystem.json file so you dont need to give the file name:'); - console.log(' $ pm2 deploy production'); - console.log(' Else you have to tell PM2 the name of your ecosystem file'); - console.log(''); - console.log(' More examples in https://github.com/Unitech/pm2'); - console.log(''); -} diff --git a/lib/CLI/helper.js b/lib/CLI/helper.js new file mode 100644 index 00000000..881652fa --- /dev/null +++ b/lib/CLI/helper.js @@ -0,0 +1,45 @@ + +var Helper = {}; + +Helper.deployHelp = function() { + console.log(''); + console.log('-----> Helper: Deployment with PM2'); + console.log(''); + console.log(' Generate a sample ecosystem.json with the command'); + console.log(' $ pm2 ecosystem'); + console.log(' Then edit the file depending on your needs'); + console.log(''); + console.log(' Commands:'); + console.log(' setup run remote setup commands'); + console.log(' update update deploy to the latest release'); + console.log(' revert [n] revert to [n]th last deployment or 1'); + console.log(' curr[ent] output current release commit'); + console.log(' prev[ious] output previous release commit'); + console.log(' exec|run execute the given '); + console.log(' list list previous deploy commits'); + console.log(' [ref] deploy to [ref], the "ref" setting, or latest tag'); + console.log(''); + console.log(''); + console.log(' Basic Examples:'); + console.log(''); + console.log(' First initialize remote production host:'); + console.log(' $ pm2 deploy ecosystem.json production setup'); + console.log(''); + console.log(' Then deploy new code:'); + console.log(' $ pm2 deploy ecosystem.json production'); + console.log(''); + console.log(' If I want to revert to the previous commit:'); + console.log(' $ pm2 deploy ecosystem.json production revert 1'); + console.log(''); + console.log(' Execute a command on remote server:'); + console.log(' $ pm2 deploy ecosystem.json production exec "pm2 restart all"'); + console.log(''); + console.log(' PM2 will look by default to the ecosystem.json file so you dont need to give the file name:'); + console.log(' $ pm2 deploy production'); + console.log(' Else you have to tell PM2 the name of your ecosystem file'); + console.log(''); + console.log(' More examples in https://github.com/Unitech/pm2'); + console.log(''); +}; + +module.exports = Helper;