diff --git a/dist/index.d.ts b/dist/index.d.ts index ab59958..751965a 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,5 @@ -import "typings-global"; export { clone } from "./smartgit.clone"; +export { commit } from "./smartgit.commit"; +export { init } from "./smartgit.init"; +export { pull } from "./smartgit.pull"; +export { push } from "./smartgit.push"; diff --git a/dist/index.js b/dist/index.js index 0f92202..8cafcf0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,5 +1,12 @@ "use strict"; -require("typings-global"); var smartgit_clone_1 = require("./smartgit.clone"); exports.clone = smartgit_clone_1.clone; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFFUCxDQUFDLENBRnNCO0FBSXZCLCtCQUFvQixrQkFBa0IsQ0FBQztBQUEvQix1Q0FBK0IifQ== \ No newline at end of file +var smartgit_commit_1 = require("./smartgit.commit"); +exports.commit = smartgit_commit_1.commit; +var smartgit_init_1 = require("./smartgit.init"); +exports.init = smartgit_init_1.init; +var smartgit_pull_1 = require("./smartgit.pull"); +exports.pull = smartgit_pull_1.pull; +var smartgit_push_1 = require("./smartgit.push"); +exports.push = smartgit_push_1.push; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsK0JBQW9CLGtCQUFrQixDQUFDO0FBQS9CLHVDQUErQjtBQUN2QyxnQ0FBcUIsbUJBQW1CLENBQUM7QUFBakMsMENBQWlDO0FBQ3pDLDhCQUFtQixpQkFBaUIsQ0FBQztBQUE3QixvQ0FBNkI7QUFDckMsOEJBQW1CLGlCQUFpQixDQUFDO0FBQTdCLG9DQUE2QjtBQUNyQyw4QkFBbUIsaUJBQWlCLENBQUM7QUFBN0Isb0NBQTZCIn0= \ No newline at end of file diff --git a/dist/postinstall.js b/dist/postinstall.js index 3f3b0c7..cfcd674 100644 --- a/dist/postinstall.js +++ b/dist/postinstall.js @@ -1,2 +1,3 @@ "use strict"; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9zdGluc3RhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wb3N0aW5zdGFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0= \ No newline at end of file +var shelljs = require("shelljs"); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9zdGluc3RhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wb3N0aW5zdGFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/dist/smartgit.add.d.ts b/dist/smartgit.add.d.ts index 79480f5..dbbb4e0 100644 --- a/dist/smartgit.add.d.ts +++ b/dist/smartgit.add.d.ts @@ -1,4 +1,3 @@ -import "typings-global"; export declare let pull: (optionsArg: { path: string; ref?: string; diff --git a/dist/smartgit.add.js b/dist/smartgit.add.js index 5f52be0..1339160 100644 --- a/dist/smartgit.add.js +++ b/dist/smartgit.add.js @@ -1,5 +1,4 @@ "use strict"; -require("typings-global"); exports.pull = function (optionsArg) { }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuYWRkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFHYixZQUFJLEdBQUcsVUFBQyxVQUFvQztBQUV2RCxDQUFDLENBQUEifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuYWRkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFVyxZQUFJLEdBQUcsVUFBQyxVQUFvQztBQUV2RCxDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/dist/smartgit.check.d.ts b/dist/smartgit.check.d.ts index f37dfe5..215dfd6 100644 --- a/dist/smartgit.check.d.ts +++ b/dist/smartgit.check.d.ts @@ -1,3 +1,2 @@ -import "typings-global"; declare var _default: (repoArg: any) => boolean; export = _default; diff --git a/dist/smartgit.check.js b/dist/smartgit.check.js index 9e65225..1378c26 100644 --- a/dist/smartgit.check.js +++ b/dist/smartgit.check.js @@ -1,6 +1,5 @@ "use strict"; -require("typings-global"); module.exports = function (repoArg) { return true; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jaGVjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBRXZCLGlCQUFTLFVBQVMsT0FBTztJQUNyQixNQUFNLENBQUMsSUFBSSxDQUFDO0FBQ2hCLENBQUMsQ0FBQyJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jaGVjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/dist/smartgit.commit.d.ts b/dist/smartgit.commit.d.ts index b26b83a..332fd4c 100644 --- a/dist/smartgit.commit.d.ts +++ b/dist/smartgit.commit.d.ts @@ -1,2 +1 @@ -declare var _default: (pathArg: string, commitMessage: string) => any; -export = _default; +export declare let commit: (dirPathArg: string, commitMessage: string) => any; diff --git a/dist/smartgit.commit.js b/dist/smartgit.commit.js index fe35161..2e8cc4d 100644 --- a/dist/smartgit.commit.js +++ b/dist/smartgit.commit.js @@ -1,8 +1,16 @@ "use strict"; var plugins = require("./smartgit.plugins"); -module.exports = function (pathArg, commitMessage) { +exports.commit = function (dirPathArg, commitMessage) { var 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; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuY29tbWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DLGlCQUFTLFVBQVMsT0FBYyxFQUFDLGFBQW9CO0lBQ2pELElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuY29tbWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBR25DLGNBQU0sR0FBRyxVQUFDLFVBQWlCLEVBQUMsYUFBb0I7SUFDdkQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxVQUFVLEVBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDeEUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsK0NBQStDLENBQUMsQ0FBQztRQUN6RSxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLHFDQUFxQztJQUNyQyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxxQkFBa0IsYUFBYSxPQUFHLENBQUMsQ0FBQztJQUN6RCxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDZixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ== \ No newline at end of file diff --git a/dist/smartgit.helpers.d.ts b/dist/smartgit.helpers.d.ts new file mode 100644 index 0000000..3e9b259 --- /dev/null +++ b/dist/smartgit.helpers.d.ts @@ -0,0 +1 @@ +export declare let isGitDirectory: (dirPathArg: any) => boolean; diff --git a/dist/smartgit.helpers.js b/dist/smartgit.helpers.js new file mode 100644 index 0000000..c7dc554 --- /dev/null +++ b/dist/smartgit.helpers.js @@ -0,0 +1,6 @@ +"use strict"; +var plugins = require("./smartgit.plugins"); +exports.isGitDirectory = function (dirPathArg) { + return plugins.smartfile.fs.isDirectory(plugins.path.join(dirPathArg, ".git")); +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsc0JBQWMsR0FBRyxVQUFDLFVBQVU7SUFDbkMsTUFBTSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FDbkMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFDLE1BQU0sQ0FBQyxDQUN2QyxDQUFDO0FBQ04sQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/dist/smartgit.init.d.ts b/dist/smartgit.init.d.ts index 46f10f1..bfd2f16 100644 --- a/dist/smartgit.init.d.ts +++ b/dist/smartgit.init.d.ts @@ -1,2 +1 @@ -declare var _default: () => void; -export = _default; +export declare let init: (dirPathArg: string) => any; diff --git a/dist/smartgit.init.js b/dist/smartgit.init.js index abf8090..5beb628 100644 --- a/dist/smartgit.init.js +++ b/dist/smartgit.init.js @@ -1,10 +1,15 @@ "use strict"; -module.exports = function () { - var gitinit = function (dest) { - if (dest === void 0) { dest = "undefined"; } - if (dest == "undefined") { - return; // ...and return function here if not - } - }; +var plugins = require("./smartgit.plugins"); +exports.init = function (dirPathArg) { + var done = plugins.Q.defer(); + if (typeof dirPathArg == "undefined") { + 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; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaW5pdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBLGlCQUFTO0lBQ0wsSUFBSSxPQUFPLEdBQUcsVUFBUyxJQUF5QjtRQUF6QixvQkFBeUIsR0FBekIsa0JBQXlCO1FBQzVDLEVBQUUsQ0FBQyxDQUFDLElBQUksSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQ3RCLE1BQU0sQ0FBQyxDQUFDLHFDQUFxQztRQUNqRCxDQUFDO0lBR0wsQ0FBQyxDQUFDO0FBQ04sQ0FBQyxDQUFBIn0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaW5pdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFcEMsWUFBSSxHQUFHLFVBQUMsVUFBaUI7SUFDaEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUMsQ0FBQyxPQUFPLFVBQVUsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQ25DLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLG9EQUFvRCxDQUFDLENBQUM7UUFDOUUsTUFBTSxDQUFDO0lBQ1gsQ0FBQztJQUFBLENBQUM7SUFDRixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDM0MsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLGtCQUFlLENBQUMsQ0FBQztJQUN2RCxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/dist/smartgit.pull.d.ts b/dist/smartgit.pull.d.ts index e69de29..01ab935 100644 --- a/dist/smartgit.pull.d.ts +++ b/dist/smartgit.pull.d.ts @@ -0,0 +1 @@ +export declare let pull: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any; diff --git a/dist/smartgit.pull.js b/dist/smartgit.pull.js index 1333982..f9decad 100644 --- a/dist/smartgit.pull.js +++ b/dist/smartgit.pull.js @@ -1 +1,18 @@ -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9 \ No newline at end of file +"use strict"; +var plugins = require("./smartgit.plugins"); +var helpers = require("./smartgit.helpers"); +exports.pull = function (dirPathArg, sourceArg, branchArg) { + if (sourceArg === void 0) { sourceArg = ""; } + if (branchArg === void 0) { branchArg = ""; } + var 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; +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUNuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFDLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzdFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNkLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO0lBQ3ZCLENBQUM7SUFBQSxDQUFDO0lBQ0YsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLHFCQUFnQixTQUFTLFNBQUksU0FBUyxNQUFHLENBQUMsQ0FBQztJQUNqRixJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/dist/smartgit.push.d.ts b/dist/smartgit.push.d.ts new file mode 100644 index 0000000..07ced8f --- /dev/null +++ b/dist/smartgit.push.d.ts @@ -0,0 +1 @@ +export declare let push: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any; diff --git a/dist/smartgit.push.js b/dist/smartgit.push.js new file mode 100644 index 0000000..30220a0 --- /dev/null +++ b/dist/smartgit.push.js @@ -0,0 +1,18 @@ +"use strict"; +var plugins = require("./smartgit.plugins"); +var helpers = require("./smartgit.helpers"); +exports.push = function (dirPathArg, sourceArg, branchArg) { + if (sourceArg === void 0) { sourceArg = ""; } + if (branchArg === void 0) { branchArg = ""; } + var 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; +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1c2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFFLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzlFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNkLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3hCLENBQUM7SUFDRCx1Q0FBdUM7SUFDdkMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDekIsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0= \ No newline at end of file diff --git a/dist/smartgit.remote.d.ts b/dist/smartgit.remote.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/dist/smartgit.remote.js b/dist/smartgit.remote.js new file mode 100644 index 0000000..7bfbd11 --- /dev/null +++ b/dist/smartgit.remote.js @@ -0,0 +1 @@ +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucmVtb3RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQucmVtb3RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ== \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index e05f080..fc1ec07 100644 --- a/ts/index.ts +++ b/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"; diff --git a/ts/smartgit.commit.ts b/ts/smartgit.commit.ts index 8211035..49b4957 100644 --- a/ts/smartgit.commit.ts +++ b/ts/smartgit.commit.ts @@ -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; }; \ No newline at end of file diff --git a/ts/smartgit.helpers.ts b/ts/smartgit.helpers.ts new file mode 100644 index 0000000..068b266 --- /dev/null +++ b/ts/smartgit.helpers.ts @@ -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") + ); +} \ No newline at end of file diff --git a/ts/smartgit.init.ts b/ts/smartgit.init.ts index 9a28cce..2abe2e9 100644 --- a/ts/smartgit.init.ts +++ b/ts/smartgit.init.ts @@ -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; }; -} \ No newline at end of file + plugins.smartfile.fs.ensureDir(dirPathArg); + plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`); + done.resolve(dirPathArg); + return done.promise; +}; \ No newline at end of file diff --git a/ts/smartgit.pull.ts b/ts/smartgit.pull.ts index e69de29..805d6ad 100644 --- a/ts/smartgit.pull.ts +++ b/ts/smartgit.pull.ts @@ -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; +}; \ No newline at end of file diff --git a/ts/smartgit.push.ts b/ts/smartgit.push.ts new file mode 100644 index 0000000..69f9c38 --- /dev/null +++ b/ts/smartgit.push.ts @@ -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; +}; \ No newline at end of file diff --git a/ts/smartgit.remote.ts b/ts/smartgit.remote.ts new file mode 100644 index 0000000..e69de29