Skip to content

Commit e46ca04

Browse files
committed
Added missing files
1 parent 47428b7 commit e46ca04

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "rregeer/gulp-php-dev-toolbox",
33
"description": "Php development toolbox using the gulp taskrunner",
4-
"version": "0.4.0",
4+
"version": "0.4.1",
55
"keywords": [
66
"Testing", "PHP", "phpunit", "Unittest", "Codestyle", "CI",
77
"Code complexity", "phpcs", "phpcbf", "phplint", "Gulp", "phpmd",

tasks/structure.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var knownOptions = {
1010
};
1111
var commandLineOptions = minimist(process.argv.slice(2), knownOptions);
1212

13-
gulp.task('structure:duplication', 'Detection for duplicate code. Default scr/ directory is checked.', ['composer:install'], function () {
13+
gulp.task('structure:duplication', 'Detection for duplicate code. Default scr/ directory is checked.', function () {
1414
var source = ['scr/**/*.php'];
1515

1616
if(commandLineOptions.source) {
@@ -32,7 +32,7 @@ gulp.task('structure:duplication', 'Detection for duplicate code. Default scr/ d
3232
}
3333
});
3434

35-
gulp.task('structure:complexity', 'Check the complexity of the code. Default scr/ directory is checked.', ['composer:install'], function() {
35+
gulp.task('structure:complexity', 'Check the complexity of the code. Default scr/ directory is checked.', function() {
3636
var source = 'scr/';
3737

3838
if(commandLineOptions.source) {
@@ -55,4 +55,4 @@ gulp.task('structure:complexity', 'Check the complexity of the code. Default scr
5555

5656
gulp.task('checkstructure', 'Check to code stucture on complexity and duplication.', ['structure:duplication', 'structure:complexity']);
5757

58-
gulp.task('default', ['checkstructure']);
58+
gulp.task('default', ['checkstructure']);

tasks/style.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var knownOptions = {
1313

1414
var commandLineOptions = minimist(process.argv.slice(2), knownOptions);
1515

16-
gulp.task('style:fix', 'Auto fix the php code styling using php code beautifier. Requires a phpcs.xml configuration file.', ['composer:install'], function () {
16+
gulp.task('style:fix', 'Auto fix the php code styling using php code beautifier. Requires a phpcs.xml configuration file.', function () {
1717
if(!fileExists('phpcs.xml')) {
1818
gutil.log(gutil.colors.red('Mandatory file \'phpcs.xml\' does not exists.'));
1919
return;
@@ -27,7 +27,7 @@ gulp.task('style:fix', 'Auto fix the php code styling using php code beautifier.
2727
.on('error', gutil.log);
2828
});
2929

30-
gulp.task('style:codestyle', 'Check the code style using php code sniffer. Requires a phpcs.xml configuration file.', ['composer:install'], function () {
30+
gulp.task('style:codestyle', 'Check the code style using php code sniffer. Requires a phpcs.xml configuration file.', function () {
3131
if(!fileExists('phpcs.xml')) {
3232
gutil.log(gutil.colors.red('Mandatory file \'phpcs.xml\' does not exists.'));
3333
return;
@@ -71,4 +71,4 @@ gulp.task('style:syntax', 'Check the php syntax using php lint. Default scr/, te
7171

7272
gulp.task('checkstyle', 'Check to code on styling and syntax.', ['style:codestyle', 'style:syntax']);
7373

74-
gulp.task('default', ['checkstyle']);
74+
gulp.task('default', ['checkstyle']);

tasks/tests.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@ var knownOptions = {
1414

1515
var commandLineOptions = minimist(process.argv.slice(2), knownOptions);
1616

17-
gulp.task('tests', 'Run the selected unit tests with phpunit. Requires a phpunit.xml.dist configuration file.', ['clear:coverage', 'composer:install'], function() {
17+
gulp.task('tests', 'Run the selected unit tests with phpunit. Requires a phpunit.xml.dist configuration file.', ['clear:coverage'], function() {
1818
var options;
19+
var projectRoot = gulp.task.configuration.projectRoot;
1920

2021
options = {};
2122

23+
gutil.log(gutil.colors.blue('Running task \'tests\' in directoy: ' + projectRoot));
24+
2225
if (commandLineOptions.testsuite || commandLineOptions.s) {
2326
options.testSuite = commandLineOptions.testsuite || commandLineOptions.s;
2427
}
@@ -31,14 +34,19 @@ gulp.task('tests', 'Run the selected unit tests with phpunit. Requires a phpunit
3134
options.filter = commandLineOptions.test || commandLineOptions.t;
3235
}
3336

34-
if(!fileExists('phpunit.xml.dist')) {
37+
if(!fileExists(projectRoot + '/phpunit.xml.dist')) {
3538
gutil.log(gutil.colors.red('Mandatory file \'phpunit.xml.dist\' does not exists.'));
3639
return;
3740
}
3841

39-
return gulp.src('phpunit.xml.dist')
42+
return gulp.src('', {read: false})
43+
.pipe(shell(['cd ' +
44+
['vendor/bin/phpmd ' + source + ' text codesize,unusedcode,naming,design,cleancode,controversial']
45+
]));
46+
47+
return gulp.src(projectRoot + '/phpunit.xml.dist', {cwd: projectRoot})
4048
.pipe(gulpif(options.coverageHtml, gulp.dest('coverage/')))
41-
.pipe(phpunit('./vendor/bin/phpunit', options));
49+
.pipe(phpunit(projectRoot + '/vendor/bin/phpunit', options));
4250
},{
4351
options: {
4452
'test | t': 'Run a single test. Example gulp tests --test [testname]',
@@ -48,7 +56,9 @@ gulp.task('tests', 'Run the selected unit tests with phpunit. Requires a phpunit
4856
});
4957

5058
gulp.task('clear:coverage', 'Clear the coverage reports files.', function() {
51-
return del(['coverage/**']);
59+
var projectRoot = gulp.task.configuration.projectRoot;
60+
61+
return del([projectRoot +'/coverage/**'], {force: true});
5262
});
5363

54-
gulp.task('default', ['tests']);
64+
gulp.task('default', ['tests']);

0 commit comments

Comments
 (0)