forked from vinsonizer/f3-automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·71 lines (60 loc) · 1.65 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var shell = require('gulp-shell');
var mocha = require('gulp-mocha');
var watch = require('gulp-watch');
var cover = require('gulp-coverage');
var jshint = require('gulp-jshint');
var cleanDest = require('gulp-clean-dest');
var gulp = require('gulp');
var srcRoot = './src/';
var cfgRoot = './cfg/';
var tstRoot = './test/';
var buildDir = './build/';
gulp.task('lint', function() {
return gulp.src([
srcRoot + '*.js',
cfgRoot + '*.js'
])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
//.pipe(jshint.reporter('fail')); //there is an issue with this reporter: skipping
});
gulp.task('build', function() {
return gulp.src([
srcRoot + '*.js',
cfgRoot + '*.js'
])
.pipe(gulp.dest(buildDir));
});
gulp.task('test', function() {
return gulp.src(tstRoot + '*.js', {
read: false
})
.pipe(cover.instrument({
pattern: [srcRoot + '*.js'],
debugDirectory: 'debug'
}))
.pipe(mocha())
.pipe(cover.gather())
.pipe(cover.format())
.pipe(gulp.dest('reports'));
});
gulp.task('upload',
shell.task(['gapps upload'], {
cwd: '.'
}));
gulp.task('cleanup', function() {
return cleanDest(buildDir);
});
gulp.task('watch', function() {
return gulp.src([srcRoot + '*.js', cfgRoot + '*.js'])
.pipe(watch([srcRoot + '*.js', cfgRoot + '*.js']))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(cleanDest(buildDir))
.pipe(gulp.dest(buildDir))
.pipe(gulp.task('upload'));
});
gulp.task('default', ['cleanup', 'lint', 'build', 'test', 'upload']);
gulp.task('watch', function() {
gulp.watch(['src/*.js', 'test/*.js'], ['cleanup', 'lint', 'build', 'test']);
});