Turn index.js into an executable

This commit is contained in:
Mattias Erming 2014-08-05 01:32:25 -07:00
parent 928220c6c1
commit 4b21c319c2
3 changed files with 25 additions and 5 deletions

21
index.js Normal file → Executable file
View File

@ -1,3 +1,20 @@
#!/usr/bin/env node
process.chdir(__dirname); process.chdir(__dirname);
var shout = require("./src/server");
shout(); var program = require("commander");
var shout = require("./src/server.js");
var version = require("./package.json").version;
program
.command("start")
.description("Starts the server.")
.action(function() {
shout();
});
program.parse(process.argv)
if (!program.args.length) {
program.help();
}

View File

@ -1,7 +1,7 @@
{ {
"name": "shout", "name": "shout",
"description": "A web IRC client", "description": "A web IRC client",
"version": "0.8.10", "version": "0.8.11",
"homepage": "http://github.com/erming/shout", "homepage": "http://github.com/erming/shout",
"author": { "author": {
"name": "Mattias Erming", "name": "Mattias Erming",
@ -33,6 +33,7 @@
"url": "https://github.com/erming/shout.git" "url": "https://github.com/erming/shout.git"
}, },
"dependencies": { "dependencies": {
"commander": "^2.3.0",
"connect": "~2.19.6", "connect": "~2.19.6",
"lodash": "~2.4.1", "lodash": "~2.4.1",
"moment": "~2.7.0", "moment": "~2.7.0",

View File

@ -41,8 +41,10 @@ module.exports = function() {
} }
}); });
console.log("Server started."); console.log("");
console.log("Shout is now running on port " + port); console.log("Shout is now running on port " + port);
console.log("Press ctrl-c to stop");
console.log("");
if (config.public) { if (config.public) {
return; return;