Change config command to edit config.js in the Shout home directory

Also, copy config.js to the Shout home directory if it's not already
there.
This commit is contained in:
Shell Turner 2014-10-01 18:43:46 +02:00
parent 791a5914df
commit b7fd64c2d8
1 changed files with 13 additions and 1 deletions

View File

@ -1,7 +1,19 @@
var fs = require("fs");
var path = require("path");
var program = require("commander");
var mkdirp = require("mkdirp");
var child = require("child_process");
var Helper = require("../helper");
var CONFIG_PATH = process.cwd() + "/config.js";
var CONFIG_PATH = process.env.SHOUT_CONFIG;
if(!CONFIG_PATH) {
CONFIG_PATH = Helper.resolveHomePath("config.js");
}
if(!fs.exists(CONFIG_PATH)) {
mkdirp.sync(Helper.getHomeDirectory());
var configFile = fs.readFileSync(path.resolve(__dirname, "..", "..", "config.js"));
fs.writeFileSync(CONFIG_PATH, configFile);
}
program
.command("config")