-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
151 lines (144 loc) · 4.02 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
147
148
149
150
151
'use strict';
module.exports = function(grunt) {
require('time-grunt')(grunt);
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
js: {
files: ['gruntfile.js', 'application.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
livereload: true
}
},
html: {
files: ['public/views/**', 'app/views/**'],
options: {
livereload: true
}
}
},
nodemon: {
dev: {
script: 'application.js',
options: {
args: [],
ignore: ['public/**'],
ext: 'js,html',
nodeArgs: [],
delayTime: 1,
env: {
PORT: 3000
},
cwd: __dirname
}
}
},
concurrent: {
serve: ['nodemon', 'watch'],
debug: ['node-inspector', 'shell:debug', 'open:debug'],
options: {
logConcurrentOutput: true
}
},
env: {
options: {},
// environment variables - see https://github.com/jsoverson/grunt-env for more information
local: {
FH_USE_LOCAL_DB: true,
}
},
'node-inspector': {
dev: {}
},
shell: {
debug: {
options: {
stdout: true
},
command: 'env NODE_PATH=. node --debug-brk application.js'
},
unit: {
options: {
stdout: true,
stderr: true
},
command: 'env NODE_PATH=. ./node_modules/.bin/mocha -A -u exports --recursive test/unit/'
},
accept: {
options: {
stdout: true,
stderr: true
},
command: 'env NODE_PATH=. ./node_modules/.bin/mocha -A -u exports --recursive test/server.js test/accept/'
},
coverage_unit: {
options: {
stdout: true,
stderr: true
},
command: [
'rm -rf coverage cov-unit',
'env NODE_PATH=. ./node_modules/.bin/istanbul cover --dir cov-unit ./node_modules/.bin/turbo -- test/unit',
'./node_modules/.bin/istanbul report',
'echo "See html coverage at: `pwd`/coverage/lcov-report/index.html"'
].join('&&')
},
coverage_accept: {
options: {
stdout: true,
stderr: true
},
command: [
'rm -rf coverage cov-accept',
'env NODE_PATH=. ./node_modules/.bin/istanbul cover --dir cov-accept ./node_modules/.bin/turbo -- --setUp=test/accept/server.js --tearDown=test/accept/server.js test/accept',
'./node_modules/.bin/istanbul report',
'echo "See html coverage at: `pwd`/coverage/lcov-report/index.html"'
].join('&&')
}
},
open: {
debug: {
path: 'http://127.0.0.1:8080/debug?port=5858',
app: 'Google Chrome'
},
platoReport: {
path: './plato/index.html',
app: 'Google Chrome'
}
},
plato: {
src: {
options: {
jshint: grunt.file.readJSON('.jshintrc')
},
files: {
'plato': ['lib/**/*.js']
}
}
},
jshint: {
files: ['*.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
jshintrc: true
}
},
});
// Load NPM tasks
require('load-grunt-tasks')(grunt, {
scope: 'devDependencies'
});
grunt.loadNpmTasks('grunt-contrib-jshint');
// Testing tasks
grunt.registerTask('test', ['jshint', 'shell:unit', 'shell:accept']);
grunt.registerTask('unit', ['jshint', 'shell:unit']);
grunt.registerTask('accept', ['env:local', 'shell:accept']);
// Coverate tasks
grunt.registerTask('coverage', ['shell:coverage_unit', 'shell:coverage_accept']);
grunt.registerTask('coverage-unit', ['shell:coverage_unit']);
grunt.registerTask('coverage-accept', ['env:local', 'shell:coverage_accept']);
grunt.registerTask('analysis', ['plato:src', 'open:platoReport']);
grunt.registerTask('serve', ['env:local', 'concurrent:serve']);
grunt.registerTask('debug', ['env:local', 'concurrent:debug']);
grunt.registerTask('default', ['serve']);
};