Permalink
Browse files

chore(test-build) gulp build exits with clean code on error

Gulp tasks don't exit with clean error code when failing.
Which can't be used in CI tools such as Travis.
Fixed the build task, adding error handling to runSequence,
process.exit now on error.
  • Loading branch information...
topheman committed Aug 16, 2015
1 parent 3edde62 commit 2f55094b473e3423e223ed53d279edaaf7a20fdb
Showing with 14 additions and 2 deletions.
  1. +14 −2 gulp/tasks/build.js
View
@@ -122,12 +122,24 @@ gulp.task('compile', ['htmlhint', 'sass', 'bundle'], () => {
/**
* The 'build' task gets app ready for deployment by processing files
* and put them into directory ready for production.
*
* Added callback to manage errors and exit with a clean exit code if task fails
* (needed for CI tools such as Travis)
*/
//@todo manage environment / root files like .ico .htaccess ... / fonts ?
gulp.task('build', (cb) => {
runSequence(
['clean'],
['compile', 'extras', 'images'],
cb
(err) => {
if (err) {
let exitCode = 2;
LOG('[ERROR] gulp build task failed', err);
LOG('[FAIL] gulp build task failed - exiting with code ' + exitCode);
return process.exit(exitCode);
}
else {
return cb();
}
}
);
});

0 comments on commit 2f55094

Please sign in to comment.