Server IP : 85.214.239.14 / Your IP : 18.190.24.105 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/cwd/proc/3/cwd/proc/3/root/proc/2/cwd/usr/lib/node_modules/pm2/lib/API/Modules/ |
Upload File : |
/*************************** * * Module methods * **************************/ var cst = require('../../../constants.js'); var Common = require('../../Common.js'); var chalk = require('chalk'); var forEachLimit = require('async/forEachLimit'); var Modularizer = require('./Modularizer.js'); module.exports = function(CLI) { /** * Install / Update a module */ CLI.prototype.install = function(module_name, opts, cb) { var that = this; if (typeof(opts) == 'function') { cb = opts; opts = {}; } Modularizer.install(this, module_name, opts, function(err, data) { if (err) { Common.printError(cst.PREFIX_MSG_ERR + (err.message || err)); return cb ? cb(Common.retErr(err)) : that.speedList(cst.ERROR_EXIT); } return cb ? cb(null, data) : that.speedList(cst.SUCCESS_EXIT); }); }; /** * Uninstall a module */ CLI.prototype.uninstall = function(module_name, cb) { var that = this; Modularizer.uninstall(this, module_name, function(err, data) { if (err) return cb ? cb(Common.retErr(err)) : that.speedList(cst.ERROR_EXIT); return cb ? cb(null, data) : that.speedList(cst.SUCCESS_EXIT); }); }; CLI.prototype.launchAll = function(CLI, cb) { Modularizer.launchModules(CLI, cb); }; CLI.prototype.package = function(module_path, cb) { Modularizer.package(this, module_path, (err, res) => { if (err) { Common.errMod(err) return cb ? cb(err) : this.exitCli(1) } Common.logMod(`Module packaged in ${res.path}`) return cb ? cb(err) : this.exitCli(0) }) }; /** * Publish module on NPM + Git push */ CLI.prototype.publish = function(folder, opts, cb) { var that = this; Modularizer.publish(this, folder, opts, function(err, data) { if (err) return cb ? cb(Common.retErr(err)) : that.speedList(cst.ERROR_EXIT); return cb ? cb(null, data) : that.speedList(cst.SUCCESS_EXIT); }); }; /** * Publish module on NPM + Git push */ CLI.prototype.generateModuleSample = function(app_name, cb) { var that = this; Modularizer.generateSample(app_name, function(err, data) { if (err) return cb ? cb(Common.retErr(err)) : that.exitCli(cst.ERROR_EXIT); return cb ? cb(null, data) : that.exitCli(cst.SUCCESS_EXIT); }); }; /** * Special delete method */ CLI.prototype.deleteModule = function(module_name, cb) { var that = this; var found_proc = []; this.Client.getAllProcess(function(err, procs) { if (err) { Common.printError('Error retrieving process list: ' + err); return cb(Common.retErr(err)); } procs.forEach(function(proc) { if (proc.pm2_env.name == module_name && proc.pm2_env.pmx_module) { found_proc.push(proc.pm_id); } }); if (found_proc.length == 0) return cb(); that._operate('deleteProcessId', found_proc[0], function(err) { if (err) return cb(Common.retErr(err)); Common.printOut('In memory process deleted'); return cb(); }); }); }; };