Skip to content

Commit

Permalink
Merge pull request #6 from FreeAllMedia/feature/superstack
Browse files Browse the repository at this point in the history
add watch, supestack and generator version
  • Loading branch information
nicosommi committed Aug 7, 2015
2 parents e5e6b15 + af49398 commit d9b952f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
2 changes: 2 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./tasks/suppress-errors.js";
import "./tasks/build-spec.js";
import "./tasks/build-spec-assets.js";
import "./tasks/build-lib.js";
Expand All @@ -6,3 +7,4 @@ import "./tasks/build.js";
import "./tasks/test-local.js";
import "./tasks/test-browsers.js";
import "./tasks/test.js";
import "./tasks/test-watch.js";
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dovima",
"version": "0.1.7",
"version": "0.1.8",
"description": "ES6 generic model with lots of useful special features.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -51,6 +51,7 @@
"gulp-babel": "^5.1.0",
"gulp-istanbul": "^0.10.0",
"gulp-mocha": "^2.1.1",
"gulp-util": "^3.0.6",
"karma": "^0.12.36",
"karma-browserify": "^4.2.1",
"karma-chai": "^0.1.0",
Expand All @@ -63,6 +64,8 @@
"karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.2.11",
"mocha": "^2.2.5",
"sinon": "^1.15.4"
}
"sinon": "^1.15.4",
"superstack": "0.0.4"
},
"generatorVersion": "0.2.20"
}
31 changes: 31 additions & 0 deletions tasks/suppress-errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import gulp from "gulp";
import gutil from "gulp-util";

// Watch tasks should depend on suppress-errors - it will force all stream pipes to print but not crash on error
gulp.task("suppress-errors", function(){
function monkeyPatchPipe(o){
while(!o.hasOwnProperty("pipe")){
o = Object.getPrototypeOf(o);
if(!o){
return;
}
}
var originalPipe = o.pipe;
var newPipe = function(){
var result = originalPipe.apply(this, arguments);
result.setMaxListeners(0);
if(!result.pipe["monkey patched for suppress-errors"]){
monkeyPatchPipe(result);
}

return result.on("error", function (err) {
gutil.log(gutil.colors.yellow(err));
gutil.beep();
this.emit("end");
});
};
newPipe["monkey patched for suppress-errors"] = true;
o.pipe = newPipe;
}
monkeyPatchPipe(gulp.src(""));
});
1 change: 1 addition & 0 deletions tasks/test-local.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import gulp from "gulp";
import mocha from "gulp-mocha";
import "superstack";
import istanbul from "gulp-istanbul";
import paths from "../paths.json";

Expand Down
11 changes: 11 additions & 0 deletions tasks/test-watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import gulp from "gulp";
import paths from "../paths.json";

gulp.task("test-watch", ["suppress-errors"], () => {
gulp.watch([
paths.source.lib,
paths.source.spec,
paths.source.specAssets,
paths.source.libAssets
], ["test-local"]);
});

0 comments on commit d9b952f

Please sign in to comment.