Skip to content

Commit

Permalink
core: remove deprecated gulp-util dependency (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeanroy authored and stephenlacy committed Dec 25, 2017
1 parent d54339b commit 83ff535
Show file tree
Hide file tree
Showing 30 changed files with 70 additions and 67 deletions.
4 changes: 2 additions & 2 deletions lib/add.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand Down Expand Up @@ -29,7 +29,7 @@ module.exports = function (opt) {

exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
files.forEach(that.push.bind(that));
that.emit('end');
cb();
Expand Down
4 changes: 2 additions & 2 deletions lib/addRemote.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -22,7 +22,7 @@ module.exports = function (remote, url, opt, cb) {
var cmd = 'git remote add ' + opt.args + ' ' + escape([remote, url]);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/addSubmodule.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

module.exports = function (url, name, opt, cb) {
Expand All @@ -16,7 +16,7 @@ module.exports = function (url, name, opt, cb) {
var cmd = 'git submodule add ' + opt.args + ' ' + url + ' ' + name;
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err && cb) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
if (cb) cb();
});
};
4 changes: 2 additions & 2 deletions lib/branch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -24,7 +24,7 @@ module.exports = function (branch, opt, cb) {
var cmd = 'git branch ' + opt.args + ' ' + escape([branch]);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb(null, stdout);
});
};
4 changes: 2 additions & 2 deletions lib/catFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

var through = require('through2');
var gutil = require('gulp-util');
var PluginError = require('plugin-error');
var spawn = require('child_process').spawn;
var stripBom = require('strip-bom-stream');

Expand Down Expand Up @@ -91,7 +91,7 @@ module.exports = function (opt) {
var that = this;

readStream(catFile.stderr, function(error) {
that.emit('error', new gutil.PluginError('gulp-git', 'Command failed: ' + catFile.spawnargs.join(' ').trim() + '\n' + error.toString()));
that.emit('error', new PluginError('gulp-git', 'Command failed: ' + catFile.spawnargs.join(' ').trim() + '\n' + error.toString()));
});

if (opt.stripBOM) {
Expand Down
4 changes: 2 additions & 2 deletions lib/checkout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -21,7 +21,7 @@ module.exports = function (branch, opt, cb) {
var cmd = 'git checkout ' + opt.args + ' ' + escape([branch]);
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb(null);
});
};
4 changes: 2 additions & 2 deletions lib/checkoutFiles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -18,7 +18,7 @@ module.exports = function (opt) {

exec(cmd, {cwd: file.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
that.push(file);
cb(null);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/clean.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand Down Expand Up @@ -34,7 +34,7 @@ module.exports = function (paths, opt, cb) {
if (err)
return cb(err);
if (!opt.quiet)
gutil.log(stdout, stderr);
log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/clone.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -20,7 +20,7 @@ module.exports = function (remote, opt, cb) {
var cmd = 'git clone ' + escape([remote]) + ' ' + opt.args;
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/commit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');
var path = require('path');
Expand Down Expand Up @@ -84,7 +84,7 @@ module.exports = function(message, opt) {

var execChildProcess = exec(cmd, opt, function(err, stdout, stderr) {
if (err && (String(stdout).indexOf('no changes added to commit') === 0)) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
files.forEach(self.push.bind(self));
self.emit('end');
return cb();
Expand Down
4 changes: 2 additions & 2 deletions lib/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var Vinyl = require('vinyl');
var through = require('through2');
var gutil = require('gulp-util');
var log = require('fancy-log');
var path = require('path');
var exec = require('child_process').exec;
var catFile = require('./catFile');
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = function (compare, opt) {
var files = getReaslt(stdout);

if (opt.log) {
gutil.log('git diff --name-status ' + cmd + '\n' + files.map(function(diff) {
log('git diff --name-status ' + cmd + '\n' + files.map(function(diff) {
return diff.status + '\t' + diff.dstPath;
}).join('\n'));
}
Expand Down
6 changes: 3 additions & 3 deletions lib/exec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

module.exports = function (opt, cb) {
Expand All @@ -20,9 +20,9 @@ module.exports = function (opt, cb) {
var cmd = 'git ' + opt.args;
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err, stderr);
if (opt.log && !opt.quiet) gutil.log(cmd + '\n' + stdout, stderr);
if (opt.log && !opt.quiet) log(cmd + '\n' + stdout, stderr);
else {
if (!opt.quiet) gutil.log(cmd + ' (log : false)', stderr);
if (!opt.quiet) log(cmd + ' (log : false)', stderr);
}
cb(err, stdout);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/fetch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand Down Expand Up @@ -29,7 +29,7 @@ module.exports = function (remote, branch, opt, cb) {
cmd += escape(args);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

module.exports = function (opt, cb) {
Expand All @@ -19,7 +19,7 @@ module.exports = function (opt, cb) {
var cmd = 'git init ' + opt.args;
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});

Expand Down
4 changes: 2 additions & 2 deletions lib/merge.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -21,7 +21,7 @@ module.exports = function (branch, opt, cb) {
var cmd = 'git merge ' + opt.args + ' ' + escape([branch]);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/pull.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand Down Expand Up @@ -31,7 +31,7 @@ module.exports = function (remote, branch, opt, cb) {

return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/push.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');
var revParse = require('./revParse');
Expand Down Expand Up @@ -49,7 +49,7 @@ module.exports = function (remote, branch, opt, cb) {
maxBuffer: maxBuffer
}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
}
Expand Down
4 changes: 2 additions & 2 deletions lib/removeRemote.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -25,7 +25,7 @@ module.exports = function (remote, opt, cb) {
var cmd = 'git remote remove ' + opt.args + ' ' + escape([remote]);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});
};
4 changes: 2 additions & 2 deletions lib/reset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -21,7 +21,7 @@ module.exports = function (commit, opt, cb) {
var cmd = 'git reset ' + opt.args + ' ' + escape([commit]);
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb();
});

Expand Down
4 changes: 2 additions & 2 deletions lib/revParse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

/*
Expand Down Expand Up @@ -29,7 +29,7 @@ module.exports = function (opt, cb) {
return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (stdout) stdout = stdout.trim(); // Trim trailing cr-lf
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb(err, stdout); // return stdout to the user
});
};
4 changes: 2 additions & 2 deletions lib/rm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var through = require('through2');
var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');

Expand All @@ -28,7 +28,7 @@ module.exports = function (opt) {
var that = this;
exec(cmd, {cwd: cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
files.forEach(that.push.bind(that));
cb();
});
Expand Down
4 changes: 2 additions & 2 deletions lib/stash.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

module.exports = function(opt, cb) {
Expand All @@ -21,7 +21,7 @@ module.exports = function(opt, cb) {
var cmd = 'git stash ' + opt.args;
exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err);
if (!opt.quiet) gutil.log(stdout, stderr);
if (!opt.quiet) log(stdout, stderr);
cb(null);
});

Expand Down
4 changes: 2 additions & 2 deletions lib/status.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gutil = require('gulp-util');
var log = require('fancy-log');
var exec = require('child_process').exec;

module.exports = function (opt, cb) {
Expand All @@ -18,7 +18,7 @@ module.exports = function (opt, cb) {
var cmd = 'git status ' + opt.args;
return exec(cmd, {cwd : opt.cwd, maxBuffer: opt.maxBuffer}, function(err, stdout, stderr) {
if (err) return cb(err, stderr);
if (!opt.quiet) gutil.log(cmd + '\n' + stdout, stderr);
if (!opt.quiet) log(cmd + '\n' + stdout, stderr);
if (cb) cb(err, stdout);
});
};
Loading

0 comments on commit 83ff535

Please sign in to comment.