1 | 'use strict';
|
2 |
|
3 | var util = require('util');
|
4 | var Orchestrator = require('orchestrator');
|
5 | var gutil = require('gulp-util');
|
6 | var deprecated = require('deprecated');
|
7 | var vfs = require('vinyl-fs');
|
8 |
|
9 | function Gulp() {
|
10 | Orchestrator.call(this);
|
11 | }
|
12 | util.inherits(Gulp, Orchestrator);
|
13 |
|
14 | Gulp.prototype.task = Gulp.prototype.add;
|
15 | Gulp.prototype.run = function() {
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | var tasks = arguments.length ? arguments : ['default'];
|
21 |
|
22 | this.start.apply(this, tasks);
|
23 | };
|
24 |
|
25 | Gulp.prototype.src = vfs.src;
|
26 | Gulp.prototype.dest = vfs.dest;
|
27 | Gulp.prototype.watch = function(glob, opt, fn) {
|
28 | if (typeof opt === 'function' || Array.isArray(opt)) {
|
29 | fn = opt;
|
30 | opt = null;
|
31 | }
|
32 |
|
33 |
|
34 | if (Array.isArray(fn)) {
|
35 | return vfs.watch(glob, opt, function() {
|
36 | this.start.apply(this, fn);
|
37 | }.bind(this));
|
38 | }
|
39 |
|
40 | return vfs.watch(glob, opt, fn);
|
41 | };
|
42 |
|
43 |
|
44 | Gulp.prototype.Gulp = Gulp;
|
45 |
|
46 |
|
47 | deprecated.field('gulp.env has been deprecated. ' +
|
48 | 'Use your own CLI parser instead. ' +
|
49 | 'We recommend using yargs or minimist.',
|
50 | console.warn,
|
51 | Gulp.prototype,
|
52 | 'env',
|
53 | gutil.env
|
54 | );
|
55 |
|
56 | Gulp.prototype.run = deprecated.method('gulp.run() has been deprecated. ' +
|
57 | 'Use task dependencies or gulp.watch task triggering instead.',
|
58 | console.warn,
|
59 | Gulp.prototype.run
|
60 | );
|
61 |
|
62 | var inst = new Gulp();
|
63 | module.exports = inst;
|