-
Notifications
You must be signed in to change notification settings - Fork 13
/
grunt.js
69 lines (62 loc) · 2.11 KB
/
grunt.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
/*global module:false */
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-jasmine-task');
grunt.loadNpmTasks('grunt-text-replace');
grunt.initConfig({
lint: {
// js/js.* only contains coffee files
files: ['grunt.js', 'source/js/*.js', 'tests/jasmine/spec/*.js']
},
jasmine: {
all: {
src: 'tests/jasmine/SpecRunner.html',
errorReporting: true
}
},
replace: {
embedTransitIntoObjC: {
src: "source/objc/Transit.m",
overwrite: true,
replacements:[{
from: /\/\/ _TRANSIT_JS_RUNTIME_CODE_START[\s\S]*\/\/ _TRANSIT_JS_RUNTIME_CODE_END/,
to:function(){
var js = "(function(){";
js += grunt.file.read("source/js/transit.js");
js += grunt.file.read("source/js/transit-iframe.js");
js += "})()";
var replacement = "// _TRANSIT_JS_RUNTIME_CODE_START\n ";
replacement += JSON.stringify(js);
replacement += "\n // _TRANSIT_JS_RUNTIME_CODE_END";
return replacement;
}
}]
}
},
watch: {
files: ['grunt.js', 'source/**/*.js', 'tests/**/*.js', 'tests/**/*.html'],
tasks: ['continuous']
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true
},
globals: {
jQuery: true
}
}
});
// Default task.
grunt.registerTask('default', 'continuous watch');
grunt.registerTask('travis', 'lint jasmine');
grunt.registerTask('continuous', 'lint jasmine replace');
};