1 |
|
2 |
|
3 |
|
4 | 'use strict';
|
5 |
|
6 | module.exports = function(grunt) {
|
7 | 'use strict';
|
8 |
|
9 |
|
10 | grunt.initConfig({});
|
11 |
|
12 |
|
13 | grunt.config('mode',
|
14 | grunt.option('mode') || process.env.GRUNT_MODE || 'default');
|
15 |
|
16 | grunt.config('ci', grunt.option('mode') === 'ci');
|
17 |
|
18 |
|
19 | grunt.config('dirs', {
|
20 | 'bedrock': __dirname,
|
21 |
|
22 | 'main': __dirname
|
23 | });
|
24 |
|
25 |
|
26 | grunt.config('pkg', grunt.file.readJSON('package.json'));
|
27 |
|
28 | grunt.config('js', [
|
29 | '*.js',
|
30 | 'bin/*.js',
|
31 | 'bin/**/*.js',
|
32 | 'configs/*.js',
|
33 | 'lib/*.js',
|
34 | 'lib/**/*.js'
|
35 |
|
36 |
|
37 | ]);
|
38 |
|
39 |
|
40 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
41 | grunt.config('jshint', {
|
42 | all: {
|
43 | options: grunt.config('ci') ? {
|
44 | jshintrc: true,
|
45 | reporter: 'checkstyle',
|
46 | reporterOutput: 'reports/jshint.xml'
|
47 | } : {
|
48 | jshintrc: true
|
49 | },
|
50 | src: grunt.config('js')
|
51 | }
|
52 | });
|
53 |
|
54 | var _jscsOptions = {
|
55 | config: '<%= dirs.bedrock %>/.jscsrc',
|
56 | excludeFiles: []
|
57 | };
|
58 | if(grunt.config('ci')) {
|
59 | _jscsOptions.reporter = 'checkstyle';
|
60 | _jscsOptions.reporterOutput = 'reports/jscs.xml';
|
61 | }
|
62 |
|
63 | grunt.loadNpmTasks('grunt-jscs');
|
64 | grunt.config('jscs', {
|
65 | all: {
|
66 | options: _jscsOptions,
|
67 | src: grunt.config('js')
|
68 | }
|
69 | });
|
70 |
|
71 |
|
72 | grunt.registerTask('default', []);
|
73 | };
|