mediawiki-extensions-Visual.../Gruntfile.js
Timo Tijhof a49195ac55 csslint: Add .csslintignore file and update gruntfile
Add .csslintignore file for the csslint run by Jenkins.

Also updating our Gruntfile for local usage to include demos,
which Jenkins is going to include as well (as it uses an ignore
blacklist instead of whitelist).

Change-Id: I9114cfc54e82f090f0fcf62155ef7c1a9261548d
2013-12-03 00:15:50 +01:00

62 lines
1.7 KiB
JavaScript

/*!
* Grunt file
*
* @package VisualEditor
*/
/*jshint node:true */
module.exports = function ( grunt ) {
var fs = require( 'fs' ),
exec = require( 'child_process' ).exec;
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-csslint' );
grunt.loadNpmTasks( 'grunt-contrib-qunit' );
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
jshint: {
options: JSON.parse( grunt.file.read( '.jshintrc' )
.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\//g, '' ).replace( /\/\/[^\n\r]*/g, '' ) ),
all: ['*.js', 'modules/{syntaxhighlight,unicodejs,ve,ve-mw}/**/*.js']
},
csslint: {
options: {
csslintrc: '.csslintrc'
},
all: ['demos/**/*.css', 'modules/{syntaxhighlight,ve,ve-mw}/**/*.css'],
},
qunit: {
ve: 'modules/ve/test/index-phantomjs-tmp.html'
},
watch: {
files: ['<%= jshint.all %>', '<%= csslint.all %>', '<%= qunit.all %>', '.{jshintrc,jshintignore,csslintrc}'],
tasks: ['test']
}
} );
grunt.registerTask( 'pre-qunit', function () {
var done = this.async();
grunt.file.setBase( __dirname + '/modules/ve/test' );
exec( 'php index.php > index-phantomjs-tmp.html', function ( err, stdout, stderr ) {
if ( err || stderr ) {
grunt.log.error( err || stderr );
done( false );
} else {
grunt.file.setBase( __dirname );
done( true );
}
} );
} );
grunt.event.on( 'qunit.done', function () {
fs.unlinkSync( __dirname + '/modules/ve/test/index-phantomjs-tmp.html' );
} );
grunt.registerTask( 'lint', ['jshint', 'csslint'] );
grunt.registerTask( 'unit', ['pre-qunit', 'qunit'] );
grunt.registerTask( 'test', ['lint', 'unit'] );
grunt.registerTask( 'default', 'test' );
};