/
gruntfile.js
145 lines (141 loc) · 3.41 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
'use strict';
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-csscomb');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-githooks');
// grunt.loadNpmTasks('grunt-karma');
// grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-shell');
grunt.loadTasks('grunt');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jscs: {
options: {
config: '.jscsrc',
reporter: 'checkstyle'
},
src: [
'GruntFile.js',
'src/**/*.js',
'!src/public/lib/**',
'!src/public/css/**',
'!src/public/js/**',
'!src/stylus/**'
] },
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: 'checkstyle'
},
src: [
'GruntFile.js',
'src/**/*.js',
'!src/public/lib/**',
'!src/public/js/**',
'!src/stylus/**',
'!src/public/css/**'
]
},
githooks: {
all: {
options: {
endMarker: ''
},
'pre-commit': 'analyze',
'post-checkout': 'shell:gitlog',
'post-commit': 'shell:gitlog',
'post-merge': 'shell:gitlog shell:npminstall'
}
},
shell: {
gitlog: {
command: 'git log -1 > git-info.txt'
},
npminstall: {
command: 'npm install'
},
logClean: {
command: 'rm -f logs/*.log'
},
cpcss: {
command: 'cp src/stylus/museo.css src/public/css'
}
},
mochaTest: {
all: {
options: {
reporter: 'spec'
},
src: ['test/**/*Test.js', '!test/public/js/**/*Test.js']
}
},
karma: {
client: {
configFile: 'karma.conf.js'
}
},
stylus: {
compile: {
options: {
compress: false,
paths: ['src/stylus']
},
files: {
'src/stylus/museo.css': 'src/stylus/museo.styl'
}
}
},
bower: {
install: {
options: {
targetDir: 'src/public/lib',
layout: 'byType',
install: true,
verbose: false,
cleanTargetDir: false,
cleanBowerDir: true,
bowerOptions: { forceLatest:true }
}
}
},
csscomb: {
museo: {
files: {
'src/stylus/museo.css': ['src/public/css/museo.css'],
}
}
},
csslint: {
options: {
force: true,
absoluteFilePathsForFormatters: true,
formatters: [
{id: 'compact', dest: 'quality/report/css/compact.xml'}
]
},
strict:{
options:{
force: true,
import:2,
"box-model":false,
},
src:['src/public/css/*.css'],
},
lax: {
options: {
import: false
},
src: ['src/public/css/museo.css']
}
}
});
grunt.registerTask('default', ['analyze']);
grunt.registerTask('bower', ['bower']);
grunt.registerTask('css', ['stylus', 'shell:cpcss', 'csscomb', 'csslint']);
grunt.registerTask('test', 'Runs unit tests', ['mochaTest', 'karma:client']);
grunt.registerTask('analyze', 'Validate code style', ['jshint', 'jscs']);
};