Skip to content

Commit

Permalink
still tweaking..
Browse files Browse the repository at this point in the history
  • Loading branch information
clux committed Mar 28, 2015
1 parent ca99725 commit 2aea6e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
3 changes: 2 additions & 1 deletion bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ var argv = require('yargs')
.help('h')
.argv;

require('./lib/cli').run(argv, function (err) {
require('./lib/cli').run(argv, function (err, res) {
if (err) {
console.error('symlink:', err.message);
process.exit(1);
}
//console.log(res)
process.exit(0);
});
20 changes: 6 additions & 14 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,15 @@ var async = require('async');

var dryRunHandler = function (cmds, done) {
console.log(JSON.stringify(cmds, null, " "));
done();
done(null);
};

var executeHandler = function (cmds, done) {
// create one cp function cmd that execs and cbs to next in async series
var execs = cmds.map(function (cmd) {
return function (cb) {
console.log(cmd); // npm link xs && npm install ys && npm link
cp.exec(cmd, function (error, stdout) {
console.log(stdout);
cb(error);
});
};
});

// exec commands synchronously
async.series(execs, done);
var iterator = function (cmd, cb) {
console.log(cmd);
cp.exec(cmd, cb);
};
async.mapSeries(cmds, iterator, done);
};

exports.run = function (argv, done) {
Expand Down

0 comments on commit 2aea6e8

Please sign in to comment.