2016-07-03 02:03:15 +00:00
|
|
|
"use strict";
|
2016-11-21 18:34:59 +00:00
|
|
|
const plugins = require("./smartgit.plugins");
|
|
|
|
const helpers = require("./smartgit.helpers");
|
|
|
|
exports.push = (dirPathArg, remoteNameArg = "", remoteBranchArg = "") => {
|
|
|
|
let done = plugins.Q.defer();
|
2016-07-03 02:03:15 +00:00
|
|
|
if (!helpers.isGitDirectory(dirPathArg)) {
|
2016-11-21 18:34:59 +00:00
|
|
|
let err = new Error("smartgit.push expects a valid git directory");
|
2016-07-05 01:47:38 +00:00
|
|
|
plugins.beautylog.error(err.message);
|
|
|
|
done.reject(err);
|
2016-07-03 02:03:15 +00:00
|
|
|
return done.promise;
|
|
|
|
}
|
|
|
|
// if everything seems allright proceed
|
2016-11-21 18:34:59 +00:00
|
|
|
plugins.shelljs.exec(`(cd ${dirPathArg} && git push ${remoteNameArg} ${remoteBranchArg})`);
|
2016-07-03 02:03:15 +00:00
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
|
|
|
};
|
2016-11-21 18:34:59 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1c2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDhDQUE4QztBQUM5Qyw4Q0FBOEM7QUFFbkMsUUFBQSxJQUFJLEdBQUcsQ0FBQyxVQUFpQixFQUFFLGdCQUF1QixFQUFFLEVBQUUsa0JBQXlCLEVBQUU7SUFDeEYsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ3BDLElBQUks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