added CI tests

This commit is contained in:
2016-07-04 00:00:04 +02:00
parent db27753aac
commit e0daf85e34
10 changed files with 115 additions and 27 deletions

View File

@ -1,15 +1,19 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let add = (dirPathArg:string) => {
let addAll = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
plugins.beautylog.error("smartgit.add expects a valif git directory!");
plugins.beautylog.error("smartgit.add expects a valid git directory!");
done.reject();
return done.promise;
};
// if everything is ok proceed
plugins.shelljs.exec("");
plugins.shelljs.exec(`(cd ${dirPathArg} && git add -A && git status)`);
done.resolve(dirPathArg);
return done.promise;
};
export let add = {
addAll: addAll
}

View File

@ -9,7 +9,7 @@ export let commit = (dirPathArg:string,commitMessage:string) => {
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`git commit -m "${commitMessage}"`);
plugins.shelljs.exec(`(cd ${dirPathArg} && git commit -m "${commitMessage}")`);
done.resolve();
return done.promise;
};

View File

@ -1,7 +1,12 @@
import * as plugins from "./smartgit.plugins";
export let isGitDirectory = (dirPathArg):boolean => {
return plugins.smartfile.fs.isDirectory(
plugins.path.join(dirPathArg,".git")
);
try {
return plugins.smartfile.fs.isDirectory(
plugins.path.join(dirPathArg,".git")
);
}
catch(err){
return false;
}
}