forked from yandex-ui/nanoislands
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
141 lines (122 loc) · 3.27 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
132
133
134
135
136
137
138
139
140
141
/*jshint node:true*/
module.exports = function(grunt) {
"use strict";
require("load-grunt-tasks")(grunt);
var gruntConfig = {};
gruntConfig.jshint = {
options: {
jshintrc: ".jshintrc",
force: true
},
files: [
"blocks/*/*.js"
]
};
gruntConfig.jscs = {
src: "blocks/*/*.js",
options: {
config: ".jscs.json",
requireCurlyBraces: ["if"],
force: true
}
};
gruntConfig.shell = {
rebuildNanoislands: {
command: "make",
options: {
stdout: true,
failOnError: true
}
},
rebuildDocs: {
command: "make docs",
options: {
stdout: true,
failOnError: true
}
}
};
gruntConfig.watch = {
build: {
files: [
"<%= jshint.files %>",
"blocks/*/*.yate",
"blocks/*/*.md",
"blocks/*/*.styl",
"demo/*.yate",
"docs/*",
"docs/**/*"
],
tasks: [
"codestyle",
"shell:rebuildNanoislands",
"shell:rebuildDocs"
],
options: {
// Start a live reload server on the default port 35729
livereload: true
}
},
test: {
files: [
"<%= watch.build.files %>",
"unittests/**/*.js",
"unittests/**/*.yate"
],
tasks: [
"karma:dev:run"
]
}
};
gruntConfig.karma = {
options: {
configFile: "karma.conf.js"
},
continuous: {
singleRun: true,
browsers: ["PhantomJS", "Firefox"]
},
dev: {
background: true,
reporters: "dots"
}
};
grunt.initConfig(gruntConfig);
grunt.registerTask("codestyle", [
"jshint",
"jscs"
]);
grunt.registerTask("test", [
"codestyle",
"karma:continuous"
]);
grunt.registerTask("watch_make_test", [
"codestyle",
"karma:dev:start",
"watch"
]);
grunt.registerTask("watch_make", [
"codestyle",
"watch:build"
]);
grunt.registerTask("regtest", "Regression testing of blocks", function() {
var diff = grunt.option('diff');
var upd = grunt.option('update');
var done = this.async();
var operation;
var blocks;
if (grunt.option('e') || grunt.option('explain'))
process.env.verboseTest = 1;
// options can be either string or boolean
if (diff) {
operation = 'diff';
blocks = typeof diff === 'string' ? diff.split(',') : [];
} else if (grunt.option('update')) {
operation = 'update';
blocks = typeof upd === 'string' ? upd.split(',') : [];
} else
return console.log('not a valid command. Please use --diff or --update');
require('./regression-tests/run')(operation, blocks, done);
})
grunt.registerTask("default", ["test"]);
};