-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathGruntfile.js
137 lines (131 loc) · 4.29 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
/**
* Created by dhayes on 3/29/14.
*/
module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-jade");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-env");
grunt.loadNpmTasks("grunt-cafe-mocha");
grunt.loadTasks("./tasks");
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
env: {
test: { NODE_ENV: 'test' },
dev: { NODE_ENV: 'development'}
},
karma: {
unit: {
configFile: 'karma/karma.conf.js',
background: true
},
continuous: {
configFile: 'karma/karma.conf.js',
singleRun: true,
browsers: ['PhantomJS']
}
},
cafemocha: {
test: {
src: 'test/*.js',
options: {
ui: 'bdd'
}
}
},
less: {
build: {
files: {
"public/css/app.css": "src/less/app.less",
"public/css/dashboard.css": "src/less/dashboard.less",
"public/css/app-bootstrap.css": "src/less/app-bootstrap.less"
}
}
},
uglify: {
dist: {
files: {
"dist/js/app.js": "<%= concat.app.dest %>",
"dist/js/components.js": "<%= concat.components.dest %>"
}
}
},
jshint: {
options: {
jshintrc: true
},
target: "<%= concat.app.src %>"
},
concat: {
app: {
src: ['src/app/**/*.js','!src/app/**/*.spec.js'],
dest: 'public/js/app.js'
},
components: {
src: ['src/components/**/*.js', '!src/components/**/*.spec.js'],
dest: 'public/js/components.js'
}
},
copy: {
build: {
cwd: 'src/images',
expand: true,
src: '**/*',
dest: 'public/images/'
},
dist: {
cwd: 'public',
expand: true,
src: '**/*',
dest: 'dist/'
}
},
clean: {
build: ['public'],
dist: ['dist']
},
watch: {
app: {
files: "<%= concat.app.src %>",
tasks: "concat:app"
},
components: {
files: "<%= concat.components.src %>",
tasks: "concat:components"
},
less: {
files: "src/less/**/*.less",
tasks: "less"
},
copy: {
files: "src/images/**/*",
tasks: "copy:build"
},
karma: {
files: ['src/app/**/*.js'],
tasks: ['karma:unit:run']
}
}
});
grunt.registerTask('printenv', function(){
console.log(process.env);
});
grunt.registerTask('build', ['jshint', 'clean:build', 'copy:build', 'less', 'concat']);
grunt.registerTask('default', ['build', 'karma:unit:start', 'watch']);
grunt.registerTask('package', ['build', 'clean:dist', 'copy:dist', 'uglify']);
grunt.registerTask('test', ['env:test', 'build', 'cafemocha:test', 'karma:continuous']);
grunt.registerTask('dropTestDatabase', ['env:test', 'dropDatabase']);
grunt.registerTask('dropDevDatabase', ['env:dev', 'dropDatabase']);
grunt.registerTask('addTestUsers', ['env:test', 'addUsers']);
grunt.registerTask('addDevUsers', ['env:dev', 'addUsers']);
grunt.registerTask('addTestStorerooms', ['env:test', 'addStorerooms']);
grunt.registerTask('addDevStorerooms', ['env:dev', 'addStorerooms']);
grunt.registerTask('addTestItems', ['env:test', 'addItems']);
grunt.registerTask('addDevItems', ['env:dev', 'addItems']);
};