-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile_orig.js
executable file
·56 lines (45 loc) · 1.21 KB
/
gulpfile_orig.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
var gulp = require('gulp');
var plugins = require("gulp-load-plugins")({
pattern: ['gulp-*', 'gulp.*'],
replaceString: /\bgulp[\-.]/
});
/* --- File paths --- */
var basePaths = {
root: '_src/',
sass_source: '_src/scss/',
js_source: '_src/js/',
css_dest: 'deploy/html/css/',
js_dest: 'deploy/html/js/'
};
var appFiles = {
php: basePaths.root + '*.php'
};
/* --- gutils --- */
var gutil = require('gulp-util');
var changeEvent = function(evt) {
gutil.log('File', gutil.colors.cyan(evt.path.replace(new RegExp('/.*(?=/' + basePaths.src + ')/'), '')), 'was', gutil.colors.magenta(evt.type));
};
/* --- Composer --- */
gulp.task('composer', function(){
plugins.composer('install');
});
/* --- Php Unit --- */
var exec = require('child_process').exec;
gulp.task('phpunit', function(cb){
exec('./vendor/bin/phpunit', function(err, stdout, stderr){
console.log(stdout);
console.log(stderr);
cb(err);
});
});
gulp.task('watch', function(){
gulp.watch(['./composer.json'], [ 'composer'])
.on('change', function(evt){
changeEvent(evt);
});
gulp.watch([appFiles.php], [ 'phpunit'])
.on('change', function(evt){
changeEvent(evt);
});
});
gulp.task('default', ['composer', 'watch']);