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.pull = (dirPathArg, sourceArg = "", branchArg = "") => {
|
|
|
|
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.pull expects a valid git directory");
|
2016-07-05 01:47:38 +00:00
|
|
|
plugins.beautylog.error(err.message);
|
|
|
|
done.reject(err);
|
2016-07-04 01:49:24 +00:00
|
|
|
return done.promise;
|
2016-07-03 02:03:15 +00:00
|
|
|
}
|
|
|
|
;
|
2016-07-03 22:13:32 +00:00
|
|
|
// if everything is allright proceed
|
2016-11-21 18:34:59 +00:00
|
|
|
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
|
2016-07-03 02:03:15 +00:00
|
|
|
done.resolve(dirPathArg);
|
|
|
|
return done.promise;
|
|
|
|
};
|
2016-11-21 18:34:59 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDhDQUE4QztBQUM5Qyw4Q0FBOEM7QUFFbkMsUUFBQSxJQUFJLEdBQUcsQ0FBQyxVQUFpQixFQUFDLFlBQW1CLEVBQUUsRUFBRSxZQUFtQixFQUFFO0lBQzdFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0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