From 0f7cf546fd645c6f033fa60f71c26751622b10fe Mon Sep 17 00:00:00 2001 From: Ryan Hutchison Date: Sun, 19 Jul 2015 21:47:35 -0400 Subject: [PATCH 1/2] move task configs to separate properties. remove watch on gulpfile.js --- config/assets/default.js | 4 +++- gruntfile.js | 6 +++--- gulpfile.js | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config/assets/default.js b/config/assets/default.js index 42f1b1062a..27eece02fe 100644 --- a/config/assets/default.js +++ b/config/assets/default.js @@ -36,7 +36,9 @@ module.exports = { views: ['modules/*/client/views/**/*.html'] }, server: { - allJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'modules/*/server/**/*.js'], + gruntConfig: 'gruntfile.js', + gulpConfig: 'gulpfile.js', + allJS: ['server.js', 'config/**/*.js', 'modules/*/server/**/*.js'], models: 'modules/*/server/models/**/*.js', routes: ['modules/!(core)/server/routes/**/*.js', 'modules/core/server/routes/**/*.js'], sockets: 'modules/*/server/sockets/**/*.js', diff --git a/gruntfile.js b/gruntfile.js index a5425b6e04..821987c93c 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -31,7 +31,7 @@ module.exports = function (grunt) { } }, serverJS: { - files: defaultAssets.server.allJS, + files: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS), tasks: ['jshint'], options: { livereload: true @@ -78,7 +78,7 @@ module.exports = function (grunt) { options: { nodeArgs: ['--debug'], ext: 'js,html', - watch: _.union(defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config) + watch: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config) } } }, @@ -91,7 +91,7 @@ module.exports = function (grunt) { }, jshint: { all: { - src: _.union(defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e), + src: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e), options: { jshintrc: true, node: true, diff --git a/gulpfile.js b/gulpfile.js index c9b0fe6c12..2aa60690ba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -42,6 +42,7 @@ gulp.task('watch', function() { plugins.livereload.listen(); // Add watch rules + gulp.watch(defaultAssets.server.gulpConfig, ['jshint']); gulp.watch(defaultAssets.server.views).on('change', plugins.livereload.changed); gulp.watch(defaultAssets.server.allJS, ['jshint']).on('change', plugins.livereload.changed); gulp.watch(defaultAssets.client.views).on('change', plugins.livereload.changed); @@ -65,7 +66,7 @@ gulp.task('csslint', function (done) { // JS linting task gulp.task('jshint', function () { - return gulp.src(_.union(defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e)) + return gulp.src(_.union(defaultAssets.server.gulpConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e)) .pipe(plugins.jshint()) .pipe(plugins.jshint.reporter('default')) .pipe(plugins.jshint.reporter('fail')); From 3e378b4a54f7393b0fbe9f522fdd4a329c41b5f4 Mon Sep 17 00:00:00 2001 From: Ryan Hutchison Date: Sun, 19 Jul 2015 22:02:33 -0400 Subject: [PATCH 2/2] BUG: Path separator support for windows. --- gulpfile.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2aa60690ba..6d39dfa13e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,7 +9,8 @@ var _ = require('lodash'), gulp = require('gulp'), gulpLoadPlugins = require('gulp-load-plugins'), runSequence = require('run-sequence'), - plugins = gulpLoadPlugins(); + plugins = gulpLoadPlugins(), + path = require('path'); // Set NODE_ENV to 'test' gulp.task('env:test', function () { @@ -96,8 +97,8 @@ gulp.task('cssmin', function () { gulp.task('sass', function () { return gulp.src(defaultAssets.client.sass) .pipe(plugins.sass()) - .pipe(plugins.rename(function (path) { - path.dirname = path.dirname.replace('/scss', '/css'); + .pipe(plugins.rename(function (file) { + file.dirname = file.dirname.replace(path.sep + 'scss', path.sep + 'css'); })) .pipe(gulp.dest('./modules/')); }); @@ -106,8 +107,8 @@ gulp.task('sass', function () { gulp.task('less', function () { return gulp.src(defaultAssets.client.less) .pipe(plugins.less()) - .pipe(plugins.rename(function (path) { - path.dirname = path.dirname.replace('/less', '/css'); + .pipe(plugins.rename(function (file) { + file.dirname = file.dirname.replace(path.sep + 'less', path.sep + 'css'); })) .pipe(gulp.dest('./modules/')); });