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

23
index.js Normal file → Executable file
View file

@ -1,3 +1,20 @@
process.chdir(__dirname);
var shout = require("./src/server");
shout();
#!/usr/bin/env node
process.chdir(__dirname);
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",
"description": "A web IRC client",
"version": "0.8.10",
"version": "0.8.11",
"homepage": "http://github.com/erming/shout",
"author": {
"name": "Mattias Erming",
@ -33,6 +33,7 @@
"url": "https://github.com/erming/shout.git"
},
"dependencies": {
"commander": "^2.3.0",
"connect": "~2.19.6",
"lodash": "~2.4.1",
"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("Press ctrl-c to stop");
console.log("");
if (config.public) {
return;