Add base command git:push and git:remote

This commit is contained in:
Samy Pessé
2014-07-12 09:23:15 +02:00
parent a9f473260c
commit f05b138fd6
3 changed files with 93 additions and 1 deletions
+23 -1
View File
@@ -1,6 +1,7 @@
var Q = require('q');
var _ = require('lodash');
var exec = require('child_process').exec;
var http = require('http');
var send = require('send');
@@ -36,9 +37,30 @@ function logError(err) {
return Q.reject(err);
};
function runGitCommand(command, args) {
var d = Q.defer(), child;
args = ["git", command].concat(args).join(" ");
child = exec(args, function (error, stdout, stderr) {
if (error !== null) {
error.stdout = stdout;
error.stderr = stderr;
d.reject(error);
} else {
d.resolve({
stdout: stdout,
stderr: stderr
})
}
});
return d.promise;
};
// Exports
module.exports = {
watch: watch,
logError: logError
logError: logError,
gitCmd: runGitCommand
};