-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathGruntfile.js
executable file
·63 lines (59 loc) · 1.6 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
options: {
stdout: true,
stderr: true
},
mongoimport: {
command: [
'mongo USCrime --eval "db.crimes.drop()"',
'mongo USCrime --eval "db.allCrimes.drop()"',
'mongoimport --db USCrime --collection crimes --type csv --headerline --file ./server/data/test.csv',
'mongoimport --db USCrime --collection allCrimes --type csv --headerline --file ./server/data/fulldata.csv'
].join('&&')
}
},
nodemon: {
dev: {
script: './server/bin/www'
}
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['./server/test/*.js']
}
},
execute: {
target: {
src: ['./server/database/summarize.js']
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-execute');
////////////////////////////////////////////////////
// Main grunt tasks
////////////////////////////////////////////////////
// Imports test.csv into your mongo database
grunt.registerTask('import', function(n) {
grunt.task.run(['shell:mongoimport']);
});
// Starts server
grunt.registerTask('default', function(n) {
grunt.task.run(['nodemon']);
});
// Runs tests
grunt.registerTask('servertest', function(n) {
grunt.task.run(['mochaTest']);
});
grunt.registerTask('summarize', function(n) {
grunt.task.run(['execute']);
});
};