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 8
/
Gruntfile.js
169 lines (162 loc) · 4.63 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
'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,
DEV:true,
FH_MONGODB_CONN_URL: "mongodb://127.0.0.1/FH_LOCAL",
FH_SERVICE_MAP: function() {
/*
* Define the mappings for your services here - for local development.
* You must provide a mapping for each service you wish to access
* This can be a mapping to a locally running instance of the service (for local development)
* or a remote instance.
*/
var serviceMap = {
'SERVICE_GUID_1': 'http://127.0.0.1:8010',
'SERVICE_GUID_2': 'https://host-and-path-to-service'
};
return JSON.stringify(serviceMap);
}
},
//environement for acceptance tests
accept:{
FH_MONGODB_CONN_URL: "mongodb://127.0.0.1/FH_LOCAL",
FH_SERVICE_MAP: function() {
/*
* Define the mappings for your services here - for local development.
* You must provide a mapping for each service you wish to access
* This can be a mapping to a locally running instance of the service (for local development)
* or a remote instance.
*/
var serviceMap = {
'SERVICE_GUID_1': 'http://127.0.0.1:8010',
'SERVICE_GUID_2': 'https://host-and-path-to-service'
};
return JSON.stringify(serviceMap);
}
}
},
'node-inspector': {
dev: {}
},
shell: {
build:{
options:{
stdout:true
},
command: 'python ./build.py'
},
debug: {
options: {
stdout: true
},
command: 'env NODE_PATH=. node --debug-brk application.js'
},
unit: {
options: {
stdout: true,
stderr: true,
failOnError: true
},
command: 'env NODE_PATH=. ./node_modules/.bin/mocha -A -u exports --recursive test/unit/test*.js'
},
coverage_unit: {
options: {
stdout: true,
stderr: true,
failOnError: true
},
command: [
'rm -rf coverage cov-unit',
'env NODE_PATH=. ./node_modules/.bin/istanbul cover --dir cov-unit ./node_modules/.bin/_mocha -- -u exports --recursive test/unit/test*.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': ['Gruntfile.js', 'libs/**/*.js', 'tests/**/*.js', 'static/client/app/**/*.js']
}
}
},
jshint: {
all: ['Gruntfile.js', 'libs/**/*.js', 'tests/**/*.js', 'static/client/app/**/*.js'],
options: {
jshintrc: true
}
}
});
// Load NPM tasks
require('load-grunt-tasks')(grunt, {
scope: 'devDependencies'
});
//build tasks
grunt.registerTask('build',['shell:build']);
// Testing tasks
grunt.registerTask('test', ['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']);
};