-
Notifications
You must be signed in to change notification settings - Fork 149
/
gruntfile.js
131 lines (126 loc) · 5.01 KB
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
eslint: {
src: [
'static/script/**/*.js',
'static/script-tests/**/*.js'
],
options: {
quiet: true
}
},
jasmine: {
src: 'static/script/**/*.js',
options: {
specs: ['static/script-tests/tests/**/*.js'],
vendor: [
'static/script-tests/lib/sinon.js',
'static/script-tests/lib/ondevicetestconfigvalidate.js',
'static/script-tests/lib/require.js',
'static/script-tests/jasmine/jstestdriver-adapter.js',
'static/script-tests/lib/mockapplication.js',
'static/script-tests/lib/phantompolyfills.js',
'static/script-tests/mocks/mockelement.js',
'static/script-tests/tests/devices/mediaplayer/commontests.js',
'static/script-tests/tests/devices/mediaplayer/html5commontests.js',
'static/script-tests/tests/devices/mediaplayer/cehtmlcommontests.js'
],
styles: [
'static/script-tests/lib/carousels.css',
'static/script-tests/lib/css3transitions.css'
],
template: 'static/script-tests/jasmine/SpecRunner.html',
outfile: 'static/script-tests/jasmine/WebRunner.html',
keepRunner: true,
display: 'full',
templateOptions: {
scriptRoot: '../..'
},
summary: true
}
},
watch: {
eslint: {
files: ['static/script/**/*.js'],
tasks: ['eslint']
}
},
complexity: {
generic: {
src: ['static/script/**/*.js'],
exclude: ['static/script/targets/core.js'],
expand: true,
options: {
breakOnErrors: false,
jsLintXML: 'report.xml', // create XML JSLint-like report
checkstyleXML: 'checkstyle.xml', // create checkstyle report
errorsOnly: false, // show only maintainability errors
cyclomatic: [3, 7, 12], // or optionally a single value, like 3
halstead: [8, 13, 20], // [difficulty, volume, effort] or optionally a single value, like 8
maintainability: 100,
hideComplexFunctions: false, // only display maintainability
broadcast: false // broadcast data over event-bus
}
}
},
replace: {
'jsdoc-tidy': {
src: ['jsdoc/**/*.html'],
overwrite: true,
replacements: [{
from: '../symbols/',
to: ''
}, {
from: '</body>',
to: grunt.file.read('jsdoc/footer.txt').trim() + '</body>'
}]
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%' + (grunt.option('m') ? ' - ' + grunt.option('m') : ''),
commitFiles: ['package.json', 'bower.json'],
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Version %VERSION%' + (grunt.option('m') ? ' - ' + grunt.option('m') : ''),
push: true,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d',
globalReplace: false,
prereleaseName: false,
regExp: false
}
},
jsdoc: {
dist: {
src: ['static/script/*/**.js'],
options: {
destination: 'jsdoc'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-complexity');
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('gruntify-eslint');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('test', ['jasmine', 'eslint']);
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('full', ['eslint', 'jasmine']);
grunt.registerTask('default', 'full');
grunt.registerTask('spec', ['jasmine:src:build', 'openspec']);
grunt.registerTask('openspec', 'Open the generated Jasmine spec file', function() {
var childProcess = require('child_process');
var outfile = grunt.config('jasmine.options.outfile');
grunt.log.writeln('Opening ' + outfile + '...');
childProcess.exec('open ' + outfile);
});
};