MCPcopy Index your code
hub / github.com/Unitech/pm2 / install

Function install

lib/API/Modules/TAR.js:34–53  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

32 */
33
34function 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
55function retrieveRemote(url, dest, cb) {
56 Common.logMod(`Retrieving remote package ${url}...`)

Callers

nothing calls this directly

Calls 3

retrieveRemoteFunction · 0.85
installLocalFunction · 0.85
exitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…