gittttup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

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();
})
})
}
}