forked from ansman/validate.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
127 lines (125 loc) · 3.18 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
gruntfile: {
src: 'Gruntfile.js'
},
specs: {
src: 'specs/**/*.js',
options: {
ignores: ['specs/vendor/**/*.js'],
laxcomma: true,
curly: true
}
},
validate: {
src: '<%= pkg.name %>',
options: {
laxcomma: true,
curly: true
}
}
},
watch: {
jshintGruntfile: {
files: 'Gruntfile.js',
tasks: ['jshint:gruntfile'],
options: {
atBegin: true
}
},
jshintSrc: {
files: '<%= pkg.name %>',
tasks: ['jshint:validate'],
options: {
atBegin: true
}
},
jshintSpecs: {
files: 'specs/**/*.js',
tasks: ['jshint:specs'],
options: {
atBegin: true
}
},
specs: {
files: ['specs/**/*.js', '<%= pkg.name %>'],
tasks: ['jasmine:specs', 'jasmine:coverage'],
options: {
atBegin: true
}
}
},
jasmine: {
specs: {
src: "<%= pkg.name %>",
options: {
keepRunner: true,
vendor: "specs/vendor/**/*.js",
specs: "specs/**/*-spec.js",
helpers: "specs/helpers.js",
display: "short",
summary: true
}
},
coverage: {
src: "<%= jasmine.specs.src %>",
options: {
vendor: "<%= jasmine.specs.options.vendor %>",
specs: "<%= jasmine.specs.options.specs %>",
helpers: "<%= jasmine.specs.options.helpers %>",
display: "none",
template: require('grunt-template-jasmine-istanbul'),
templateOptions: {
coverage: 'coverage.json',
report: [{
type: 'text-summary'
}, {
type: 'lcovonly'
}, {
type: 'html',
options: {
dir: 'coverage'
}
}]
}
}
}
},
docco: {
src: "<%= pkg.name %>",
options: {
output: 'docs'
}
},
uglify: {
options: {
report: 'gzip',
banner: '/*!\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * http://validatejs.org/\n' +
' * (c) 2013-2015 Nicklas Ansman, 2013 Wrapp\n' +
' * <%= pkg.name %> may be freely distributed under the MIT license.\n' +
'*/\n'
},
dist: {
src: "<%= pkg.name %>",
dest: "validate.min.js",
options: {
sourceMap: true,
sourceMapName: 'validate.min.map'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-docco');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('default', 'watch');
grunt.registerTask('build', ['jshint:validate', 'jasmine:specs', 'uglify', 'docco']);
grunt.registerTask('test', ['jshint', 'jasmine']);
};