Skip to content

Commit

Permalink
cli command to update json
Browse files Browse the repository at this point in the history
  • Loading branch information
wonknu committed Aug 29, 2016
1 parent 2e417c8 commit 8274f53
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,28 @@ if (typeof userArgs[0] !== 'undefined' && userArgs[0] !== null) {
process.exit(0);
});

break;
case 'update-json':
var dir = process.cwd();
if (process.env.ROOT) {
dir = process.env.ROOT.replace(/\/$/, '');
}

var updateJson = (0, _child_process.spawn)('node', ['--harmony', '--debug', __dirname + '/cli/process/update-json.js', 'ABE_WEBSITE=' + dir]);

updateJson.stdout.on('data', function (data) {
console.log(_cliColor2.default.cyan('stdout'), data.toString());
});

updateJson.stderr.on('data', function (data) {
console.log(_cliColor2.default.red('stderr'), data.toString());
});

updateJson.on('close', function (code) {
console.log(_cliColor2.default.cyan('child process exited with code'), code);
process.exit(0);
});

break;
case 'install':
var dir = process.cwd();
Expand Down
22 changes: 22 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,28 @@ if(typeof userArgs[0] !== 'undefined' && userArgs[0] !== null){
process.exit(0)
});

break
case 'update-json':
var dir = process.cwd();
if(process.env.ROOT) {
dir = process.env.ROOT.replace(/\/$/, '')
}

const updateJson = spawn('node', ['--harmony', '--debug', __dirname + '/cli/process/update-json.js', 'ABE_WEBSITE=' + dir]);

updateJson.stdout.on('data', (data) => {
console.log(clc.cyan('stdout'), data.toString())
});

updateJson.stderr.on('data', (data) => {
console.log(clc.red('stderr'), data.toString())
});

updateJson.on('close', (code) => {
console.log(clc.cyan(`child process exited with code`), code);
process.exit(0)
});

break
case 'install':
var dir = process.cwd();
Expand Down

0 comments on commit 8274f53

Please sign in to comment.