Permalink
Browse files

Merge branch 'master' of github.com:IndigoUnited/automaton

  • Loading branch information...
2 parents 6f6276c + eb5fe19 commit 550079927d225816be198a90c61e21ffa579e3e1 @filipediasf filipediasf committed Jan 3, 2013
Showing with 991 additions and 160 deletions.
  1. +17 −6 bin/automaton.js
  2. +4 −1 example_task.js
  3. +95 −59 index.js
  4. +105 −49 lib/Logger.js
  5. +3 −3 lib/string/cast-interpolate.js
  6. +4 −4 lib/string/interpolate.js
  7. +6 −5 package.json
  8. +21 −12 tasks/run.js
  9. +27 −1 test/cli.js
  10. +116 −8 test/core.js
  11. +9 −0 test/helpers/tasks/dummy-mandatory.js
  12. +570 −0 test/logging.js
  13. +8 −8 test/tasks.js
  14. +6 −4 test/test.js
View
@@ -37,6 +37,10 @@ var commands = [
desc: 'Set the verbosity depth. Defaults to 1, and stands for how deep the feedback should go.'
},
{
+ opt: '--no-color',
+ desc: 'Disable colors'
+ },
+ {
opt: '--version, -v',
desc: 'Get version'
}
@@ -50,6 +54,11 @@ var options = {
debug: !!(argv.debug || argv.D)
};
+// only process the color if set
+if (argv.color != null) {
+ options.color = !!argv.color;
+}
+
// only process the verbosity if set
if (argv.verbosity != null || argv.V != null) {
options.verbosity = parseInt(argv.verbosity != null ? argv.verbosity : argv.V, 10);
@@ -104,7 +113,7 @@ if (argv.help || argv.h) {
showTaskUsage(task);
// unknown task requested
} catch (err) {
- console.error(('\nCould not find any task or autofile "' + taskId + '"\n').error);
+ console.error(('Could not find any task or autofile "' + taskId + '"\n').error);
}
// no task was specified, show overall usage
} else {
@@ -132,7 +141,7 @@ if (argv._.length) {
try {
task = automaton.getTask(taskId);
} catch (err) {
- console.error(('\nCould not find any task or autofile "' + taskId + '"\n').error);
+ console.error(('Could not find any task or autofile "' + taskId + '"\n').error);
process.exit(1);
}
}
@@ -242,7 +251,7 @@ function initTask(taskId) {
'name': taskId
}, function (err) {
if (err) {
- console.error(('\nUnable to create task\n').error);
+ console.error(('Unable to create task\n').error);
process.exit(1);
}
@@ -270,7 +279,9 @@ function runTask(task, options) {
task = automaton.getTask(task);
}
- automaton.run(task, options, function (err) {
- process.exit(err ? 1 : 0);
- });
+ automaton
+ .run(task, options, function (err) {
+ process.exit(err ? 1 : 0);
+ })
+ .pipe(process.stdout);
}
View
@@ -14,7 +14,7 @@ var task = {
// Filter is not mandatory,
// but can be used to perform some operation
// on the options before running the subtasks
- filter: function (options) {
+ filter: function (options, next) {
// You can change existing options
options.dir2 = options.dir2 + '_indigo';
@@ -23,6 +23,9 @@ var task = {
// a `dir3` option,
// which will be used by one of the subtasks
options.dir3 = 'united';
+
+ // Call next when done with the filter
+ next();
},
// This is also optional,
Oops, something went wrong.

0 comments on commit 5500799

Please sign in to comment.