forked from Scheming-Lion/Scheming-Lion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
109 lines (92 loc) · 2.64 KB
/
Copy pathGruntfile.js
File metadata and controls
109 lines (92 loc) · 2.64 KB
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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
nodemon: {
dev: {
script: 'app.js'
}
},
karma: {
all: {
configFile: 'karma.conf.js'
}
},
jshint: {
files: [
'client/**/*.js',
'client/*.js',
],
options: {
force: 'false',
jshintrc: '.jshintrc',
ignores: [
'client/lib/**/*.js',
]
}
},
shell: {
options: {
},
target: {
command: ['cd testing', 'cd reports', 'open specRunner.html', 'cd coverage', 'open index.html'].join('&&')
}
},
watch: {
scripts: {
files: [
'server/*.js',
'server/**/*.js',
'client/*.html',
],
tasks: ['karma']
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('server-dev', function (target) {
// Running nodejs in a different process and displaying output on the main console
var nodemon = grunt.util.spawn({
cmd: 'grunt',
grunt: true,
args: 'nodemon'
});
nodemon.stdout.pipe(process.stdout);
nodemon.stderr.pipe(process.stderr);
grunt.task.run([ 'watch' ]);
});
////////////////////////////////////////////////////
// Forcing so karma will run/report even if a test fails
///////////////////////////////////////////////////
grunt.registerTask('forceOn', 'turns the --force option ON',
function() {
if ( !grunt.option( 'force' ) ) {
grunt.config.set('forceStatus', true);
grunt.option( 'force', true );
}
});
grunt.registerTask('forceOff', 'turns the --force option Off',
function() {
if ( grunt.config.get('forceStatus') ) {
grunt.option( 'force', false );
}
});
////////////////////////////////////////////////////
// Main grunt tasks
////////////////////////////////////////////////////
grunt.registerTask('test', ['forceOn','karma', 'forceOff', "shell"] );
// build is automatically run by Azure in deployment.
// Build will fail if linting or karma fails.
grunt.registerTask('build', ['jshint', 'karma'] );
// grunt deploy is for testing local deployment only,
// because Azure is listening to
// GitHub for merges as a means of continous integration.
grunt.registerTask('deploy', function(n) {
grunt.task.run(['build']);
grunt.task.run(['shell']);
grunt.task.run(['server-dev']);
});
};