*
* [--verbose] : Various tasks will produce more output to the console. No verbose by default.
* [--stubs] : Using stubs in index.html (for mocking services, controllers or any other stuff) No stubs by default.
- * [--environment] : Running tasks in integration or development environment. Development by default.
+ * [--environment production|development] : Running tasks in production or development environment.
+ * Development by default.
*/
/**
/**
* vet (evaluate) the code and create coverage report.
*
- * @return {Stream}
+ * @return {stream}
*/
gulp.task('vet', function() {
- log('Checking source files with JSHint and JSCS');
+ log('*** Checking source files with JSHint and JSCS ***');
return gulp.src(config.jsAllFiles)
.pipe(plugins.if(args.verbose, plugins.print()))
*/
gulp.task('wiredep', function() {
- log('Wiring bower dependencies into html');
+ log('*** Wiring bower dependencies into html ***');
var wiredep = require('wiredep').stream;
var jsFiles = args.stubs ? [].concat(config.jsFilesWithoutSpecs, config.jsFilesStubs) : config.jsFilesWithoutSpecs;
return gulp.src(config.index)
- .pipe(wiredep(config.getWiredepOptions()))
+ .pipe(wiredep(config.wiredepOptions))
.pipe(inject(jsFiles, ''))
.pipe(gulp.dest(config.main));
});
*/
gulp.task('wiredepkarma', function() {
- log('Wiring bower dependencies into karma.conf.js');
+ log('*** Wiring bower dependencies into karma.conf.js ***');
var wiredep = require('wiredep').stream;
return gulp.src(config.karmaConf)
- .pipe(wiredep(config.getWiredepKarmaOptions()))
+ .pipe(wiredep(config.wiredepKarmaOptions))
.pipe(gulp.dest(__dirname));
});
environment = args.environment;
}
- log('Starting server in ' + environment + ' mode');
+ log('*** Starting server in ' + environment + ' mode ***');
+
server(environment);
done();
});
* @return {Stream}
*/
gulp.task('test', ['vet', 'wiredepkarma'], function(done) {
+
+ log('*** Run tests once ***');
+
startTests(true, done);
});
* Run specs and wait. Watch for file changes and re-run tests on each change
*/
gulp.task('autotest', ['wiredepkarma'], function(done) {
+
+ log('*** Run tests and wait ***');
+
startTests(false, done);
});
/**
- * Builds application.
+ * Builds application for production.
*
- * @returns {stream} The stream.
+ * @return {stream} The stream.
*/
gulp.task('build', ['wiredep', 'test'], function() {
- log('Building application.');
+
+ log('*** Building application for production - Optimizing assets - HTML,CSS,JS');
var assets = plugins.useref.assets({searchPath: './'});
// Filters are named for the gulp-useref path
- var cssFilter = plugins.filter('**/*.css');
- var jsAppFilter = plugins.filter('**/' + config.build.app);
- var jslibFilter = plugins.filter('**/' + config.build.lib);
+ var cssFilter = plugins.filter('**/*.css', {restore: true});
+ var jsAppFilter = plugins.filter('**/app.js', {restore: true});
+ var jslibFilter = plugins.filter('**/lib.js', {restore: true});
return gulp.src(config.index)
// Gather all assets from the html with useref
// Get the css
.pipe(cssFilter)
.pipe(plugins.minifyCss())
- .pipe(cssFilter.restore())
+ .pipe(cssFilter.restore)
// Get the custom javascript
.pipe(jsAppFilter)
.pipe(plugins.ngAnnotate({add: true}))
}
}))
.pipe(getHeader())
- .pipe(jsAppFilter.restore())
+ .pipe(jsAppFilter.restore)
// Get the vendor javascript
.pipe(jslibFilter)
.pipe(plugins.uglify())
- .pipe(jslibFilter.restore())
+ .pipe(jslibFilter.restore)
// Take inventory of the file names for future rev numbers
.pipe(plugins.rev())
// Apply the concat and file replacement with useref
*
* @param {Array} source Source files (glob patterns)
* @param {string=} label The label name to be used by gulp-inject.
- * @returns {stream} The stream.
+ * @return {stream} The stream.
*/
function inject(source, label) {
var options = {relative: false};
/**
* Runs HTTP server.
*
- * @param {string=} [environment='development'] development or integration environments.
+ * @param {string=} [environment='development'] development or production environments.
+ * @return {undefined}
*/
function server(environment) {
var nodeOptions = {