2016-07-03 02:03:15 +00:00
|
|
|
"use strict";
|
|
|
|
var plugins = require("./smartgit.plugins");
|
|
|
|
var helpers = require("./smartgit.helpers");
|
2016-07-04 02:59:39 +00:00
|
|
|
exports.push = function (dirPathArg, remoteNameArg, remoteBranchArg) {
|
|
|
|
if (remoteNameArg === void 0) { remoteNameArg = ""; }
|
|
|
|
if (remoteBranchArg === void 0) { remoteBranchArg = ""; }
|
2016-07-03 02:03:15 +00:00
|
|
|
var done = plugins.Q.defer();
|
|
|
|
if (!helpers.isGitDirectory(dirPathArg)) {
|
2016-07-05 01:47:38 +00:00
|
|
|
var err = new Error("smartgit.push expects a valid git directory");
|
|
|
|
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-07-04 02:59:39 +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-07-05 01:47:38 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1c2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFFLGFBQXlCLEVBQUUsZUFBMkI7SUFBdEQsNkJBQXlCLEdBQXpCLGtCQUF5QjtJQUFFLCtCQUEyQixHQUEzQixvQkFBMkI7SUFDeEYsSUFBSSxJQUFJLEd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