forked from abricos/smtpeshka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
75 lines (64 loc) · 1.68 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
72
73
74
75
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var cover = require('gulp-coverage');
var jsdoc = require('gulp-jsdoc');
var subtree = require('gulp-subtree');
var del = require('del');
var vinylPaths = require('vinyl-paths');
var opts = {
mocha: {
reporter: 'spec',
globals: [
'setImmediate',
'clearImmediate'
]
}
};
gulp.task('test', function(){
return gulp
.src(['test/*.js'])
.pipe(mocha(opts.mocha));
});
gulp.task('watch', function(){
var watcher = gulp.watch(['lib/**', 'test/**'], ['test']);
watcher.on('change', function(event){
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
function coverage(tests, output){
return gulp
.src(tests, {read: false})
.pipe(cover.instrument({
pattern: ['index.js', 'lib/**.js'],
debugDirectory: 'debug'
}))
.pipe(mocha(opts.mocha))
.pipe(cover.report({
outFile: output
}));
}
gulp.task('coverage', function(){
return coverage(['test/*.js'], 'test/coverage.html');
});
gulp.task('clean-docs', function(){
return gulp.src(['docs/'])
.pipe(vinylPaths(del));
});
gulp.task('make-docs', function(){
return gulp.src(['index.js', 'lib/**/*.js', 'README.md'])
.pipe(jsdoc('./docs'));
});
/*
gulp.task('publish-docs', function(){
return gulp
.src('docs')
.pipe(subtree({
remote: 'origin',
branch: 'master',
message: 'Updating docs'
}));
});
/**/
gulp.task('docs', ['clean-docs', 'make-docs']);
gulp.task('default', ['test', 'watch']);