forked from Fattr/fattr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gruntfile.js
136 lines (116 loc) · 2.84 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
module.exports = function(grunt) {
'use strict';
// Project configuration.
var clientSideJavascriptFiles = "public/js/src/**/*.js";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
express: {
dev: {
options: {
cmd: 'coffee',
script: '/app.coffee'
}
}
},
coffeelint: {
app: 'app/**/*.coffee'
},
coffee: {
options: {
sourceMap: true
},
compile: {
files: [{
expand: true,
cwd: 'app/coffee',
src: '**/*.coffee',
dest: 'app/js',
ext: '.js'
}]
}
},
watch: {
coffee: {
files: ['app/**/*.coffee'],
tasks: ['coffeelint','coffee']
},
js: {
files: [clientSideJavascriptFiles],
tasks: ['jshint'],
options: {
livereload: true,
},
},
html: {
files: ['index.html, public/templates/**/'],
options: {
livereload: true,
},
},
css: {
files: ['public/css/**'],
options: {
livereload: true
}
},
karma: {
files: [clientSideJavascriptFiles, 'test/jasmine/**/*.js'],
tasks: ['karma:unit:run']
}
},
jshint: {
all: ['gruntfile.js', clientSideJavascriptFiles]
},
mochaTest: {
test: {
options: {
require: 'coffee-script',
reporter: 'spec'
},
src: ['app/coffee/test/*.coffee']
}
},
env: {
test: {
NODE_ENV: 'test'
}
},
// Karma will run our Jasmine tests for us
karma: {
unit: {
configFile: 'public/test/karma/karma.conf.js'
}
},
shell: {
server: {
options: {
stdout: true
},
command: 'nodemon app/coffee/app.coffee'
}
},
});
// Server side plugins
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-mocha-test');
// client side plugins
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
// Server side tasks
grunt.registerTask('build', ['coffeelint', 'coffee']);
grunt.registerTask('serve', ['build','shell:server']);
grunt.registerTask('test', ['mochaTest:test', 'karma:unit']);
grunt.registerTask('travis', ['build', 'test']);
// client side tasks
grunt.registerTask('testClient', ['env:test', 'karma:unit']);
grunt.registerTask('sass', ['sass']);
// deafult tasks lints and compiles coffe
// use grunt command no options
grunt.registerTask('default', ['jshint','test', 'watch']);
};