This repository has been archived by the owner on Apr 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
73 lines (67 loc) · 2.01 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
phplint: {
all: [
'config/**/*.php{,.dist}',
'src/**/*.{php,phtml}',
'tests/**/*.{php,phtml}'
]
},
phpcs: {
all: {
src: [
'config/',
'src/',
'tests/'
]
},
options: {
// hack: args not directly supported by grunt-phpcs can be added in the bin path
bin: 'vendor/bin/phpcs -p --extensions=dist,php,phtml',
standard: 'PSR2',
encoding: 'utf-8',
verbose: false
}
},
phpunit: {
Module: {
configuration: 'phpunit.xml.dist'
},
options: {
bin: 'vendor/bin/phpunit'
}
},
mkdir: {
build: {
options: {
create: [
'build/logs'
]
}
}
}
});
// Plugin loading
grunt.loadNpmTasks('grunt-mkdir');
grunt.loadNpmTasks('grunt-phpcs');
grunt.loadNpmTasks("grunt-phplint");
grunt.loadNpmTasks('grunt-phpunit');
// Task registration
grunt.registerTask('default', ['test']);
grunt.registerTask('test', function (env) {
if (env === 'ci') {
// In CI, we want to collect coverage reports
grunt.task.run(['mkdir:build']);
var phpunitConfig = grunt.config.get('phpunit');
for (var property in phpunitConfig) {
if (property === 'options') {
continue;
}
phpunitConfig[property].coverageClover = 'build/logs/clover.xml';
}
grunt.config.set('phpunit', phpunitConfig)
}
grunt.task.run(['phplint', 'phpcs', 'phpunit']);
});
};