This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Gruntfile.js
125 lines (118 loc) · 2.96 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
'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/'
},
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/_mocha -- -u exports -R spec ./test/unit/*.js'
].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'});
// Testing tasks
grunt.registerTask('test', ['jshint', 'shell:unit']);
// Coverate tasks
grunt.registerTask('coverage', ['shell:coverage_unit']);
// Making grunt default to force in order not to break the project.
grunt.option('force', true);
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']);
};