Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
e07f5717c8 | |||
e0daf85e34 | |||
db27753aac | |||
5d00afcdf0 | |||
011ac2d7b4 | |||
ecede34127 | |||
08fe9e8727 | |||
80806fdca9 | |||
01499cc63a | |||
c8c9d8a407 |
@ -1,5 +1,5 @@
|
|||||||
# smartgit is an easy wrapper for nodegit
|
# smartgit is an easy wrapper for nodegit
|
||||||
an easy wrapper for nodegit
|
a wrapper for git. This plugin does not use nodegit as nodegit appears to have too many bugs for now.
|
||||||
|
|
||||||
### Buildstatus/Dependencies
|
### Buildstatus/Dependencies
|
||||||
[](https://gitlab.com/pushrocks/smartgit/commits/master)
|
[](https://gitlab.com/pushrocks/smartgit/commits/master)
|
||||||
|
7
dist/index.d.ts
vendored
7
dist/index.d.ts
vendored
@ -1,2 +1,7 @@
|
|||||||
import "typings-global";
|
export { add } from "./smartgit.add";
|
||||||
export { clone } from "./smartgit.clone";
|
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";
|
||||||
|
export { remote } from "./smartgit.remote";
|
||||||
|
16
dist/index.js
vendored
16
dist/index.js
vendored
@ -1,6 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
var smartgit_add_1 = require("./smartgit.add");
|
||||||
|
exports.add = smartgit_add_1.add;
|
||||||
var smartgit_clone_1 = require("./smartgit.clone");
|
var smartgit_clone_1 = require("./smartgit.clone");
|
||||||
exports.clone = smartgit_clone_1.clone;
|
exports.clone = smartgit_clone_1.clone;
|
||||||
|
var smartgit_commit_1 = require("./smartgit.commit");
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUVQLENBQUMsQ0FGc0I7QUFJdkIsK0JBQW9CLGtCQUFrQixDQUFDO0FBQS9CLHVDQUErQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcblxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuaW1wb3J0IFNtYXJ0Z2l0Q2hlY2sgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5jaGVja1wiKTtcbmV4cG9ydCB7Y2xvbmV9IGZyb20gXCIuL3NtYXJ0Z2l0LmNsb25lXCI7XG5pbXBvcnQgU21hcnRnaXRDb21taXQgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5jb21taXRcIik7XG5pbXBvcnQgU21hcnRnaXRJbml0ID0gcmVxdWlyZShcIi4vc21hcnRnaXQuaW5pdFwiKTtcblxuXG4iXX0=
|
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;
|
||||||
|
var smartgit_remote_1 = require("./smartgit.remote");
|
||||||
|
exports.remote = smartgit_remote_1.remote;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsNkJBQWtCLGdCQUFnQixDQUFDO0FBQTNCLGlDQUEyQjtBQUNuQywrQkFBb0Isa0JBQWtCLENBQUM7QUFBL0IsdUNBQStCO0FBQ3ZDLGdDQUFxQixtQkFBbUIsQ0FBQztBQUFqQywwQ0FBaUM7QUFDekMsOEJBQW1CLGlCQUFpQixDQUFDO0FBQTdCLG9DQUE2QjtBQUNyQyw4QkFBbUIsaUJBQWlCLENBQUM7QUFBN0Isb0NBQTZCO0FBQ3JDLDhCQUFtQixpQkFBaUIsQ0FBQztBQUE3QixvQ0FBNkI7QUFDckMsZ0NBQXFCLG1CQUFtQixDQUFDO0FBQWpDLDBDQUFpQyJ9
|
0
dist/postinstall.d.ts
vendored
Normal file
0
dist/postinstall.d.ts
vendored
Normal file
3
dist/postinstall.js
vendored
Normal file
3
dist/postinstall.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
var shelljs = require("shelljs");
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9zdGluc3RhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wb3N0aW5zdGFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=
|
8
dist/smartgit.add.d.ts
vendored
8
dist/smartgit.add.d.ts
vendored
@ -1,5 +1,3 @@
|
|||||||
import "typings-global";
|
export declare let add: {
|
||||||
export declare let pull: (optionsArg: {
|
addAll: (dirPathArg: string) => any;
|
||||||
path: string;
|
};
|
||||||
ref?: string;
|
|
||||||
}) => void;
|
|
||||||
|
24
dist/smartgit.add.js
vendored
24
dist/smartgit.add.js
vendored
@ -1,10 +1,20 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./smartgit.plugins");
|
var plugins = require("./smartgit.plugins");
|
||||||
exports.pull = function (optionsArg) {
|
var helpers = require("./smartgit.helpers");
|
||||||
if (!optionsArg.ref)
|
var addAll = function (dirPathArg) {
|
||||||
optionsArg.ref = "master";
|
var done = plugins.Q.defer();
|
||||||
plugins.nodegit.Repository.open(optionsArg.path);
|
if (!helpers.isGitDirectory(dirPathArg)) {
|
||||||
|
plugins.beautylog.error("smartgit.add expects a valid git directory!");
|
||||||
|
done.reject();
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
// if everything is ok proceed
|
||||||
|
plugins.shelljs.exec("(cd " + dirPathArg + " && git add -A && git status)");
|
||||||
|
done.resolve(dirPathArg);
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
exports.add = {
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmFkZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsWUFBSSxHQUFHLFVBQUMsVUFBb0M7SUFDbkQsRUFBRSxDQUFBLENBQUMsQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDO1FBQUMsVUFBVSxDQUFDLEdBQUcsR0FBRyxRQUFRLENBQUM7SUFDOUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUNyRCxDQUFDLENBQUEiLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vc21hcnRnaXQucGx1Z2luc1wiO1xuXG5leHBvcnQgbGV0IHB1bGwgPSAob3B0aW9uc0FyZzp7cGF0aDpzdHJpbmcscmVmPzpzdHJpbmd9KSA9PiB7XG4gICAgaWYoIW9wdGlvbnNBcmcucmVmKSBvcHRpb25zQXJnLnJlZiA9IFwibW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FBRSxNQUFNO0NBQ2pCLENBQUEifQ==
|
1
dist/smartgit.check.d.ts
vendored
1
dist/smartgit.check.d.ts
vendored
@ -1,3 +1,2 @@
|
|||||||
import "typings-global";
|
|
||||||
declare var _default: (repoArg: any) => boolean;
|
declare var _default: (repoArg: any) => boolean;
|
||||||
export = _default;
|
export = _default;
|
||||||
|
4
dist/smartgit.check.js
vendored
4
dist/smartgit.check.js
vendored
@ -1,7 +1,5 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
|
||||||
module.exports = function (repoArg) {
|
module.exports = function (repoArg) {
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jaGVjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNoZWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0Z2l0LmNoZWNrLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuZXhwb3J0ID0gZnVuY3Rpb24ocmVwb0FyZykge1xuICAgIHJldHVybiB0cnVlO1xufTsiXX0=
|
|
2
dist/smartgit.clone.d.ts
vendored
2
dist/smartgit.clone.d.ts
vendored
@ -1,7 +1,7 @@
|
|||||||
import "typings-global";
|
|
||||||
export declare let clone: (optionsArg: {
|
export declare let clone: (optionsArg: {
|
||||||
from: string;
|
from: string;
|
||||||
to: string;
|
to: string;
|
||||||
|
key?: string;
|
||||||
keyPath?: string;
|
keyPath?: string;
|
||||||
keyPassphrase?: string;
|
keyPassphrase?: string;
|
||||||
}) => any;
|
}) => any;
|
||||||
|
40
dist/smartgit.clone.js
vendored
40
dist/smartgit.clone.js
vendored
@ -1,42 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./smartgit.plugins");
|
var plugins = require("./smartgit.plugins");
|
||||||
var SmartgitCheck = require("./smartgit.check");
|
|
||||||
exports.clone = function (optionsArg) {
|
exports.clone = function (optionsArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
/***** URL Checks ******/
|
plugins.smartfile.fs.ensureDir(optionsArg.to);
|
||||||
//TODO make smartstring URL test
|
plugins.shelljs.exec("git clone " + optionsArg.from + " " + optionsArg.to);
|
||||||
/***** Path Checks ******/
|
done.resolve();
|
||||||
if (!/^\/.*/.test(optionsArg.to)) {
|
|
||||||
plugins.beautylog.error("It seems that the given path " + optionsArg.to + " is not absolute.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
plugins.beautylog.log("Now cloning " + optionsArg.from);
|
|
||||||
var cloneOptions = {
|
|
||||||
fetchOpts: {
|
|
||||||
callbacks: {
|
|
||||||
certificateCheck: function () { return 1; },
|
|
||||||
credentials: function (url, userName) {
|
|
||||||
var gitRepo = new plugins.smartstring.GitRepo(url);
|
|
||||||
var host = gitRepo.host;
|
|
||||||
var sshDir = plugins.path.join(plugins.smartpath.get.home(), ".ssh/");
|
|
||||||
var pubKeyPath = plugins.path.join(sshDir, host + ".pub");
|
|
||||||
var privKeyPath = plugins.path.join(sshDir, host);
|
|
||||||
if (!optionsArg.keyPassphrase)
|
|
||||||
optionsArg.keyPassphrase = "";
|
|
||||||
return plugins.nodegit.Cred.sshKeyNew(userName, pubKeyPath, privKeyPath, optionsArg.keyPassphrase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var cloneRepository = plugins.nodegit.Clone.clone(optionsArg.from, optionsArg.to, cloneOptions)
|
|
||||||
.then(function () {
|
|
||||||
SmartgitCheck(cloneRepository);
|
|
||||||
done.resolve();
|
|
||||||
}, function (err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2xvbmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jbG9uZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUdwQyxhQUFLLEdBQUcsVUFBQyxVQU1uQjtJQUNHLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsU0FBUyxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsQ0FBQztJQUM5QyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxlQUFhLFVBQVUsQ0FBQyxJQUFJLFNBQUksVUFBVSxDQUFDLEVBQUksQ0FBQyxDQUFDO0lBQ3RFLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLEN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ubG9nKFwiTm93IGNsb25pbmcgXCIgKyBvcHRpb25zQXJnLmZyb20pO1xuICAgIHZhciBjbG9uZU9wdGlvbnM6YW55ID0ge1xuICAgICAgICBmZXRjaE9wdHM6IHtcbiAgICAgICAgICAgIGNhbGxiYWNrczoge1xuICAgICAgICAgICAgICAgIGNlcnRpZmljYXRlQ2hlY2s6IGZ1bmN0aW9uKCkgeyByZXR1cm4gMTsgfSxcbiAgICAgICAgICAgICAgICBjcmVkZW50aWFsczogZnVuY3Rpb24odXJsLCB1c2VyTmFtZSkge1xuICAgICAgICAgICAgICAgICAgICBsZXQgZ2l0UmVwbyA9IG5ldyBwbHVnaW5zLnNtYXJ0c3RyaW5nLkdpdFJlcG8odXJsKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IGhvc3QgPSBnaXRSZXBvLmhvc3Q7XG4gICAgICAgICAgICAgICAgICAgIGxldCBzc2hEaXIgPSBwbHVnaW5zLnBhdGguam9pbihwbHVnaW5zLnNtYXJ0cGF0aC5nZXQuaG9tZSgpLFwiLnNzaC9cIilcbiAgICAgICAgICAgICAgICAgICAgbGV0IHB1YktleVBhdGggPSBwbHVnaW5zLnBhdGguam9pbihzc2hEaXIsaG9zdCArIFwiLnB1YlwiKTtcbiAgICAgICAgICAgICAgICAgICAgbGV0IHByaXZLZXlQYXRoOnN0cmluZyA9IHBsdWdpbnMucGF0aC5qb2luKHNzaERpcixob3N0KTtcbiAgICAgICAgICAgICAgICAgICAgaWYoIW9wdGlvbnNBcmcua2V5UGFzc3BocmFzZSkgb3B0aW9uc0FyZy5rZXlQYXNzcGhyYXNlID0gXCJcIjtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHBsdWdpbnMubm9kZWdpdC5DcmVkLnNzaEtleU5ldyh1c2VyTmFtZSwgcHViS2V5UGF0aCwgcHJpdktleVBhdGgsb3B0aW9uc0FyZy5rZXlQYXNzcGhyYXNlKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9O1xuICAgIHZhciBjbG9uZVJlcG9zaXRvcnkgPSBwbHVnaW5zLm5vZGVnaXQuQ2xvbmUuY2xvbmUob3B0aW9uc0FyZy5mcm9tLCBvcHRpb25zQXJnLnRvLCBjbG9uZU9wdGlvbnMpXG4gICAgICAgIC50aGVuKCgpID0+IHtcbiAgICAgICAgICAgIFNtYXJ0Z2l0Q2hlY2soY2xvbmVSZXBvc2l0b3J5KTtcbiAgICAgICAgICAgIGRvbmUucmVzb2x2ZSgpO1xuICAgICAgICB9LChlcnIpID0+IHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgIH0pO1xuICAgIHJldHVybiBkb25lLnByb21pc2U7XG59OyJdfQ==
|
|
4
dist/smartgit.commit.d.ts
vendored
4
dist/smartgit.commit.d.ts
vendored
@ -1,3 +1 @@
|
|||||||
import "typings-global";
|
export declare let commit: (dirPathArg: string, commitMessage: string) => any;
|
||||||
declare var _default: (pathArg: string, commitMessage: string) => void;
|
|
||||||
export = _default;
|
|
||||||
|
19
dist/smartgit.commit.js
vendored
19
dist/smartgit.commit.js
vendored
@ -1,10 +1,17 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./smartgit.plugins");
|
var plugins = require("./smartgit.plugins");
|
||||||
module.exports = function (pathArg, commitMessage) {
|
var helpers = require("./smartgit.helpers");
|
||||||
var result = plugins.nodegit.index.addByPath(pathArg);
|
exports.commit = function (dirPathArg, commitMessage) {
|
||||||
if (result == 0) {
|
var done = plugins.Q.defer();
|
||||||
|
if (!helpers.isGitDirectory(dirPathArg)) {
|
||||||
|
plugins.beautylog.error("smartgit.commit expects a valid git directory");
|
||||||
|
done.reject();
|
||||||
|
return done.promise;
|
||||||
}
|
}
|
||||||
|
;
|
||||||
|
// if everything is all right proceed
|
||||||
|
plugins.shelljs.exec("(cd " + dirPathArg + " && git commit -m \"" + commitMessage + "\")");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuY29tbWl0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsY0FBTSxHQUFHLFVBQUMsVUFBaUIsRUFBQyxhQUFvQjtJQUN2RCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsK0NBQStDLENBQUMsQ0FBQztRQUN6RSxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDZCxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLHFDQUFxQztJQUNyQyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsNEJBQXNCLGFBQWEsUUFBSSxDQUFDLENBQUM7SUFDL0UsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ3ZCLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFL0MsaUJBQVMsVUFBUyxPQUFjLEVBQUMsYUFBb0I7SUFDakQsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRWxCLENBQUM7QUFDTCxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuXG5leHBvcnQgPSBmdW5jdGlvbihwYXRoQXJnOnN0cmluZyxjb21taXRNZXNzYWdlOnN0cmluZykge1xuICAgIHZhciByZXN1bHQgPSBwbHVnaW5zLm5vZGVnaXQuaW5kZXguYWRkQnlQYXRoKHBhdGhBcmcpO1xuICAgIGlmIChyZXN1bHQgPT0gMCkge1xuICAgICAgICBcbiAgICB9XG59OyJdfQ==
|
|
1
dist/smartgit.helpers.d.ts
vendored
Normal file
1
dist/smartgit.helpers.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare let isGitDirectory: (dirPathArg: any) => boolean;
|
11
dist/smartgit.helpers.js
vendored
Normal file
11
dist/smartgit.helpers.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
|
var plugins = require("./smartgit.plugins");
|
||||||
|
exports.isGitDirectory = function (dirPathArg) {
|
||||||
|
try {
|
||||||
|
return plugins.smartfile.fs.isDirectory(plugins.path.join(dirPathArg, ".git"));
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsc0JBQWMsR0FBRyxVQUFDLFVBQVU7SUFDbkMsSUFBSSxDQUFDO1FBQ0QsTUFBTSxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFdBQVcsQ0FDbkMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFDLE1BQU0sQ0FBQyxDQUN2QyxDQUFDO0lBQ04sQ0FDQTtJQUFBLEtBQUssQ0FBQSxDQUFDLEdBQUcsQ0FBQyxDQUFBLENBQUM7UUFDUCxNQUFNLENBQUMsS0FBSyxDQUFDO0lBQ2pCLENBQUM7QUFDTCxDQUFDLENBQUEifQ==
|
4
dist/smartgit.init.d.ts
vendored
4
dist/smartgit.init.d.ts
vendored
@ -1,3 +1 @@
|
|||||||
import "typings-global";
|
export declare let init: (dirPathArg: string) => any;
|
||||||
declare var _default: () => void;
|
|
||||||
export = _default;
|
|
||||||
|
26
dist/smartgit.init.js
vendored
26
dist/smartgit.init.js
vendored
@ -1,17 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./smartgit.plugins");
|
var plugins = require("./smartgit.plugins");
|
||||||
module.exports = function () {
|
exports.init = function (dirPathArg) {
|
||||||
var gitinit = function (dest) {
|
var done = plugins.Q.defer();
|
||||||
if (dest === void 0) { dest = "undefined"; }
|
if (typeof dirPathArg == "undefined") {
|
||||||
if (dest == "undefined") {
|
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
|
||||||
return; // ...and return function here if not
|
return;
|
||||||
}
|
}
|
||||||
var isBare = 0; //lets create a subfolder
|
;
|
||||||
plugins.nodegit.Repository.init(dest, isBare).then(function (repo) {
|
plugins.smartfile.fs.ensureDir(dirPathArg);
|
||||||
// do something with repo here.
|
plugins.shelljs.exec("(cd " + dirPathArg + " && git init)");
|
||||||
});
|
done.resolve(dirPathArg);
|
||||||
};
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuaW5pdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFcEMsWUFBSSxHQUFHLFVBQUMsVUFBaUI7SUFDaEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUMsQ0FBQyxPQUFPLFVBQVUsSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1FBQ25DLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLG9EQUFvRCxDQUFDLENBQUM7UUFDOUUsTUFBTSxDQUFDO0lBQ1gsQ0FBQztJQUFBLENBQUM7SUFDRixPQUFPLENBQUMsU0FBUyxDQUFDLEVBQUUsQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLENBQUM7SUFDM0MsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLGtCQUFlLENBQUMsQ0FBQztJQUN2RCxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ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AoZGVzdCA9PSBcInVuZGVmaW5lZFwiKSB7IC8vbGV0cyBjaGVjayBpZiBhIGRlc3RpbmF0aW9uIGlzIGRlZmluZWQuLi5cbiAgICAgICAgICAgIHJldHVybjsgLy8gLi4uYW5kIHJldHVybiBmdW5jdGlvbiBoZXJlIGlmIG5vdFxuICAgICAgICB9XG4gICAgICAgIHZhciBpc0JhcmUgPSAwOyAvL2xldHMgY3JlYXRlIGEgc3ViZm9sZGVyXG4gICAgICAgIHBsdWdpbnMubm9kZWdpdC5SZXBvc2l0b3J5LmluaXQoZGVzdCwgaXNCYXJlKS50aGVuKGZ1bmN0aW9uIChyZXBvKSB7XG4gICAgICAgICAgICAvLyBkbyBzb21ldGhpbmcgd2l0aCByZXBvIGhlcmUuXG4gICAgICAgIH0pO1xuICAgIH07XG59Il19
|
|
1
dist/smartgit.interfaces.d.ts
vendored
1
dist/smartgit.interfaces.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
import "typings-global";
|
|
4
dist/smartgit.interfaces.js
vendored
4
dist/smartgit.interfaces.js
vendored
@ -1,4 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBRCIsImZpbGUiOiJzbWFydGdpdC5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIiJdfQ==
|
|
2
dist/smartgit.plugins.d.ts
vendored
2
dist/smartgit.plugins.d.ts
vendored
@ -1,8 +1,8 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
export import path = require("path");
|
export import path = require("path");
|
||||||
export import beautylog = require("beautylog");
|
export import beautylog = require("beautylog");
|
||||||
export declare let nodegit: any;
|
|
||||||
export declare let Q: any;
|
export declare let Q: any;
|
||||||
|
export declare let shelljs: any;
|
||||||
export import smartfile = require("smartfile");
|
export import smartfile = require("smartfile");
|
||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
|
5
dist/smartgit.plugins.js
vendored
5
dist/smartgit.plugins.js
vendored
@ -2,10 +2,9 @@
|
|||||||
require("typings-global");
|
require("typings-global");
|
||||||
exports.path = require("path");
|
exports.path = require("path");
|
||||||
exports.beautylog = require("beautylog");
|
exports.beautylog = require("beautylog");
|
||||||
exports.nodegit = require("nodegit");
|
|
||||||
exports.Q = require("q");
|
exports.Q = require("q");
|
||||||
|
exports.shelljs = require("shelljs");
|
||||||
exports.smartfile = require("smartfile");
|
exports.smartfile = require("smartfile");
|
||||||
exports.smartpath = require("smartpath");
|
exports.smartpath = require("smartpath");
|
||||||
exports.smartstring = require("smartstring");
|
exports.smartstring = require("smartstring");
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUVWLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ3BDLFNBQUMsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDLENBQUM7QUFDakIsZUFBTyxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FBQztBQUMxQixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGlCQUFTLFdBQVcsV0FBVyxDQ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XJlKFwic21hcnRzdHJpbmdcIik7XG5cblxuIl19
|
|
1
dist/smartgit.pull.d.ts
vendored
1
dist/smartgit.pull.d.ts
vendored
@ -0,0 +1 @@
|
|||||||
|
export declare let pull: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any;
|
||||||
|
21
dist/smartgit.pull.js
vendored
21
dist/smartgit.pull.js
vendored
@ -1,3 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
var plugins = require("./smartgit.plugins");
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGdpdC5wdWxsLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ==
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFDLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzdFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ3ZFLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUNkLE1BQU0sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO0lBQ3ZCLENBQUM7SUFBQSxDQUFDO0lBQ0YsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLHFCQUFnQixTQUFTLFNBQUksU0FBUyxNQUFHLENBQUMsQ0FBQztJQUNqRixJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9
|
1
dist/smartgit.push.d.ts
vendored
Normal file
1
dist/smartgit.push.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare let push: (dirPathArg: string, sourceArg?: string, branchArg?: string) => any;
|
18
dist/smartgit.push.js
vendored
Normal file
18
dist/smartgit.push.js
vendored
Normal file
@ -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=
|
4
dist/smartgit.remote.d.ts
vendored
Normal file
4
dist/smartgit.remote.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export declare let remote: {
|
||||||
|
add: (dirPathArg: any) => void;
|
||||||
|
remove: () => void;
|
||||||
|
};
|
12
dist/smartgit.remote.js
vendored
Normal file
12
dist/smartgit.remote.js
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
"use strict";
|
||||||
|
var plugins = require("./smartgit.plugins");
|
||||||
|
var addRemote = function (dirPathArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
};
|
||||||
|
var removeRemote = function () {
|
||||||
|
};
|
||||||
|
exports.remote = {
|
||||||
|
add: addRemote,
|
||||||
|
remove: removeRemote
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucmVtb3RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQucmVtb3RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBRzlDLElBQUksU0FBUyxHQUFHLFVBQUMsVUFBVTtJQUN2QixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0FBRWpDLENBQUMsQ0FBQztBQUVGLElBQUksWUFBWSxHQUFHO0FBRW5CLENBQUMsQ0FBQTtBQUVVLGNBQU0sR0FBRztJQUNoQixHQUFHLEVBQUUsU0FBUztJQUNkLE1BQU0sRUFBRSxZQUFZO0NBQ3ZCLENBQUEifQ==
|
15
package.json
15
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "smartgit",
|
"name": "smartgit",
|
||||||
"version": "0.1.1",
|
"version": "0.1.5",
|
||||||
"description": "an easy wrapper for nodegit",
|
"description": "an easy wrapper for nodegit",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"cleanTest": "rm -rf test/temp*",
|
||||||
|
"test": "(npm run cleanTest && npmts)",
|
||||||
|
"install": "node dist/postinstall.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -23,13 +25,14 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartgit",
|
"homepage": "https://github.com/pushrocks/smartgit",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^5.0.12",
|
"@types/minimatch": "*",
|
||||||
"nodegit": "^0.14.1",
|
"beautylog": "^5.0.13",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"smartfile": "^4.0.5",
|
"shelljs": "^0.7.0",
|
||||||
|
"smartfile": "^4.0.10",
|
||||||
"smartpath": "^3.2.2",
|
"smartpath": "^3.2.2",
|
||||||
"smartstring": "^2.0.10",
|
"smartstring": "^2.0.10",
|
||||||
"typings-global": "^1.0.3"
|
"typings-global": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npmts-g": "^5.2.6",
|
"npmts-g": "^5.2.6",
|
||||||
|
49
test/test.js
49
test/test.js
@ -1,35 +1,70 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-test");
|
require("typings-test");
|
||||||
|
var shelljs = require("shelljs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
require("should");
|
require("should");
|
||||||
var smartgit = require("../dist/index");
|
var smartgit = require("../dist/index");
|
||||||
|
var paths = {
|
||||||
|
temp: path.resolve("./test/temp/"),
|
||||||
|
temp2: path.resolve("./test/temp2/"),
|
||||||
|
temp3: path.resolve("./test/temp3"),
|
||||||
|
temp4: path.resolve("./test/temp4"),
|
||||||
|
noGit: path.resolve("./test/")
|
||||||
|
};
|
||||||
describe("smartgit", function () {
|
describe("smartgit", function () {
|
||||||
describe(".clone", function () {
|
describe(".clone", function () {
|
||||||
it("should clone a repository using ssh and sshkey", function (done) {
|
it("should clone a repository using ssh and sshkey", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(20000);
|
||||||
smartgit.clone({
|
smartgit.clone({
|
||||||
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
|
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
|
||||||
to: path.resolve("./test/temp/")
|
to: paths.temp
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("should clone a repository using https", function (done) {
|
it("should clone a repository using https", function (done) {
|
||||||
this.timeout(10000);
|
this.timeout(20000);
|
||||||
smartgit.clone({
|
smartgit.clone({
|
||||||
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
|
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
|
||||||
to: path.resolve("./test/temp2/")
|
to: paths.temp2
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe(".check", function () {
|
describe(".add", function () {
|
||||||
|
it("should error for noGit", function () {
|
||||||
|
smartgit.add.addAll(paths.noGit);
|
||||||
|
});
|
||||||
|
it("should add a file to an existing repository", function () {
|
||||||
|
shelljs.exec("(cd " + paths.temp + " && cp ../test.js .)");
|
||||||
|
smartgit.add.addAll(paths.temp);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("commit", function () {
|
describe("commit", function () {
|
||||||
|
it("should error for noGit", function () {
|
||||||
|
smartgit.commit(paths.noGit, "some commit message");
|
||||||
|
});
|
||||||
|
it("should commit a new file to an existing repository", function () {
|
||||||
|
smartgit.commit(paths.temp, "added a new file");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe("init", function () {
|
describe("init", function () {
|
||||||
|
it("should error for noGit", function () {
|
||||||
|
smartgit.init(paths.noGit);
|
||||||
|
});
|
||||||
|
it("should init a new git", function () {
|
||||||
|
smartgit.init(paths.temp3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe("pull", function () {
|
||||||
|
this.timeout(10000);
|
||||||
|
it("should error for noGit", function () {
|
||||||
|
smartgit.pull(paths.noGit);
|
||||||
|
});
|
||||||
|
it("should pull from origin", function () {
|
||||||
|
smartgit.pull(paths.temp);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQ2pDLElBQU8sSUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzlCLFFBQU8sUUFFUCxDQUFDLENBRmM7QUFFZixJQUFPLFFBQVEsV0FBVyxlQUFlLENBQUMsQ0FBQztBQUMzQyxJQUFJLEtBQUssR0FBRztJQUNSLElBQUksRUFBRSxJQUFJLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQztJQUNsQyxLQUFLLEVBQUUsSUFBSSxDQUFDLE9BQU8sQ0FBQyxlQUFlLENBQUM7SUFDcEMsS0FBSyxFQUFFLElBQUksQ0FB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Y3Rpb24oZG9uZSl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgc21hcnRnaXQuY2xvbmUoe1xuICAgICAgICAgICAgICAgIGZyb206XCJnaXRAZ2l0bGFiLmNvbTpzYW5kYm94em9uZS9zYW5kYm94LXRlc3RyZXBvLmdpdFwiLFxuICAgICAgICAgICAgICAgIHRvOnBhdGgucmVzb2x2ZShcIi4vdGVzdC90ZW1wL1wiKVxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgaXQoXCJzaG91bGQgY2xvbmUgYSByZXBvc2l0b3J5IHVzaW5nIGh0dHBzXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgc21hcnRnaXQuY2xvbmUoe1xuICAgICAgICAgICAgICAgIGZyb206XCJodHRwczovL2dpdGxhYi5jb20vc2FuZGJveHpvbmUvc2FuZGJveC10ZXN0cmVwby5naXRcIixcbiAgICAgICAgICAgICAgICB0bzpwYXRoLnJlc29sdmUoXCIuL3Rlc3QvdGVtcDIvXCIpXG4gICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiLmNoZWNrXCIsZnVuY3Rpb24oKXtcblxuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiY29tbWl0XCIsZnVuY3Rpb24oKXtcblxuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiaW5pdFwiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbn0pOyJdfQ==
|
|
49
test/test.ts
49
test/test.ts
@ -1,38 +1,71 @@
|
|||||||
import "typings-test";
|
import "typings-test";
|
||||||
import beautylog = require("beautylog");
|
import beautylog = require("beautylog");
|
||||||
|
let shelljs = require("shelljs");
|
||||||
import path = require("path");
|
import path = require("path");
|
||||||
import "should"
|
import "should"
|
||||||
|
|
||||||
import smartgit = require("../dist/index");
|
import smartgit = require("../dist/index");
|
||||||
|
let paths = {
|
||||||
|
temp: path.resolve("./test/temp/"),
|
||||||
|
temp2: path.resolve("./test/temp2/"),
|
||||||
|
temp3: path.resolve("./test/temp3"),
|
||||||
|
temp4: path.resolve("./test/temp4"),
|
||||||
|
noGit: path.resolve("./test/")
|
||||||
|
}
|
||||||
|
|
||||||
describe("smartgit",function(){
|
describe("smartgit",function(){
|
||||||
describe(".clone",function(){
|
describe(".clone",function(){
|
||||||
it("should clone a repository using ssh and sshkey",function(done){
|
it("should clone a repository using ssh and sshkey",function(done){
|
||||||
this.timeout(10000);
|
this.timeout(20000);
|
||||||
smartgit.clone({
|
smartgit.clone({
|
||||||
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
|
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
|
||||||
to:path.resolve("./test/temp/")
|
to:paths.temp
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("should clone a repository using https",function(done){
|
it("should clone a repository using https",function(done){
|
||||||
this.timeout(10000);
|
this.timeout(20000);
|
||||||
smartgit.clone({
|
smartgit.clone({
|
||||||
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
|
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
|
||||||
to:path.resolve("./test/temp2/")
|
to:paths.temp2
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe(".check",function(){
|
describe(".add",function(){
|
||||||
|
it("should error for noGit",function(){
|
||||||
|
smartgit.add.addAll(paths.noGit);
|
||||||
|
})
|
||||||
|
it("should add a file to an existing repository",function(){
|
||||||
|
shelljs.exec(`(cd ${paths.temp} && cp ../test.js .)`)
|
||||||
|
smartgit.add.addAll(paths.temp);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
describe("commit",function(){
|
describe("commit",function(){
|
||||||
|
it("should error for noGit",function(){
|
||||||
|
smartgit.commit(paths.noGit,"some commit message");
|
||||||
|
})
|
||||||
|
it("should commit a new file to an existing repository",function(){
|
||||||
|
smartgit.commit(paths.temp,"added a new file");
|
||||||
|
})
|
||||||
});
|
});
|
||||||
describe("init",function(){
|
describe("init",function(){
|
||||||
|
it("should error for noGit",function(){
|
||||||
|
smartgit.init(paths.noGit);
|
||||||
|
});
|
||||||
|
it("should init a new git",function(){
|
||||||
|
smartgit.init(paths.temp3);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
describe("pull",function(){
|
||||||
|
this.timeout(10000);
|
||||||
|
it("should error for noGit",function(){
|
||||||
|
smartgit.pull(paths.noGit);
|
||||||
|
});
|
||||||
|
it("should pull from origin",function(){
|
||||||
|
smartgit.pull(paths.temp);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
14
ts/index.ts
14
ts/index.ts
@ -1,9 +1,9 @@
|
|||||||
import "typings-global"
|
|
||||||
|
|
||||||
import plugins = require("./smartgit.plugins");
|
import plugins = require("./smartgit.plugins");
|
||||||
import SmartgitCheck = require("./smartgit.check");
|
|
||||||
|
export {add} from "./smartgit.add";
|
||||||
export {clone} from "./smartgit.clone";
|
export {clone} from "./smartgit.clone";
|
||||||
import SmartgitCommit = require("./smartgit.commit");
|
export {commit} from "./smartgit.commit";
|
||||||
import SmartgitInit = require("./smartgit.init");
|
export {init} from "./smartgit.init";
|
||||||
|
export {pull} from "./smartgit.pull";
|
||||||
|
export {push} from "./smartgit.push";
|
||||||
|
export {remote} from "./smartgit.remote";
|
||||||
|
2
ts/postinstall.ts
Normal file
2
ts/postinstall.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
let shelljs = require("shelljs");
|
||||||
|
import beautylog = require("beautylog");
|
@ -1,7 +1,19 @@
|
|||||||
import "typings-global";
|
|
||||||
import * as plugins from "./smartgit.plugins";
|
import * as plugins from "./smartgit.plugins";
|
||||||
|
import * as helpers from "./smartgit.helpers";
|
||||||
|
|
||||||
export let pull = (optionsArg:{path:string,ref?:string}) => {
|
let addAll = (dirPathArg:string) => {
|
||||||
if(!optionsArg.ref) optionsArg.ref = "master";
|
let done = plugins.Q.defer();
|
||||||
plugins.nodegit.Repository.open(optionsArg.path);
|
if(!helpers.isGitDirectory(dirPathArg)){
|
||||||
|
plugins.beautylog.error("smartgit.add expects a valid git directory!");
|
||||||
|
done.reject();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
// if everything is ok proceed
|
||||||
|
plugins.shelljs.exec(`(cd ${dirPathArg} && git add -A && git status)`);
|
||||||
|
done.resolve(dirPathArg);
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
export let add = {
|
||||||
|
addAll: addAll
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import "typings-global"
|
|
||||||
import plugins = require("./smartgit.plugins");
|
import plugins = require("./smartgit.plugins");
|
||||||
export = function(repoArg) {
|
export = function(repoArg) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,46 +1,16 @@
|
|||||||
import "typings-global"
|
|
||||||
import plugins = require("./smartgit.plugins");
|
import plugins = require("./smartgit.plugins");
|
||||||
import SmartgitCheck = require("./smartgit.check");
|
import SmartgitCheck = require("./smartgit.check");
|
||||||
|
|
||||||
export let clone = (optionsArg:{
|
export let clone = (optionsArg: {
|
||||||
from:string,
|
from: string,
|
||||||
to:string,
|
to: string,
|
||||||
keyPath?:string,
|
key?: string,
|
||||||
keyPassphrase?:string
|
keyPath?: string,
|
||||||
}) => {
|
keyPassphrase?: string
|
||||||
|
}) => {
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
/***** URL Checks ******/
|
plugins.smartfile.fs.ensureDir(optionsArg.to);
|
||||||
//TODO make smartstring URL test
|
plugins.shelljs.exec(`git clone ${optionsArg.from} ${optionsArg.to}`);
|
||||||
|
done.resolve();
|
||||||
/***** Path Checks ******/
|
|
||||||
if (!/^\/.*/.test(optionsArg.to)){ //check wether path is absolute
|
|
||||||
plugins.beautylog.error("It seems that the given path " + optionsArg.to + " is not absolute.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins.beautylog.log("Now cloning " + optionsArg.from);
|
|
||||||
var cloneOptions:any = {
|
|
||||||
fetchOpts: {
|
|
||||||
callbacks: {
|
|
||||||
certificateCheck: function() { return 1; },
|
|
||||||
credentials: function(url, userName) {
|
|
||||||
let gitRepo = new plugins.smartstring.GitRepo(url);
|
|
||||||
let host = gitRepo.host;
|
|
||||||
let sshDir = plugins.path.join(plugins.smartpath.get.home(),".ssh/")
|
|
||||||
let pubKeyPath = plugins.path.join(sshDir,host + ".pub");
|
|
||||||
let privKeyPath:string = plugins.path.join(sshDir,host);
|
|
||||||
if(!optionsArg.keyPassphrase) optionsArg.keyPassphrase = "";
|
|
||||||
return plugins.nodegit.Cred.sshKeyNew(userName, pubKeyPath, privKeyPath,optionsArg.keyPassphrase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var cloneRepository = plugins.nodegit.Clone.clone(optionsArg.from, optionsArg.to, cloneOptions)
|
|
||||||
.then(() => {
|
|
||||||
SmartgitCheck(cloneRepository);
|
|
||||||
done.resolve();
|
|
||||||
},(err) => {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
import "typings-global"
|
import * as plugins from "./smartgit.plugins";
|
||||||
import plugins = require("./smartgit.plugins");
|
import * as helpers from "./smartgit.helpers";
|
||||||
|
|
||||||
export = function(pathArg:string,commitMessage:string) {
|
export let commit = (dirPathArg:string,commitMessage:string) => {
|
||||||
var result = plugins.nodegit.index.addByPath(pathArg);
|
let done = plugins.Q.defer();
|
||||||
if (result == 0) {
|
if(!helpers.isGitDirectory(dirPathArg)){
|
||||||
|
plugins.beautylog.error("smartgit.commit expects a valid git directory");
|
||||||
}
|
done.reject();
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
// if everything is all right proceed
|
||||||
|
plugins.shelljs.exec(`(cd ${dirPathArg} && git commit -m "${commitMessage}")`);
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
};
|
};
|
12
ts/smartgit.helpers.ts
Normal file
12
ts/smartgit.helpers.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import * as plugins from "./smartgit.plugins";
|
||||||
|
|
||||||
|
export let isGitDirectory = (dirPathArg):boolean => {
|
||||||
|
try {
|
||||||
|
return plugins.smartfile.fs.isDirectory(
|
||||||
|
plugins.path.join(dirPathArg,".git")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,13 @@
|
|||||||
import "typings-global"
|
|
||||||
import plugins = require("./smartgit.plugins");
|
import plugins = require("./smartgit.plugins");
|
||||||
|
|
||||||
export = function(){
|
export let init = (dirPathArg:string) => {
|
||||||
var gitinit = function(dest:string = "undefined") {
|
let done = plugins.Q.defer();
|
||||||
if (dest == "undefined") { //lets check if a destination is defined...
|
if (typeof dirPathArg == "undefined") { //lets check if a destination is defined...
|
||||||
return; // ...and return function here if not
|
plugins.beautylog.error("smartgit.init requires an absolute directory path!");
|
||||||
}
|
return;
|
||||||
var isBare = 0; //lets create a subfolder
|
|
||||||
plugins.nodegit.Repository.init(dest, isBare).then(function (repo) {
|
|
||||||
// do something with repo here.
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
plugins.smartfile.fs.ensureDir(dirPathArg);
|
||||||
|
plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`);
|
||||||
|
done.resolve(dirPathArg);
|
||||||
|
return done.promise;
|
||||||
|
};
|
@ -1 +0,0 @@
|
|||||||
import "typings-global"
|
|
@ -1,11 +1,9 @@
|
|||||||
import "typings-global"
|
import "typings-global";
|
||||||
|
|
||||||
export import path = require("path");
|
export import path = require("path");
|
||||||
export import beautylog = require("beautylog");
|
export import beautylog = require("beautylog");
|
||||||
export let nodegit = require("nodegit");
|
|
||||||
export let Q = require("q");
|
export let Q = require("q");
|
||||||
|
export let shelljs = require("shelljs");
|
||||||
export import smartfile = require("smartfile");
|
export import smartfile = require("smartfile");
|
||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
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;
|
||||||
|
};
|
16
ts/smartgit.remote.ts
Normal file
16
ts/smartgit.remote.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import * as plugins from "./smartgit.plugins";
|
||||||
|
import * as helpers from "./smartgit.helpers";
|
||||||
|
|
||||||
|
let addRemote = (dirPathArg) => {
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
let removeRemote = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export let remote = {
|
||||||
|
add: addRemote,
|
||||||
|
remove: removeRemote
|
||||||
|
}
|
Reference in New Issue
Block a user