Skip to content
This repository has been archived by the owner on Mar 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #270 from Financial-Times/minor-fixes
Browse files Browse the repository at this point in the history
CLI won't break if task does not return promise or stream, and docume…
  • Loading branch information
Alberto Elias committed Jun 15, 2015
2 parents 730dbae + 0484f3f commit 85ee554
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ All the tasks are built using [gulp](http://gulpjs.com/), and almost all of them

Mostly used options include:
[--watch] Re-run every time a file changes
[--local] Build demos locally
[--runServer] Build demos locally and runs a server
[--updateorigami] Update origami.json with the latest demo files created
[--js=<path>] Main JavaScript file (default: ./src/main.js)
[--sass=<path>] Main Sass file (default: ./src/main.scss)
Expand Down
17 changes: 10 additions & 7 deletions lib/origami-build-tools-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function printUsage(commands) {
console.log('');
console.log('Mostly used options include:');
console.log(' [--watch] Re-run every time a file changes');
console.log(' [--local] Build demos locally');
console.log(' [--runServer] Build demos locally and runs a server');
console.log(' [--updateorigami] Update origami.json with the latest demo files created');
console.log(' [--js=<path>] Main JavaScript file (default: ./src/main.js)');
console.log(' [--sass=<path>] Main Sass file (default: ./src/main.scss)');
Expand Down Expand Up @@ -78,12 +78,15 @@ if (tasks.isValid(argument)) {
watcher.run(task, gulp, argv);
} else {
var taskResult = task(gulp, argv);
// Check if the function returns a Promise
if (taskResult instanceof Promise) {
taskResult.catch(reportTaskError);
// Check if it's a stream
} else if (taskResult.on) {
taskResult.on('error', reportTaskError);

if (typeof taskResult !== 'undefined' && taskResult !== null) {
// Check if the function returns a Promise
if (taskResult instanceof Promise) {
taskResult.catch(reportTaskError);
// Check if it's a stream
} else if (taskResult.on) {
taskResult.on('error', reportTaskError);
}
}
}
} else {
Expand Down

0 comments on commit 85ee554

Please sign in to comment.