Dev environment:force indentation to 2 spaces. Added new grunt module, grunt-leading-indent to check space consistency, and modified jshint options to enforce 2 spaces

This commit is contained in:
jdescottes
2013-08-10 12:11:16 +02:00
parent 9a68da8bda
commit 87a68bfe21
40 changed files with 2222 additions and 2206 deletions

View File

@ -19,6 +19,9 @@ module.exports = function(grunt) {
"smarttabs": true,
"eqnull": true
},*/
options: {
indent:2
},
files: [
'Gruntfile.js',
'package.json',
@ -39,8 +42,7 @@ module.exports = function(grunt) {
filesSrc: ['tests/integration/casperjs/*_test.js'],
options: {
args: {
baseUrl: 'http://localhost:' +
'<%= connect.www.options.port %>/'
baseUrl: 'http://localhost:' + '<%= connect.www.options.port %>/'
},
direct: false,
logLevel: 'error',
@ -51,10 +53,21 @@ module.exports = function(grunt) {
}
});
grunt.config.set('leadingIndent.indentation', 'spaces');
grunt.config.set('leadingIndent.jsFiles', {
src: ['js/**/*.js','!js/lib/**/*.js']
});
grunt.config.set('leadingIndent.cssFiles', {
src: ['css/**/*.css']
});
grunt.loadNpmTasks('grunt-leading-indent');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-ghost');
grunt.registerTask('check-indent', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles']);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('test', ['jshint', 'connect', 'ghost']);
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect', 'ghost']);
};

View File

@ -179,7 +179,7 @@
$.publish(Events.TOOL_RELEASED);
}
},
};
/**
* @private
@ -192,7 +192,7 @@
evtInfo.button = Constants.RIGHT_BUTTON;
}
return evtInfo;
},
};
/**
* @private

View File

@ -41,8 +41,10 @@
*/
getOrderedRectangleCoordinates : function (x0, y0, x1, y1) {
return {
x0 : Math.min(x0, x1), y0 : Math.min(y0, y1),
x1 : Math.max(x0, x1), y1 : Math.max(y0, y1),
x0 : Math.min(x0, x1),
y0 : Math.min(y0, y1),
x1 : Math.max(x0, x1),
y1 : Math.max(y0, y1),
};
},

View File

@ -15,6 +15,7 @@
"grunt": "~0.4.1",
"grunt-contrib-connect": "0.3.0",
"grunt-contrib-jshint": "0.5.4",
"grunt-ghost": "1.0.12"
"grunt-ghost": "1.0.12",
"grunt-leading-indent" : "0.1.0"
}
}