* Module management to manage tarball packages * * pm2 install http.tar.gz * pm2 uninstall http * * - the first and only folder in the tarball must be called module (tar zcvf http module/) * - a package.json must be present with attribute "name", "version" and "pm2" to declare apps to run
(PM2, module_filepath, opts, cb)
| 32 | */ |
| 33 | |
| 34 | function install(PM2, module_filepath, opts, cb) { |
| 35 | // Remote file retrieval |
| 36 | if (module_filepath.includes('http') === true) { |
| 37 | var target_file = module_filepath.split('/').pop() |
| 38 | var target_filepath = path.join(os.tmpdir(), target_file) |
| 39 | |
| 40 | opts.install_url = module_filepath |
| 41 | |
| 42 | return retrieveRemote(module_filepath, target_filepath, (err) => { |
| 43 | if (err) { |
| 44 | Common.errMod(err) |
| 45 | process.exit(1) |
| 46 | } |
| 47 | installLocal(PM2, target_filepath, opts, cb) |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | // Local install |
| 52 | installLocal(PM2, module_filepath, opts, cb) |
| 53 | } |
| 54 | |
| 55 | function retrieveRemote(url, dest, cb) { |
| 56 | Common.logMod(`Retrieving remote package ${url}...`) |
nothing calls this directly
no test coverage detected
searching dependent graphs…