-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
56 lines (44 loc) · 1.25 KB
/
gulpfile.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 util = require('util');
var gulp = require('gulp');
var shellton = require('shellton');
var gutil = require('gulp-util');
var del = require('del');
var argv = require('yargs')
.array('pattern')
.alias('input', 'i')
.alias('output', 'o')
.alias('type', 't')
.argv;
gulp.task('clean', function() {
return del('coverage');
});
gulp.task('exec', function(done) {
gutil.log('executing:', gutil.colors.magenta(argv.exec));
shellton.spawn(argv.exec, function(err, stdout, stderr) {
if (err) {
gutil.log(err);
}
if (stdout && stdout.trim()) {
gutil.log(stdout.trim());
}
if (stderr && stderr.trim()) {
gutil.log(stderr.trim());
}
done();
});
});
gulp.task('watch', function() {
gutil.log('watching:', gutil.colors.magenta(argv.pattern));
gulp.watch(argv.pattern, ['exec']);
});
gulp.task('watch-report', function() {
argv.pattern = ['lib/**', 'views/**'];
argv.exec = util.format(
'grandma report %s --type %s --out %s',
argv.input || 'file.log',
argv.type || 'html',
argv.output || 'file.html'
);
gulp.start('exec');
gulp.start('watch');
});