Browse Source

Almost at 0.2.0, killAllConfirm.js needs to work (async)

pull/6/head
Muthu Kumar 7 years ago
parent
commit
a049e2fee9
  1. 32
      actions/killAllConfirm.js
  2. 7
      index.js
  3. 125
      package-lock.json
  4. 1
      package.json

32
actions/killAllConfirm.js

@ -0,0 +1,32 @@
const prompt = require('prompt');
const shell = require('shelljs');
const killAll = require('./killALL');
function killAllConfirm () {
// Start the prompt
prompt.start();
var property = {
name: 'yesno',
message: 'This will completely destroy all configs and reset nginx. Are you sure?',
validator: /y[es]*|n[o]?/,
warning: 'Must respond yes or no',
default: 'no'
};
prompt.get(property, function (err, res) {
if(res.yesno == "no") {
console.log("Aborted!");
shell.exit(0);
}
else {
console.log("Deleting all servers...");
killAll();
console.log("\nDone. All configs have been destroyed. Hope you're happy.");
}
});
}
module.exports = killAllConfirm;

7
index.js

@ -12,7 +12,7 @@ var createProxyServer = require('./actions/createProxyServer');
var createStaticServer = require('./actions/createStaticServer'); var createStaticServer = require('./actions/createStaticServer');
var killServer = require('./actions/killServer'); var killServer = require('./actions/killServer');
var listServers = require('./actions/listServers'); var listServers = require('./actions/listServers');
var killALL = require('./actions/killALL'); var killAllConfirm = require('./actions/killAllConfirm');
// Requiring utils // Requiring utils
var validate = require('./utils/validate'); var validate = require('./utils/validate');
@ -68,9 +68,8 @@ program
.command('kill-all') .command('kill-all')
.description('Warning! Will completely kill all servers and reset nginx') .description('Warning! Will completely kill all servers and reset nginx')
.action(function() { .action(function() {
killALL(); killAllConfirm();
console.log("\nAll servers have been killed.\n" + console.log("\nA backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" +
"A backup of your old servers.up is saved in /etc/up-serve/servers.bak.up.\n" +
"Check this if you need to.\n"); "Check this if you need to.\n");
}); });

125
package-lock.json

@ -1,6 +1,6 @@
{ {
"name": "up-serve", "name": "up-serve",
"version": "0.1.8", "version": "0.1.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -95,6 +95,11 @@
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
"dev": true "dev": true
}, },
"async": {
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
"integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
},
"babel-code-frame": { "babel-code-frame": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@ -264,6 +269,11 @@
"which": "1.3.0" "which": "1.3.0"
} }
}, },
"cycle": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
"integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI="
},
"debug": { "debug": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
@ -273,6 +283,11 @@
"ms": "2.0.0" "ms": "2.0.0"
} }
}, },
"deep-equal": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz",
"integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0="
},
"deep-is": { "deep-is": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
@ -422,6 +437,11 @@
"tmp": "0.0.33" "tmp": "0.0.33"
} }
}, },
"eyes": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A="
},
"fast-deep-equal": { "fast-deep-equal": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
@ -544,6 +564,11 @@
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz",
"integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE="
}, },
"i": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/i/-/i-0.3.6.tgz",
"integrity": "sha1-2WyScyB28HJxG2sQ/X1PZa2O4j0="
},
"iconv-lite": { "iconv-lite": {
"version": "0.4.19", "version": "0.4.19",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
@ -660,6 +685,11 @@
"integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"dev": true "dev": true
}, },
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"js-tokens": { "js-tokens": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
@ -754,14 +784,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
"dev": true
}, },
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -775,8 +803,7 @@
"mute-stream": { "mute-stream": {
"version": "0.0.7", "version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s="
"dev": true
}, },
"natural-compare": { "natural-compare": {
"version": "1.4.0", "version": "1.4.0",
@ -784,6 +811,11 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true "dev": true
}, },
"ncp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz",
"integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY="
},
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@ -864,6 +896,11 @@
"pinkie": "2.0.4" "pinkie": "2.0.4"
} }
}, },
"pkginfo": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz",
"integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8="
},
"pluralize": { "pluralize": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
@ -904,12 +941,33 @@
"integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
"dev": true "dev": true
}, },
"prompt": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz",
"integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=",
"requires": {
"colors": "1.1.2",
"pkginfo": "0.4.1",
"read": "1.0.7",
"revalidator": "0.1.8",
"utile": "0.3.0",
"winston": "2.1.1"
}
},
"pseudomap": { "pseudomap": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true "dev": true
}, },
"read": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
"integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=",
"requires": {
"mute-stream": "0.0.7"
}
},
"readable-stream": { "readable-stream": {
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz",
@ -967,11 +1025,15 @@
"signal-exit": "3.0.2" "signal-exit": "3.0.2"
} }
}, },
"revalidator": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz",
"integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs="
},
"rimraf": { "rimraf": {
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
"dev": true,
"requires": { "requires": {
"glob": "7.1.2" "glob": "7.1.2"
} }
@ -1058,6 +1120,11 @@
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true "dev": true
}, },
"stack-trace": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"string-width": { "string-width": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -1175,6 +1242,19 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
"dev": true "dev": true
}, },
"utile": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz",
"integrity": "sha1-E1LDQOuCDk2N26A5pPv6oy7U7zo=",
"requires": {
"async": "0.9.2",
"deep-equal": "0.2.2",
"i": "0.3.6",
"mkdirp": "0.5.1",
"ncp": "1.0.1",
"rimraf": "2.6.2"
}
},
"which": { "which": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz",
@ -1184,6 +1264,37 @@
"isexe": "2.0.0" "isexe": "2.0.0"
} }
}, },
"winston": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz",
"integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=",
"requires": {
"async": "1.0.0",
"colors": "1.0.3",
"cycle": "1.0.3",
"eyes": "0.1.8",
"isstream": "0.1.2",
"pkginfo": "0.3.1",
"stack-trace": "0.0.10"
},
"dependencies": {
"async": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
"integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k="
},
"colors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
},
"pkginfo": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz",
"integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE="
}
}
},
"wordwrap": { "wordwrap": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",

1
package.json

@ -32,6 +32,7 @@
"commander": "^2.11.0", "commander": "^2.11.0",
"fs-extra": "^4.0.2", "fs-extra": "^4.0.2",
"prettyjson": "^1.2.1", "prettyjson": "^1.2.1",
"prompt": "^1.0.0",
"shelljs": "^0.7.8" "shelljs": "^0.7.8"
}, },
"devDependencies": { "devDependencies": {

Loading…
Cancel
Save