updateSubmodule.js 572 B

1234567891011121314151617181920
  1. 'use strict';
  2. var log = require('fancy-log');
  3. var exec = require('child_process').exec;
  4. module.exports = function(opt, cb) {
  5. if (!cb || typeof cb !== 'function') cb = function () {};
  6. if (!opt) opt = {};
  7. if (!opt.cwd) opt.cwd = process.cwd();
  8. if (!opt.args) opt.args = ' ';
  9. var maxBuffer = opt.maxBuffer || 200 * 1024;
  10. var cmd = 'git submodule update ' + opt.args;
  11. return exec(cmd, {cwd: opt.cwd, maxBuffer: maxBuffer}, function(err, stdout, stderr) {
  12. if (err && cb) return cb(err);
  13. if (!opt.quiet) log(stdout, stderr);
  14. if (cb) cb();
  15. });
  16. };