smartgit/ts/smartgit.pull.ts

15 lines
585 B
TypeScript
Raw Normal View History

2016-07-03 02:03:15 +00:00
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
2016-07-03 02:37:03 +00:00
2016-07-03 02:03:15 +00:00
export let pull = (dirPathArg:string,sourceArg:string = "", branchArg:string = "") => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.pull expects a valid git directory");
done.reject();
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-07-03 02:03:15 +00:00
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
done.resolve(dirPathArg);
return done.promise;
};