2016-07-03 02:03:15 +00:00
|
|
|
import * as plugins from "./smartgit.plugins";
|
|
|
|
import * as helpers from "./smartgit.helpers";
|
2016-03-30 23:59:45 +00:00
|
|
|
|
2016-07-03 02:03:15 +00:00
|
|
|
export let commit = (dirPathArg:string,commitMessage:string) => {
|
2016-07-02 00:22:03 +00:00
|
|
|
let done = plugins.Q.defer();
|
2016-07-03 02:37:03 +00:00
|
|
|
if(!helpers.isGitDirectory(dirPathArg)){
|
2016-07-03 02:03:15 +00:00
|
|
|
plugins.beautylog.error("smartgit.commit expects a valid git directory");
|
|
|
|
done.reject();
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
// if everything is all right proceed
|
|
|
|
plugins.shelljs.exec(`git commit -m "${commitMessage}"`);
|
2016-07-02 00:22:03 +00:00
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
2016-03-30 23:59:45 +00:00
|
|
|
};
|