8
0
فهرست منبع

The jscs and jshint will now append .gitignore entries to the configuration instead of replacing it.

fredck 11 سال پیش
والد
کامیت
d8a91dccce
4فایلهای تغییر یافته به همراه16 افزوده شده و 18 حذف شده
  1. 1 9
      dev/tasks/jscs.js
  2. 1 9
      dev/tasks/jshint.js
  3. 8 0
      dev/tasks/res/tools.js
  4. 6 0
      gruntfile.js

+ 1 - 9
dev/tasks/jscs.js

@@ -8,6 +8,7 @@ module.exports = function( grunt ) {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jscs',
 		defaultOptions: grunt.file.readJSON( 'dev/tasks/jscs-config.json' ),
+		addGitIgnore: 'excludeFiles',
 		targets: {
 			all: function() {
 				return [ '**/*.js' ];
@@ -20,14 +21,5 @@ module.exports = function( grunt ) {
 		}
 	} );
 
-	// Take ignore list from .gitIgnore.
-	grunt.config.merge( {
-		jscs: {
-			options: {
-				excludeFiles: tools.getGitIgnore( grunt )
-			}
-		}
-	} );
-
 	grunt.loadNpmTasks( 'grunt-jscs' );
 };

+ 1 - 9
dev/tasks/jshint.js

@@ -8,6 +8,7 @@ module.exports = function( grunt ) {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jshint',
 		defaultOptions: grunt.file.readJSON( 'dev/tasks/jshint-config.json' ),
+		addGitIgnore: 'ignores',
 		targets: {
 			all: function() {
 				return [ '**/*.js' ];
@@ -20,14 +21,5 @@ module.exports = function( grunt ) {
 		}
 	} );
 
-	// Take ignore list from .gitIgnore.
-	grunt.config.merge( {
-		jshint: {
-			options: {
-				ignores: tools.getGitIgnore( grunt )
-			}
-		}
-	} );
-
 	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
 };

+ 8 - 0
dev/tasks/res/tools.js

@@ -53,6 +53,14 @@ module.exports = {
 			config.all = all();
 		}
 
+		// Append .gitignore entries to the ignore list.
+		if ( options.addGitIgnore ) {
+			var ignoreProp = task + '.options.' + options.addGitIgnore,
+				ignores = grunt.config.get( ignoreProp ) || [];
+			ignores = ignores.concat( this.getGitIgnore( grunt ) );
+			grunt.config.set( ignoreProp, ignores );
+		}
+
 		// Merge over configurations set in gruntfile.js.
 		grunt.config.merge( taskConfig );
 	},

+ 6 - 0
gruntfile.js

@@ -12,11 +12,17 @@ module.exports = function( grunt ) {
 
 		jshint: {
 			options: {
+				ignores: [
+					// Automatically loaded from .gitignore. Add more if necessary.
+				]
 			}
 		},
 
 		jscs: {
 			options: {
+				excludeFiles: [
+					// Automatically loaded from .gitignore. Add more if necessary.
+				]
 			}
 		}
 	} );