Don't alias tt special pages to titles with double underscore
[mediawiki.git] / Gruntfile.js
blobe4322797bb6d23af253c3823190a22c61820f4bf
1 /*jshint node:true */
2 module.exports = function ( grunt ) {
3         grunt.loadNpmTasks( 'grunt-contrib-jshint' );
4         grunt.loadNpmTasks( 'grunt-contrib-watch' );
5         grunt.loadNpmTasks( 'grunt-banana-checker' );
6         grunt.loadNpmTasks( 'grunt-jscs' );
7         grunt.loadNpmTasks( 'grunt-jsonlint' );
8         grunt.loadNpmTasks( 'grunt-karma' );
10         var wgServer = process.env.MW_SERVER,
11                 wgScriptPath = process.env.MW_SCRIPT_PATH,
12                 karmaProxy = {};
14         karmaProxy[wgScriptPath] = wgServer + wgScriptPath;
16         grunt.initConfig( {
17                 pkg: grunt.file.readJSON( 'package.json' ),
18                 jshint: {
19                         options: {
20                                 jshintrc: true
21                         },
22                         all: [
23                                 '*.js',
24                                 '{includes,languages,resources,tests}/**/*.js'
25                         ]
26                 },
27                 jscs: {
28                         all: [
29                                 '<%= jshint.all %>',
30                                 // Auto-generated file with JSON (double quotes)
31                                 '!tests/qunit/data/mediawiki.jqueryMsg.data.js',
32                                 // Skip functions are stored as script files but wrapped in a function when
33                                 // executed. node-jscs trips on the would-be "Illegal return statement".
34                                 '!resources/src/*-skip.js'
36                         // Exclude all files ignored by jshint
37                         ].concat( grunt.file.read( '.jshintignore' ).split( '\n' ).reduce( function ( patterns, pattern ) {
38                                 // Filter out empty lines
39                                 if ( pattern.length && pattern[0] !== '#' ) {
40                                         patterns.push( '!' + pattern );
41                                 }
42                                 return patterns;
43                         }, [] ) )
44                 },
45                 jsonlint: {
46                         all: [
47                                 '.jscsrc',
48                                 '{languages,maintenance,resources}/**/*.json',
49                                 'package.json'
50                         ]
51                 },
52                 banana: {
53                         core: 'languages/i18n/',
54                         api: 'includes/api/i18n/',
55                         installer: 'includes/installer/i18n/'
56                 },
57                 watch: {
58                         files: [
59                                 '<%= jscs.all %>',
60                                 '<%= jsonlint.all %>',
61                                 '.jshintignore',
62                                 '.jshintrc'
63                         ],
64                         tasks: 'test'
65                 },
66                 karma: {
67                         options: {
68                                 proxies: karmaProxy,
69                                 files: [ {
70                                         pattern: wgServer + wgScriptPath + '/index.php?title=Special:JavaScriptTest/qunit/export',
71                                         watched: false,
72                                         included: true,
73                                         served: false
74                                 } ],
75                                 frameworks: [ 'qunit' ],
76                                 reporters: [ 'dots' ],
77                                 singleRun: true,
78                                 autoWatch: false
79                         },
80                         main: {
81                                 browsers: [ 'Chrome' ]
82                         },
83                         more: {
84                                 browsers: [ 'Chrome', 'Firefox' ]
85                         }
86                 }
87         } );
89         grunt.registerTask( 'lint', ['jshint', 'jscs', 'jsonlint', 'banana'] );
90         grunt.registerTask( 'qunit', 'karma:main' );
92         grunt.registerTask( 'test', ['lint'] );
93         grunt.registerTask( 'default', 'test' );