forked from 7digital/roadrunner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
64 lines (59 loc) · 1.34 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
var fs = require('fs');
module.exports = function configureTasks(grunt) {
var allFiles = [ '*.js', 'lib/**/*.js', 'test/**/*.js', 'bin/*.js' ];
var sourceFiles = [ 'lib/**/*.js' ];
var testFiles = [ 'test/*.js' ];
grunt.initConfig({
jsvalidate: {
files: allFiles
},
jshint: {
files: allFiles.concat([
'!test/fakes/*.js',
'!test/fixtures/*.js'
]),
options: {
jshintrc: '.jshintrc'
}
},
simplemocha: {
all: {
src: testFiles,
options: {
// simplemocha doesn't appear to ignore leaks regardless
// of the config
globals: [ 'chain', '$', 'config', 'server' ],
ignoreleaks: true,
ui: 'bdd',
reporter: 'spec'
}
}
},
complexity: {
all: {
src: sourceFiles,
options: {
errorsOnly: false,
cyclomatic: 5,
halstead: 15,
maintainability: 100
}
}
},
watch: {
files: allFiles,
tasks: [ 'jshint', 'simplemocha', 'complexity' ]
}
});
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('default', [
'jsvalidate',
'jshint',
'simplemocha',
'complexity'
]);
grunt.registerTask('setupdev', function installGitHooks() {
fs.writeFileSync('.git/hooks/pre-commit', 'grunt');
fs.chmodSync('.git/hooks/pre-commit', '755');
});
};