64 lines
1.9 KiB
64 lines
1.9 KiB
const exec = require('child_process').exec;
|
|
module.exports = {
|
|
all(msg, origin, banch) {
|
|
return new Promise((resolve, reject) => {
|
|
console.log('git add .');
|
|
exec('git add .', function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
console.log("git commit -m '" + msg + "'");
|
|
exec("git commit -m '" + msg + "'", function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
console.log(banch ? "git push " + origin + " " + banch : "git push " + origin);
|
|
exec(banch ? "git push " + origin + " " + banch : "git push " + origin, function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
resolve();
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
commit(msg, origin, banch) {
|
|
console.log("git commit -m '" + msg + "'");
|
|
exec("git commit -m '" + msg + "'", function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
console.log(banch ? "git push " + origin + " " + banch : "git push " + origin);
|
|
exec(banch ? "git push " + origin + " " + banch : "git push " + origin, function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
resolve();
|
|
})
|
|
})
|
|
},
|
|
push(origin, banch) {
|
|
return new Promise((resolve, reject) => {
|
|
console.log(banch ? "git push " + origin + " " + banch : "git push " + origin);
|
|
exec(banch ? "git push " + origin + " " + banch : "git push " + origin, function (error, stdout, stderr) {
|
|
if (error) {
|
|
reject(error);
|
|
console.log(error);
|
|
return;
|
|
}
|
|
resolve();
|
|
})
|
|
})
|
|
}
|
|
}
|