update some implementations
This commit is contained in:
10
ts/index.ts
10
ts/index.ts
@ -1,7 +1,7 @@
|
||||
import plugins = require("./smartgit.plugins");
|
||||
import SmartgitCheck = require("./smartgit.check");
|
||||
|
||||
export {clone} from "./smartgit.clone";
|
||||
import SmartgitCommit = require("./smartgit.commit");
|
||||
import SmartgitInit = require("./smartgit.init");
|
||||
|
||||
|
||||
export {commit} from "./smartgit.commit";
|
||||
export {init} from "./smartgit.init";
|
||||
export {pull} from "./smartgit.pull";
|
||||
export {push} from "./smartgit.push";
|
||||
|
@ -1,7 +1,15 @@
|
||||
import plugins = require("./smartgit.plugins");
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
import * as helpers from "./smartgit.helpers";
|
||||
|
||||
export = function(pathArg:string,commitMessage:string) {
|
||||
export let commit = (dirPathArg:string,commitMessage:string) => {
|
||||
let done = plugins.Q.defer();
|
||||
if(!plugins.smartfile.fs.isDirectory(plugins.path.join(dirPathArg,".git"))){
|
||||
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}"`);
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
7
ts/smartgit.helpers.ts
Normal file
7
ts/smartgit.helpers.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
|
||||
export let isGitDirectory = (dirPathArg):boolean => {
|
||||
return plugins.smartfile.fs.isDirectory(
|
||||
plugins.path.join(dirPathArg,".git")
|
||||
);
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
import plugins = require("./smartgit.plugins");
|
||||
|
||||
export = function(){
|
||||
var gitinit = function(dest:string = "undefined") {
|
||||
if (dest == "undefined") { //lets check if a destination is defined...
|
||||
return; // ...and return function here if not
|
||||
}
|
||||
|
||||
|
||||
export let init = (dirPathArg:string) => {
|
||||
let done = plugins.Q.defer();
|
||||
if (typeof dirPathArg == "undefined") { //lets check if a destination is defined...
|
||||
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
|
||||
return;
|
||||
};
|
||||
}
|
||||
plugins.smartfile.fs.ensureDir(dirPathArg);
|
||||
plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`);
|
||||
done.resolve(dirPathArg);
|
||||
return done.promise;
|
||||
};
|
@ -0,0 +1,13 @@
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
import * as helpers from "./smartgit.helpers";
|
||||
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();
|
||||
return done.promse;
|
||||
};
|
||||
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
|
||||
done.resolve(dirPathArg);
|
||||
return done.promise;
|
||||
};
|
15
ts/smartgit.push.ts
Normal file
15
ts/smartgit.push.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import * as plugins from "./smartgit.plugins";
|
||||
import * as helpers from "./smartgit.helpers";
|
||||
|
||||
export let push = (dirPathArg:string, sourceArg:string = "", branchArg:string = "") => {
|
||||
let done = plugins.Q.defer();
|
||||
if(!helpers.isGitDirectory(dirPathArg)){
|
||||
plugins.beautylog.error("smartgit.push expects a valid git directory");
|
||||
done.reject();
|
||||
return done.promise;
|
||||
}
|
||||
// if everything seems allright proceed
|
||||
plugins.shelljs.exec("");
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
};
|
0
ts/smartgit.remote.ts
Normal file
0
ts/smartgit.remote.ts
Normal file
Reference in New Issue
Block a user