mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 02:53:29 +00:00
Add base command git:push and git:remote
This commit is contained in:
+23
-1
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user