-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
85 lines (69 loc) · 1.78 KB
/
gulpfile.js
File metadata and controls
85 lines (69 loc) · 1.78 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
84
85
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var docco = require('gulp-docco');
var subtree = require('gulp-subtree');
var rimraf = require('gulp-rimraf');
var exec = require('child_process').exec;
var opts = {
mocha: {
reporter: 'spec',
globals: [
'setImmediate',
'clearImmediate'
]
}
};
gulp.task('test', ['test-nonet']);
gulp.task('test-all', ['test-nonet', 'test-net']);
gulp.task('default', ['test', 'watch']);
gulp.task('test-nonet', function () {
return gulp
.src(['test/test-*.js'])
.pipe(mocha(opts.mocha));
});
gulp.task('test-net', function () {
return gulp
.src(['test/net-test-*.js'])
.pipe(mocha(opts.mocha));
});
gulp.task('watch', function () {
var watcher = gulp.watch(['index.js', 'lib/**', 'test/**'], ['test']);
watcher.on('change', function(event) {
console.log('File '+event.path+' was '+event.type+', running tasks...');
});
});
gulp.task('clean-docs', function () {
return gulp
.src('docs/', {read: false})
.pipe(rimraf());
});
gulp.task('make-docs', function () {
return gulp
.src(['index.js', 'lib/*.js'])
.pipe(docco({
layout: 'linear'
}))
.pipe(gulp.dest('./docs'));
});
gulp.task('publish-docs', function () {
return gulp
.src('docs')
.pipe(subtree({
remote: 'github',
message: 'Updating docs'
}))
.pipe(rimraf());
});
gulp.task('docs', ['clean-docs', 'make-docs', 'publish-docs']);
gulp.task('push', function (cb) {
exec('git push github --all; git push github --tags; git push bitbucket --all; git push bitbucket --tags', function (err) {
cb(err);
});
});
gulp.task('npm-publish', function (cb) {
exec('npm publish', function (err) {
cb(err);
});
});
gulp.task('publish', ['docs', 'push', 'npm-publish']);