diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe0b45..2fdd57b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ `time-require` changelog ====================== +- v0.1.1 (2014.04.10) + * gulpfile.js: add `notifyError` for stream error notification, add `seqTask` for sequential task control, fix `project.js` config replacing `lib/` with `src/` + * README.md: detail project hosting [@BitBucket](https://bitbucket.org/jaguard/time-require) & mirror [@GitHub](https://github.com/jaguard/time-require). + * LICENSE.md renamed to LICENSE to keep it as a simple text file + * package.json: set the [GitHub](https://github.com/jaguard/time-require) mirror as repository, add `run-sequence` for task order control, add `gulp-notify` for notification support - v0.1.0 (2014.04.10) + Added `.travis.yml` file for travis-ci.org build support + Published `time-require` module to [npm](https://www.npmjs.org/package/time-require) diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md index 8d16966..acb6247 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ > Displays the execution time for Node.js modules loading by hooking and tracing all `require()` calls. This module was inspired by [@sindresorhus](https://twitter.com/sindresorhus)'s [time-grunt](https://github.com/sindresorhus/time-grunt). +**NOTE:** The project is hosted [@BitBucket](https://bitbucket.org/jaguard/time-require) but a mirror is available as well [@GitHub](https://github.com/jaguard/time-require). + ## Project status - NPM version: [![NPM version](https://badge.fury.io/js/time-require.svg)](https://www.npmjs.org/package/time-require) - Travis-CI build: [![Build Status](http://img.shields.io/travis/jaguard/time-require.svg)](http://travis-ci.org/jaguard/time-require) @@ -43,18 +45,23 @@ To **sort** the modules according to the loading time (longest on top) use the ` ## Documentation -Detailed API documentation can be found in ['doc'](https://bitbucket.org/jaguard/time-require/raw/master/doc/api.md) folder. +Detailed API documentation can be found in ['doc'](https://bitbucket.org/jaguard/time-require/src/master/doc/api.md) folder. ## Development -Detailed development documentation can be found in ['doc'](https://bitbucket.org/jaguard/time-require/raw/master/doc/dev.md) folder. +Detailed development documentation can be found in ['doc'](https://bitbucket.org/jaguard/time-require/src/master/doc/dev.md) folder. ## License -MIT © [Jaguard OSS](http://oss.jaguard.com) +[MIT](https://bitbucket.org/jaguard/time-require/raw/master/LICENSE) © [Jaguard OSS](http://oss.jaguard.com) ## Changelog +- v0.1.1 (2014.04.10) + * gulpfile.js: add `notifyError` for stream error notification, add `seqTask` for sequential task control, fix `project.js` config replacing `lib/` with `src/` + * README.md: detail project hosting [@BitBucket](https://bitbucket.org/jaguard/time-require) & mirror [@GitHub](https://github.com/jaguard/time-require). + * LICENSE.md renamed to LICENSE to keep it as a simple text file + * package.json: set the [GitHub](https://github.com/jaguard/time-require) mirror as repository, add `run-sequence` for task order control, add `gulp-notify` for notification support - v0.1.0 (2014.04.10) + Added `.travis.yml` file for travis-ci.org build support + Published `time-require` module to [npm](https://www.npmjs.org/package/time-require) diff --git a/gulpfile.js b/gulpfile.js index 3b0435b..3fc3754 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,14 +10,16 @@ var gulp = require("gulp"), // http://gulpjs.com $ = require("gulp-load-plugins")(), // lazy loading plugins: https://github.com/jackfranklin/gulp-load-plugins + sequence = require("run-sequence"), // specify run order https://github.com/OverZealous/run-sequence gutil = require("gulp-util"), // https://github.com/gulpjs/gulp log = gutil.log, + colors = gutil.colors, // watching flag watching = false, // project config /* jshint -W015 */ project = { - js: ["*.js", "lib/**/*.js", "test/**/*.js"], // include JavaScript files + js: ["*.js", "src/**/*.js", "test/**/*.js"], // include JavaScript files specs: ["test/**/*.spec.js"], // include JavaScript files md: ["*.md", "doc/*.md"], // include all markdown files json: ["*.json", ".*rc"], // include all json and rc files @@ -36,6 +38,22 @@ function cache(name) { return $.if(watching, $.cached(name)); } +/** + * Add error notification for the specified stream using the type as a title prefix + */ +function notifyError(stream, type) { + stream.on("error", function(err) { + var title = type + " error", + message = err.message; + log(colors.red(title) + ": " + colors.yellow(message)); + $.notify({ + title: title, + message: message + }); + }); + return stream; +} + /** * Wrap src to automatically set the base to current working directory */ @@ -52,6 +70,17 @@ function task(name, deps, fn) { return gulp.task(name, deps, fn); } +/** + * Wrap gulp.task usage for sequencial execution for more expressive usage + */ +function seqTask(name) { + var tasks = Array.prototype.slice.call(arguments, 1); + task(name, function(cb) { // run the tasks in the specified order + tasks.push(cb); + sequence.apply(undefined, tasks); + }); +} + /** * Wrap gulp.watch with file change reporting and watching flag setting for triggered tasks */ @@ -62,7 +91,7 @@ function watch(glob, opt, fn) { // set watching flag watching = true; // log the change - log("The file " + gutil.colors.yellow(event.path) + " was " + gutil.colors.green(event.type)); + log("The file " + colors.yellow(event.path) + " was " + colors.green(event.type)); }); return watcher; } @@ -84,7 +113,7 @@ task("jshint", function() { .pipe(cache("js")) // enable caching just when watching .pipe($.jshint()) .pipe($.jshint.reporter("jshint-stylish")) - .pipe($.if(!watching, $.jshint.reporter("fail"))); // fail if not running under watcher + .pipe($.if(!watching, notifyError($.jshint.reporter("fail"), "JSHint"))); // fail if not running under watcher }); // define "jscs" task for JavaScript code style constraints @@ -92,7 +121,7 @@ task("jscs", function() { log("Linting JavaScript files"); return src(project.js) .pipe(cache("jscs")) // enable caching just when watching - .pipe($.jscs()); + .pipe(notifyError($.jscs(), "JSCS")); }); // define "jsonlint" task for JSON linting @@ -144,7 +173,7 @@ task("test", function() { log("Execute Jasmine tests/specs"); return src(project.specs) .pipe(cache("specs")) // enable caching just when watching - .pipe($.jasmine({ verbose: true })); + .pipe(notifyError($.jasmine({ verbose: true }),"Jasmine")); }); // define "watch" task to start watch/interactive development mode @@ -158,7 +187,7 @@ task("watch", function() { // define top tasks & aliases task("lint", ["jsonlint", "jshint", "jscs"]); task("doc", ["jsdoc", "docco", "md"]); // TODO: "mdpdf" removed, pdf generation will block -task("build", ["lint", "test", "doc"]); +seqTask("build", "clean", "lint", "test", "doc"); // run sequentially // define default task task("default", ["build"]); diff --git a/package.json b/package.json index fab35f5..a0547ed 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ - { +{ "name": "time-require", - "version": "0.1.0", + "version": "0.1.1", "description": "Displays the execution time for Node.js modules loading; inspired by @sindresorhus 'time-grunt'", - "url": "https://bitbucket.org/jaguard/time-require", "homepage": "https://bitbucket.org/jaguard/time-require", "keywords": ["require", "measure", "time", "profile"], "author": { @@ -12,7 +11,7 @@ }, "repository": { "type": "git", - "url": "git://bitbucket.org/jaguard/time-require" + "url": "git://github.com/jaguard/time-require" }, "bugs": { "url": "https://bitbucket.org/jaguard/time-require/issues" @@ -32,6 +31,7 @@ "gulp": "~3.6.0", "gulp-util": "~2.2.14", "gulp-load-plugins": "~0.5.0", + "run-sequence": "~0.3.6", "gulp-clean": "~0.2.4", "gulp-cached": "~0.0.3", "gulp-jshint": "~1.5.2", @@ -44,12 +44,13 @@ "gulp-markdown-pdf": "~0.2.0", "gulp-jsdoc": "~0.1.2", "gulp-jasmine": "~0.2.0", + "gulp-notify": "~1.2.5", "jshint-stylish": "~0.1.5" }, "licenses": [ { "type": "MIT", - "url": "https://bitbucket.org/jaguard/time-require/raw/master/LICENSE.md" + "url": "https://bitbucket.org/jaguard/time-require/raw/master/LICENSE" } ], "engines": {