forked from gulpjs/gulp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
52 lines (44 loc) · 1.5 KB
/
index.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
'use strict';
var util = require('util');
var Orchestrator = require('./lib/orchestrator');
var runSequence = require('./lib/run-sequence');
var vfs = require('@electric-eloquence/vinyl-fs');
var globWatcher = require('./lib/glob-watcher');
function Gulp() {
Orchestrator.call(this);
}
util.inherits(Gulp, Orchestrator);
Gulp.prototype.task = Gulp.prototype.add;
Gulp.prototype.runSeq = null;
Gulp.prototype.runSequence = null; // Keeping because of older documentation.
Gulp.prototype.src = vfs.src;
Gulp.prototype.dest = vfs.dest;
Gulp.prototype.watch = function(glob, opt_, fn_) {
var fn = fn_;
var opt = opt_;
if (typeof opt === 'function' || Array.isArray(opt)) {
fn = opt;
opt = null;
}
// Array of tasks given
if (Array.isArray(fn)) {
return globWatcher(glob, opt, function() {
this.start.apply(this, fn);
}.bind(this));
}
return globWatcher(glob, opt, fn);
};
// Not publicly documenting this because it doesn't signal any sort of
// termination. It fires and forgets tasks asynchronously. Nonetheless,
// it is helpful for running tests and its use should remain internal.
Gulp.prototype.run = function() {
var tasks = arguments.length ? arguments : ['default'];
this.start.apply(this, tasks);
};
// Let people use this class from our instance
Gulp.prototype.Gulp = Gulp;
var inst = new Gulp();
inst.runSeq = runSequence.bind(null, inst);
inst.runSeq.options = runSequence.options;
inst.runSequence = inst.runSeq; // Keeping because of older documentation.
module.exports = inst;