forked from andresamayadiaz/FrontAccountingSimpleAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
84 lines (74 loc) · 2.14 KB
/
gulpfile.js
File metadata and controls
84 lines (74 loc) · 2.14 KB
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
var gulp = require('gulp');
var gutil = require('gulp-util');
var child_process = require('child_process');
var exec2 = require('child_process').exec;
var async = require('async');
var template = require('lodash.template');
var rename = require("gulp-rename");
var execute = function(command, options, callback) {
if (options == undefined) {
options = {};
}
command = template(command, options);
if (!options.silent) {
gutil.log(gutil.colors.green(command));
}
if (!options.dryRun) {
exec2(command, function(err, stdout, stderr) {
gutil.log(stdout);
gutil.log(gutil.colors.yellow(stderr));
callback(err);
});
} else {
callback(null);
}
};
var paths = {
src: ['**/*.inc', '**/*.php', '!vendor/**'],
testUnit: ['tests/**/*.php']
};
gulp.task('tasks', function(cb) {
var command = 'grep gulp\.task gulpfile.js';
execute(command, null, function(err) {
cb(null); // Swallow the error propagation so that gulp doesn't display a nodejs backtrace.
});
});
gulp.task('default', function() {
// place code for your default task here
});
/*
gulp.task('env-files', function() {
gulp.src('tests/data/*.php')
.pipe(gulp.dest('htdocs/'));
gulp.src('tests/data/lang/*')
.pipe(gulp.dest('htdocs/lang/'));
});
*/
gulp.task('env-db', function(cb) {
execute(
'gunzip -c tests/data/fa_test.sql.gz | mysql -u travis -D fa_test',
null,
cb
);
});
gulp.task('env-test', ['env-db'], function() {});
/* To run the tests you first need to start the php server on port 8000.
* `sh build-startServer.sh`
* then you can run the tests
* `gulp test`
*/
gulp.task('test', ['env-test'], function(cb) {
var command = '';
var withCoverage = false;
if (withCoverage) {
command = '/usr/bin/env php vendor/bin/phpunit --coverage-html ./wiki/code_coverage -c phpunit.xml';
} else {
command = '/usr/bin/env php vendor/bin/phpunit -c phpunit.xml';
}
execute(command, null, function(err) {
cb(null); // Swallow the error propagation so that gulp doesn't display a nodejs backtrace.
});
});
gulp.task('test-watch', function() {
gulp.watch([paths.testUnit, paths.src], ['test']);
});