simple-git
Advanced tools
Comparing version 1.16.0 to 1.17.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.16.0", | ||
"version": "1.17.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -73,2 +73,6 @@ # Simple Git | ||
`.submoduleAdd(repo, path[, handlerFn])` adds a new sub module | ||
`.submoduleUpdate([args, ][handlerFn])` updates sub modules, args should be an array of string arguments to pass to the `git submodule update` command. | ||
`.rm([fileA, ...], handlerFn)` removes any number of files from source control | ||
@@ -75,0 +79,0 @@ |
@@ -337,2 +337,43 @@ (function () { | ||
/** | ||
* Update submodules | ||
* | ||
* @param {string[]} [args] | ||
* @param {Function} [then] | ||
*/ | ||
Git.prototype.submoduleUpdate = function (args, then) { | ||
if (typeof args === 'string') { | ||
this._getLog('warn', 'Git#submoduleUpdate: args should be supplied as an array of individual arguments'); | ||
} | ||
var next = Git.trailingFunctionArgument(arguments); | ||
var command = (args !== next) ? args : []; | ||
return this.subModule(['update'].concat(command), function (err, args) { | ||
next && next(err, args); | ||
}); | ||
}; | ||
/** | ||
* Call any `git submodule` function with arguments passed as an array of strings. | ||
* | ||
* @param {string[]} options | ||
* @param {Function} [then] | ||
*/ | ||
Git.prototype.subModule = function (options, then) { | ||
if (!Array.isArray(options)) { | ||
return this.then(function () { | ||
then && then(new TypeError("Git.subModule requires an array of arguments")); | ||
}); | ||
} | ||
if (options[0] !== 'submodule') { | ||
options.unshift('submodule'); | ||
} | ||
return this._run(options, function (err, data) { | ||
then && then(err || null, err ? null : data); | ||
}); | ||
}; | ||
/** | ||
* List remote | ||
@@ -339,0 +380,0 @@ * |
@@ -461,2 +461,42 @@ | ||
exports.subModule = { | ||
setUp: function (done) { | ||
Instance(); | ||
done(); | ||
}, | ||
'update with no args': function (test) { | ||
git.submoduleUpdate(function (err, result) { | ||
test.equals(null, err, 'not an error'); | ||
test.equals('', result, 'passes through the result'); | ||
test.same(["submodule", "update"], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
}, | ||
'update with string arg': function (test) { | ||
git.submoduleUpdate('foo', function (err, result) { | ||
test.equals(null, err, 'not an error'); | ||
test.equals('', result, 'passes through the result'); | ||
test.same(["submodule", "update", "foo"], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
}, | ||
'update with array arg': function (test) { | ||
git.submoduleUpdate(['foo', 'bar'], function (err, result) { | ||
test.equals(null, err, 'not an error'); | ||
test.equals('', result, 'passes through the result'); | ||
test.same(["submodule", "update", "foo", "bar"], theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
} | ||
}; | ||
exports.tag = { | ||
@@ -463,0 +503,0 @@ setUp: function (done) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54357
1298
175