-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
115 lines (106 loc) · 2.59 KB
/
Gruntfile.js
File metadata and controls
115 lines (106 loc) · 2.59 KB
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
module.exports = function(grunt) {
require("load-grunt-tasks")(grunt);
grunt.loadNpmTasks("gruntify-eslint");
grunt.loadNpmTasks("grunt-contrib-yuidoc");
grunt.loadNpmTasks("grunt-contrib-watch");
var config = {
"pkg": grunt.file.readJSON("package.json"),
"eslint": {
"options": {
"globals": [
"Math"
],
"rules": {
"eqeqeq": 0,
"curly": [2, "all"],
"no-undef": 2,
"semi": 2,
"indent": [2, "tab", {
"ignoreComments": true,
"MemberExpression": 0,
"SwitchCase": 1
}],
"comma-dangle": 2,
"quotes": [2, "double"],
"no-unused-vars": [2, {
"varsIgnorePattern": "^_?ignore"
}],
"block-scoped-var": 2,
"no-undef": 2,
"semi": 2,
"camelcase": 2,
"max-depth": [1, {
"max": 4
}],
"no-unused-vars": 1
},
"terminateOnCallback": false,
"callback": function(response) {
if(response.errorCount) {
var result, message;
for(result=response.results.length-1; result !== -1; --result) {
if(!response.results[result].errorCount) {
response.results.splice(result,1);
} else {
for(message=response.results[result].messages.length-1; message !== -1; --message) {
if(response.results[result].messages[message].severity !== 2) {
response.results[result].messages.splice(message,1);
}
}
}
}
}
return response;
},
"envs": ["browser", "node", "jasmine"]
},
"lib": [
"lib/**/*.js",
"spec/*.js"
]
},
"watch": {
"lib": {
"files": ["index.js"],
"tasks": ["lint", "jasmine", "doc"]
}
},
"yuidoc": {
"compile": {
"name": "<%= pkg.name %>",
"description": "<%= pkg.description %>",
"version": "<%= pkg.version %>",
"url": "<%= pkg.homepage %>",
"options": {
"paths": ["./"],
"outdir": "./docs",
"markdown": true
}
}
}
};
grunt.initConfig(config);
grunt.registerTask("jasmine", function() {
var done = this.async();
var Jasmine = require("jasmine");
var jasmine = new Jasmine();
var Reporter = require("jasmine-console-reporter");
var reporter = new Reporter({
colors:2,
verbosity: 3,
emoji: false
});
jasmine.configureDefaultReporter(false);
jasmine.onComplete(done);
jasmine.loadConfig({
"spec_dir": "./",
"spec_files": ["specification.js"],
"random": false
});
jasmine.addReporter(reporter);
jasmine.execute();
});
grunt.registerTask("default", ["lint", "jasmine", "doc", "watch:lib"]);
grunt.registerTask("lint", ["eslint:lib"]);
grunt.registerTask("doc", ["yuidoc"]);
};