This repository was archived by the owner on Dec 7, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathGruntfile.js
127 lines (112 loc) · 2.86 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) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON("package.json"),
banner: "/*!\n"
+ " * <%= pkg.title %> - v<%= pkg.version %>\n"
+ " *\n"
+ " * Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %> <<%= pkg.author.url %>>\n"
+ " * Released under the <%= pkg.license %> license\n"
+ " *\n"
+ " * Date: <%= grunt.template.today('yyyy-mm-dd') %>\n"
+ " */\n\n",
// Task configuration.
concat: {
options: {
separator: "\n",
stripBanners: true
},
dist: {
options: { banner: "<%= banner %>" },
src: "<%= pkg.name %>.js",
dest: "<%= pkg.name %>.js"
},
html_inspector_test: {
src: [
"test/html-inspector/*.js",
"test/html-inspector/modules-intro.txt",
"test/html-inspector/modules/*.js",
"test/html-inspector/modules-outro.txt",
"test/html-inspector/rules-intro.txt",
"test/html-inspector/rules/*.js",
"test/html-inspector/rules-outro.txt"
],
dest: "test/html-inspector-test.js"
}
},
browserify: {
dist: {
src: "src/html-inspector.js",
dest: "<%= pkg.name %>.js"
}
},
jshint: {
options: {
jshintrc: ".jshintrc"
},
src: {
src: "src/**/*.js"
},
classes_test: {
src: "test/classes/**/*.js"
},
html_inspector_test: {
src: "test/html-inspector/**/*.js"
}
},
watch: {
gruntfile: {
files: ["Gruntfile.js"],
tasks: ["default"]
},
test: {
files: ["test/browser/**/*.js"],
tasks: ["jshint:test", "concat:test"]
},
src: {
files: ["src/**/*.js"],
tasks: ["jshint:src", "browserify"]
}
},
mochacli: {
options: {
reporter: "spec"
},
src: "test/classes/**/*.js"
},
mocha_phantomjs: {
html_inspector: {
src: "test/html-inspector-test.html"
}
}
})
// These plugins provide necessary tasks.
grunt.loadNpmTasks("grunt-contrib-concat")
grunt.loadNpmTasks("grunt-contrib-jshint")
grunt.loadNpmTasks("grunt-contrib-watch")
grunt.loadNpmTasks("grunt-browserify")
grunt.loadNpmTasks("grunt-mocha-cli")
grunt.loadNpmTasks("grunt-mocha-phantomjs")
grunt.registerTask("test:classes", [
"jshint:classes_test",
"mochacli"
])
grunt.registerTask("test:html_inspector", [
"jshint:html_inspector_test",
"concat:html_inspector_test",
"browserify:dist",
"concat:dist",
"mocha_phantomjs:html_inspector"
])
grunt.registerTask("test", [
"test:classes",
"test:html_inspector"
])
grunt.registerTask("default", [
"jshint:src",
"test",
"browserify:dist",
"concat:dist"
])
}