@@ -4,22 +4,22 @@ module.exports = function(grunt) {
4
4
5
5
grunt . initConfig (
6
6
{
7
-
7
+
8
8
/**
9
9
* Reads the 'package.json' file and puts it content into a 'pkg' Javascript object.
10
10
*/
11
11
pkg : grunt . file . readJSON ( 'package.json' ) ,
12
-
12
+
13
13
/**
14
14
* Clean task.
15
15
*/
16
16
clean : [ 'build' ] ,
17
-
17
+
18
18
/**
19
19
* Copy task.
20
20
*/
21
21
copy : {
22
-
22
+
23
23
/**
24
24
* Copy test resource files to the build.
25
25
*/
@@ -33,20 +33,20 @@ module.exports = function(grunt) {
33
33
}
34
34
]
35
35
}
36
-
36
+
37
37
} , /* Copy task */
38
38
39
39
/**
40
40
* PHPUnit Task.
41
41
*/
42
42
phpunit : {
43
-
43
+
44
44
classes : {
45
45
dir : 'src/test/php'
46
- } ,
47
-
46
+ } ,
47
+
48
48
options : {
49
- bin : 'vendor/bin/phpunit' ,
49
+ bin : 'vendor/bin/phpunit' ,
50
50
configuration : 'phpunit.xml.dist' ,
51
51
//group : 'CURLClientTest'
52
52
}
@@ -57,34 +57,34 @@ module.exports = function(grunt) {
57
57
* Shell Task
58
58
*/
59
59
shell : {
60
-
60
+
61
61
pdepend : {
62
62
command : function ( ) {
63
-
63
+
64
64
var command = 'php vendor/pdepend/pdepend/src/bin/pdepend' ;
65
65
command += ' --jdepend-chart=build/reports/pdepend/jdepend-chart.svg' ;
66
66
command += ' --jdepend-xml=build/reports/pdepend/jdepend.xml' ;
67
67
command += ' --overview-pyramid=build/reports/pdepend/overview-pyramid.svg' ;
68
68
command += ' --summary-xml=build/reports/pdepend/summary.xml' ;
69
69
command += ' src/main/php' ;
70
-
70
+
71
71
return command ;
72
72
73
73
}
74
74
} ,
75
-
75
+
76
76
phpcs : {
77
77
command : function ( ) {
78
-
79
- var command = 'php ./vendor/squizlabs/php_codesniffer/bin/phpcs' ;
78
+
79
+ var command = 'php ./vendor/squizlabs/php_codesniffer/bin/phpcs' ;
80
80
command += ' --cache' ;
81
81
command += ' --filter=GitModified' ;
82
82
command += ' --parallel=16' ; // Requires PHP to be compiled with PCNTL package
83
83
command += ' --standard=PSR2' ;
84
84
command += ' -v' ;
85
-
85
+
86
86
if ( grunt . option ( 'checkstyle' ) === true ) {
87
-
87
+
88
88
command += ' --report=checkstyle' ;
89
89
command += ' --report-file=target/reports/phpcs/phpcs.xml' ;
90
90
}
@@ -93,13 +93,13 @@ module.exports = function(grunt) {
93
93
command += ' src/test/php/Gomoob' ;
94
94
95
95
return command ;
96
-
96
+
97
97
}
98
98
} ,
99
-
99
+
100
100
phpcbf : {
101
101
command : function ( ) {
102
-
102
+
103
103
var command = 'php ./vendor/squizlabs/php_codesniffer/scripts/phpcbf' ;
104
104
var command = 'php ./vendor/squizlabs/php_codesniffer/bin/phpcbf' ;
105
105
command += ' --cache' ;
@@ -108,37 +108,37 @@ module.exports = function(grunt) {
108
108
command += ' --standard=PSR2' ;
109
109
command += ' src/main/php' ;
110
110
command += ' src/test/php' ;
111
-
111
+
112
112
return command ;
113
-
113
+
114
114
}
115
115
} ,
116
-
116
+
117
117
phpcpd : {
118
118
command : function ( ) {
119
-
119
+
120
120
return 'php vendor/sebastian/phpcpd/phpcpd src/main/php' ;
121
121
122
122
}
123
123
} ,
124
-
124
+
125
125
phpdocumentor : {
126
126
command : function ( ) {
127
127
return 'php vendor/phpdocumentor/phpdocumentor/bin/phpdoc.php --target=build/reports/phpdocumentor --directory=src/main/php' ;
128
128
}
129
129
} ,
130
-
130
+
131
131
phploc : {
132
132
command : function ( ) {
133
-
133
+
134
134
return 'php vendor/phploc/phploc/phploc src/main/php' ;
135
-
135
+
136
136
}
137
137
} ,
138
-
138
+
139
139
phpmd : {
140
140
command : function ( ) {
141
-
141
+
142
142
var command = 'php vendor/phpmd/phpmd/src/bin/phpmd ' ;
143
143
command += 'src/main/php ' ;
144
144
command += 'html ' ;
@@ -152,13 +152,13 @@ module.exports = function(grunt) {
152
152
callback : function ( err , stdout , stderr , cb ) {
153
153
grunt . file . write ( 'build/reports/phpmd/phpmd.html' , stdout ) ;
154
154
cb ( ) ;
155
-
155
+
156
156
}
157
157
}
158
158
}
159
-
159
+
160
160
} /* Shell Task */
161
-
161
+
162
162
}
163
163
164
164
) ; /* Grunt initConfig call */
@@ -189,13 +189,13 @@ module.exports = function(grunt) {
189
189
* Task used to create directories needed by PHP_CodeSniffer to generate its report.
190
190
*/
191
191
grunt . registerTask ( 'before-phpcs' , 'Creating directories required by PHP Code Sniffer...' , function ( ) {
192
-
192
+
193
193
if ( grunt . option ( 'checkstyle' ) === true ) {
194
194
195
195
if ( ! fs . existsSync ( 'build' ) ) {
196
196
fs . mkdirSync ( 'build' ) ;
197
197
}
198
-
198
+
199
199
if ( ! fs . existsSync ( 'build/reports' ) ) {
200
200
fs . mkdirSync ( 'build/reports' ) ;
201
201
}
@@ -205,14 +205,14 @@ module.exports = function(grunt) {
205
205
}
206
206
207
207
}
208
-
208
+
209
209
} ) ;
210
-
210
+
211
211
/**
212
212
* Task used to create directories needed by PHPMD to generate its report.
213
213
*/
214
214
grunt . registerTask ( 'before-phpmd' , 'Creating directories required by PHP Mess Detector...' , function ( ) {
215
-
215
+
216
216
if ( ! fs . existsSync ( 'build' ) ) {
217
217
fs . mkdirSync ( 'build' ) ;
218
218
}
@@ -224,39 +224,39 @@ module.exports = function(grunt) {
224
224
if ( ! fs . existsSync ( 'build/reports/phpmd' ) ) {
225
225
fs . mkdirSync ( 'build/reports/phpmd' ) ;
226
226
}
227
-
227
+
228
228
} ) ;
229
229
230
230
/**
231
231
* Task used to generate a PDepend report.
232
232
*/
233
233
grunt . registerTask ( 'pdepend' , [ 'before-pdepend' , 'shell:pdepend' ] ) ;
234
-
234
+
235
235
/**
236
236
* Task used to automatically fix PHP_CodeSniffer errors.
237
237
*/
238
238
grunt . registerTask ( 'phpcbf' , [ 'shell:phpcbf' ] ) ;
239
-
239
+
240
240
/**
241
241
* Task used to check the code using PHP_CodeSniffer.
242
242
*/
243
243
grunt . registerTask ( 'phpcs' , [ 'before-phpcs' , 'shell:phpcs' ] ) ;
244
-
244
+
245
245
/**
246
246
* Task used to generate a PHPMD report.
247
247
*/
248
248
grunt . registerTask ( 'phpmd' , [ 'before-phpmd' , 'shell:phpmd' ] ) ;
249
-
249
+
250
250
/**
251
251
* Task used to create the project documentation.
252
252
*/
253
253
grunt . registerTask ( 'generate-documentation' , [ 'pdepend' , 'phpcs' , 'phpmd' , 'shell:phpdocumentor' ] ) ;
254
-
254
+
255
255
/**
256
256
* Task used to execute the project tests.
257
257
*/
258
258
grunt . registerTask ( 'test' , [ 'copy:test-resources' , 'phpunit' ] ) ;
259
-
259
+
260
260
/**
261
261
* Default task, this task executes the following actions :
262
262
* - Clean the previous build folder
0 commit comments