-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
146 lines (130 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
142
143
144
145
146
/* globals module */
module.exports = function (grunt) {
/**
* Automatically load all Grunttasks, which follow the pattern `grunt-*`
*/
require('load-grunt-tasks')(grunt);
/**
* Allow description and definition of avaialable tasks
*/
grunt.config("availabletasks.tasks.options", {
/* No special config yet */
});
grunt.registerTask("tasks", ["availabletasks"]);
/**
* Basic configuration for all watch tasks
*/
grunt.config("watch", {
options: {
atBegin: true
}
});
/**
* Basic configuration for all symlink tasks
*/
grunt.config("symlink", {
options: {
overwrite: true
}
});
/**
* Jshint configuration for linting the project files
*/
grunt.config("jshint", {
options: {
jshintrc: "jshint.json"
},
all: [
"src/**/*.js"
]
});
grunt.config("watch.lint", {
files: grunt.config.get("jshint.all"),
tasks: ["lint"]
});
grunt.registerTask("lint", ["jshint"]);
grunt.config("watch.build", {
files: [
"src/**/*.js"
],
tasks: ["build"]
});
grunt.registerTask("build", ["lint"]);
/**
* Karma-Runner execution configuration to execute Unit-Tests from
* within Grunt
*/
grunt.config("karma", {
"all": {
configFile: 'karma.conf.js',
autoWatch: true
},
"all-single": {
configFile: 'karma.conf.js',
autoWatch: false
},
"dev":{
configFile: 'karma.conf.js',
browsers: ['PhantomJS'],
autoWatch: true
},
"dev-single": {
configFile: 'karma.conf.js',
browsers: ['PhantomJS'],
singleRun: true
}
});
// Execute single test run with PhantomJS
grunt.registerTask("test", ["karma:dev-single"]);
// Watch changes and run tests on Phantom automatically
grunt.registerTask("watch:test", ["karma:dev"]);
/**
* Symlink files to www directory
*/
grunt.config("symlink.www", {
/*
* Mostly use dynamic file lists in order to automatically skip those,
* which may not exist like vendor or node_modules or bower_components
*/
files: [
{
expand: true,
cwd: ".",
src: ["bower_components"],
dest: "www/"
},
{
expand: true,
cwd: ".",
src: ["node_modules"],
dest: "www/"
},
{
expand: true,
cwd: ".",
src: ["vendor"],
dest: "www/"
},
{
src: "src",
dest: "www/js"
},
{
expand: true,
cwd: "assets",
src: ["*"],
dest: "www/"
}
]
});
/**
* Clean all the build and temporary directories
*/
grunt.config("clean", {
"build": ["build/**/*"]
});
/**
* Default grunt task ;)
*/
grunt.registerTask("default", ["build"]);
};