Compare commits

...

37 Commits

Author SHA1 Message Date
dffc390637 0.1.9 2016-07-05 03:47:43 +02:00
ae5b6b5afd improve typings and tests 2016-07-05 03:47:38 +02:00
c7f87eebae 0.1.8 2016-07-04 04:59:46 +02:00
63c54ff790 fix push 2016-07-04 04:59:39 +02:00
7670698e84 0.1.7 2016-07-04 03:49:29 +02:00
7e2481d511 now can work with remotes 2016-07-04 03:49:24 +02:00
9ae3acb3d8 0.1.6 2016-07-04 00:13:45 +02:00
4e12b7ee3b improve reamde 2016-07-04 00:13:32 +02:00
e07f5717c8 0.1.5 2016-07-04 00:00:15 +02:00
e0daf85e34 added CI tests 2016-07-04 00:00:04 +02:00
db27753aac 0.1.4 2016-07-03 04:37:11 +02:00
5d00afcdf0 new implementation 2016-07-03 04:37:03 +02:00
011ac2d7b4 update some implementations 2016-07-03 04:03:15 +02:00
ecede34127 remove unneccessary imports 2016-07-02 04:49:45 +02:00
08fe9e8727 0.1.3 2016-07-02 02:37:59 +02:00
80806fdca9 remove @types/shelljs 2016-07-02 02:36:33 +02:00
01499cc63a 0.1.2 2016-07-02 02:22:12 +02:00
c8c9d8a407 now using native git through shelljs since it proves to be much more stable 2016-07-02 02:22:03 +02:00
527d1b7aa5 0.1.1 2016-06-29 18:49:24 +02:00
d35fac2278 improve README 2016-06-29 18:48:54 +02:00
776d5b2f23 0.1.0 2016-06-28 02:52:29 +02:00
f9a3cd4149 now works with SSH keys 2016-06-28 02:52:21 +02:00
14492ff7a8 now has better sshKey understanding 2016-06-28 02:45:37 +02:00
f0cab00277 update sshKey detection 2016-06-28 01:21:40 +02:00
6331887373 Update .gitlab-ci.yml 2016-06-26 04:19:22 +00:00
98d28a14c5 Update .gitlab-ci.yml 2016-06-26 04:11:39 +00:00
76eb47f245 Update .gitlab-ci.yml 2016-06-26 02:17:54 +00:00
2b9fa4e8b7 Update .gitlab-ci.yml 2016-06-26 02:16:19 +00:00
28845ec1fd fix 2016-06-25 21:33:58 +02:00
6b8621588d fix README 2016-06-25 21:23:35 +02:00
ae0536d909 update gitlab.yml 2016-06-25 20:48:41 +02:00
1dbfdeea3c fix merge issue 2016-06-25 19:14:44 +02:00
7e75a788ab now using sandboxzone on gitlab 2016-06-25 19:13:19 +02:00
3073fc1f3c 0.0.11 2016-06-23 19:58:25 +02:00
760b5557f3 cleanup an add typings 2016-06-23 19:57:25 +02:00
1aae44a0ec add gitlab-ci yml 2016-06-12 16:50:29 +02:00
53a5a3a805 update base structure 2016-06-12 16:46:59 +02:00
48 changed files with 710 additions and 173 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules/
.settings/
.idea/
test/temp/
test/temp2/
coverage/
docs/

49
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,49 @@
image: hosttoday/ht-docker-node:npmts
stages:
- test
- release
- trigger
before_script:
- npmci prepare ssh
testLEGACY:
stage: test
script:
- npmci test legacy
tags:
- docker
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
release:
stage: release
script:
- npmci publish
only:
- tags
tags:
- docker
trigger:
stage: trigger
script:
- npmci trigger
only:
- tags
tags:
- docker

View File

@ -1,16 +1,23 @@
# 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
[![Build Status](https://travis-ci.org/pushrocks/smartgit.svg?branch=master)](https://travis-ci.org/pushrocks/smartgit)
[![build status](https://gitlab.com/pushrocks/smartgit/badges/master/build.svg)](https://gitlab.com/pushrocks/smartgit/commits/master)
[![devDependency Status](https://david-dm.org/pushrocks/smartgit/dev-status.svg)](https://david-dm.org/pushrocks/smartgit#info=devDependencies)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/smartgit/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/smartgit?branch=master)
### Usage
This npm package comes with everything you need to start your own gulp plugin.
This plugin exposes some easified method wrappers for nodegit.
This limits options but reduces errors (TypeScript) and speeds up usage.
Features:
* easily cone a git repo
* easily create a new git repo
* easily add all changes and make a new commit
* clone a git repo
* init a new repo
* create a new git repo
* add changes and make a new commit
* commit changes
* push changes
* add/remove remotes
Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment

8
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export { add } from "./smartgit.add";
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";
export { status } from "./smartgit.status";

30
dist/index.js vendored
View File

@ -1,14 +1,18 @@
/// <reference path="./typings/main.d.ts" />
"use strict";
var SmartgitCheck = require("./smartgit.check");
var SmartgitClone = require("./smartgit.clone");
var SmartgitCommit = require("./smartgit.commit");
var SmartgitInit = require("./smartgit.init");
var smartgit = {};
smartgit.clone = SmartgitClone;
smartgit.commit = SmartgitCommit;
smartgit.check = SmartgitCheck;
smartgit.init = SmartgitInit;
module.exports = smartgit;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFHNUMsSUFBTyxhQUFhLFdBQVcsa0JBQWtCLENBQUMsQ0FBQztBQUNuRCxJQUFPLGFBQWEsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBQ25ELElBQU8sY0FBYyxXQUFXLG1CQUFtQixDQUFDLENBQUM7QUFDckQsSUFBTyxZQUFZLFdBQVcsaUJBQWlCLENBQUMsQ0FBQztBQUVqRCxJQUFJLFFBQVEsR0FBTyxFQUFFLENBQUM7QUFDdEIsUUFBUSxDQUFDLEtBQUssR0FBRyxhQUFhLENBQUM7QUFDL0IsUUFBUSxDQUFDLE1BQU0sR0FBRyxjQUFjLENBQUM7QUFDakMsUUFBUSxDQUFDLEtBQUssR0FBRyxhQUFhLENBQUM7QUFDL0IsUUFBUSxDQUFDLElBQUksR0FBRyxZQUFZLENBQUM7QUFHN0IsTUFBTSxDQUFDLE9BQU8sR0FBRyxRQUFRLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5cbmltcG9ydCBwbHVnaW5zID0gcmVxdWlyZShcIi4vc21hcnRnaXQucGx1Z2luc1wiKTtcbmltcG9ydCBTbWFydGdpdENoZWNrID0gcmVxdWlyZShcIi4vc21hcnRnaXQuY2hlY2tcIik7XG5pbXBvcnQgU21hcnRnaXRDbG9uZSA9IHJlcXVpcmUoXCIuL3NtYXJ0Z2l0LmNsb25lXCIpO1xuaW1wb3J0IFNtYXJ0Z2l0Q29tbWl0ID0gcmVxdWlyZShcIi4vc21hcnRnaXQuY29tbWl0XCIpO1xuaW1wb3J0IFNtYXJ0Z2l0SW5pdCA9IHJlcXVpcmUoXCIuL3NtYXJ0Z2l0LmluaXRcIik7XG5cbnZhciBzbWFydGdpdDphbnkgPSB7fTtcbnNtYXJ0Z2l0LmNsb25lID0gU21hcnRnaXRDbG9uZTtcbnNtYXJ0Z2l0LmNvbW1pdCA9IFNtYXJ0Z2l0Q29tbWl0O1xuc21hcnRnaXQuY2hlY2sgPSBTbWFydGdpdENoZWNrO1xuc21hcnRnaXQuaW5pdCA9IFNtYXJ0Z2l0SW5pdDtcblxuXG5tb2R1bGUuZXhwb3J0cyA9IHNtYXJ0Z2l0O1xuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
var smartgit_add_1 = require("./smartgit.add");
exports.add = smartgit_add_1.add;
var smartgit_clone_1 = require("./smartgit.clone");
exports.clone = smartgit_clone_1.clone;
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;
var smartgit_remote_1 = require("./smartgit.remote");
exports.remote = smartgit_remote_1.remote;
var smartgit_status_1 = require("./smartgit.status");
exports.status = smartgit_status_1.status;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsNkJBQWtCLGdCQUFnQixDQUFDO0FBQTNCLGlDQUEyQjtBQUNuQywrQkFBb0Isa0JBQWtCLENBQUM7QUFBL0IsdUNBQStCO0FBQ3ZDLGdDQUFxQixtQkFBbUIsQ0FBQztBQUFqQywwQ0FBaUM7QUFDekMsOEJBQW1CLGlCQUFpQixDQUFDO0FBQTdCLG9DQUE2QjtBQUNyQyw4QkFBbUIsaUJBQWlCLENBQUM7QUFBN0Isb0NBQTZCO0FBQ3JDLDhCQUFtQixpQkFBaUIsQ0FBQztBQUE3QixvQ0FBNkI7QUFDckMsZ0NBQXFCLG1CQUFtQixDQUFDO0FBQWpDLDBDQUFpQztBQUN6QyxnQ0FBcUIsbUJBQW1CLENBQUM7QUFBakMsMENBQWlDIn0=

3
dist/postinstall.js vendored Normal file
View File

@ -0,0 +1,3 @@
"use strict";
var shelljs = require("shelljs");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9zdGluc3RhbGwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9wb3N0aW5zdGFsbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDIn0=

5
dist/smartgit.add.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let add: {
addAll: (dirPathArg: string) => plugins.Q.Promise<{}>;
};

24
dist/smartgit.add.js vendored
View File

@ -1,3 +1,21 @@
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGdpdC5hZGQuanMiLCJzb3VyY2VzQ29udGVudCI6W10sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
var addAll = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.add expects a valid git directory!");
plugins.beautylog.error(err.message);
done.reject(err);
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 = {
addAll: addAll
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuYWRkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFOUMsSUFBSSxNQUFNLEdBQUcsVUFBQyxVQUFpQjtJQUMzQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsSUFBSSxHQUFHLEdBQUcsSUFBSSxLQUFLLENBQUMsNkNBQTZDLENBQUMsQ0FBQztRQUNuRSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDckMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNqQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLDhCQUE4QjtJQUM5QixPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsa0NBQStCLENBQUMsQ0FBQztJQUN2RSxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO0lBQ3pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQztBQUVTLFdBQUcsR0FBRztJQUNiLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUEifQ==

2
dist/smartgit.check.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
declare var _default: (repoArg: any) => boolean;
export = _default;

View File

@ -2,5 +2,4 @@
module.exports = function (repoArg) {
return true;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNoZWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFFQSxpQkFBUyxVQUFTLE9BQU87SUFDckIsTUFBTSxDQUFDLElBQUksQ0FBQztBQUNoQixDQUFDLENBQUMiLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0Z2l0LnBsdWdpbnNcIik7XG5leHBvcnQgPSBmdW5jdGlvbihyZXBvQXJnKSB7XG4gICAgcmV0dXJuIHRydWU7XG59OyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2hlY2suanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jaGVjay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIn0=

9
dist/smartgit.clone.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/// <reference types="q" />
import plugins = require("./smartgit.plugins");
export declare let clone: (optionsArg: {
from: string;
to: string;
key?: string;
keyPath?: string;
keyPassphrase?: string;
}) => plugins.Q.Promise<{}>;

View File

@ -1,25 +1,10 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./smartgit.plugins");
var SmartgitCheck = require("./smartgit.check");
module.exports = function (options) {
exports.clone = function (optionsArg) {
var done = plugins.Q.defer();
/***** URL Checks ******/
if (options.from == "undefined" || options.to == "undefined") {
plugins.beautylog.error("smartgit.clone".blue + " : Something is strange about the way you invoked the function");
return;
}
/***** Path Checks ******/
if (!/^\/.*/.test(options.to)) {
plugins.beautylog.error("It seems that the given path " + options.to + " is not absolute.");
return;
}
plugins.beautylog.log("Now cloning " + options.from);
var cloneOptions = {};
var cloneRepository = plugins.nodegit.Clone(options.from, options.to, cloneOptions);
SmartgitCheck(cloneRepository);
plugins.smartfile.fs.ensureDir(optionsArg.to);
plugins.shelljs.exec("git clone " + optionsArg.from + " " + optionsArg.to);
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNsb25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI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0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9

3
dist/smartgit.commit.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let commit: (dirPathArg: string, commitMessage: string) => plugins.Q.Promise<{}>;

View File

@ -1,10 +1,18 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./smartgit.plugins");
module.exports = function (pathArg, commitMessage) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
var helpers = require("./smartgit.helpers");
exports.commit = function (dirPathArg, commitMessage) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.commit expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFL0MsaUJBQVMsVUFBUyxPQUFjLEVBQUMsYUFBb0I7SUFDakQsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRWxCLENBQUM7QUFDTCxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcG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QztRQUNqQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLHFDQUFxQztJQUNyQyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUsNEJBQXNCLGFBQWEsUUFBSSxDQUFDLENBQUM7SUFDL0UsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=

1
dist/smartgit.helpers.d.ts vendored Normal file
View File

@ -0,0 +1 @@
export declare let isGitDirectory: (dirPathArg: any) => boolean;

11
dist/smartgit.helpers.js vendored Normal file
View 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==

3
dist/smartgit.init.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import plugins = require("./smartgit.plugins");
export declare let init: (dirPathArg: string) => plugins.Q.Promise<{}>;

28
dist/smartgit.init.js vendored
View File

@ -1,17 +1,17 @@
"use strict";
/// <reference path="./typings/main.d.ts" />
var plugins = require("./smartgit.plugins");
module.exports = function () {
var gitinit = function (dest) {
if (dest === void 0) { dest = "undefined"; }
if (dest == "undefined") {
return; // ...and return function here if not
}
var isBare = 0; //lets create a subfolder
plugins.nodegit.Repository.init(dest, isBare).then(function (repo) {
// do something with repo here.
});
};
exports.init = function (dirPathArg) {
var done = plugins.Q.defer();
if (typeof dirPathArg == "undefined") {
var err = new Error("smartgit.init requires an absolute directory path!");
plugins.beautylog.error(err.message);
done.reject("err");
return done.promise;
}
;
plugins.smartfile.fs.ensureDir(dirPathArg);
plugins.shelljs.exec("(cd " + dirPathArg + " && git init)");
done.resolve(dirPathArg);
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DLGlCQUFTO0lBQ0wsSUFBSSxPQUFPLEdBQUcsVUFBUyxJQUF5QjtRQUF6QixvQkFBeUIsR0FBekIsa0JBQXlCO1FBQzVDLEVBQUUsQ0FBQyxDQUFDLElBQUksSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQ3RCLE1BQU0sQ0FBQyxDQUFDLHFDQUFxQztRQUNqRCxDQUFDO1FBQ0QsSUFBSSxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMseUJBQXlCO1FBQ3pDLE9BQU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zIiwic291cmNlc0NvbnRlbnQiOltdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==

8
dist/smartgit.plugins.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
import "typings-global";
export import path = require("path");
export import beautylog = require("beautylog");
export import Q = require("q");
export declare let shelljs: any;
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");
export import smartstring = require("smartstring");

View File

@ -1,8 +1,10 @@
/// <reference path="./typings/main.d.ts" />
"use strict";
require("typings-global");
exports.path = require("path");
exports.beautylog = require("beautylog");
exports.nodegit = require("nodegit");
exports.Q = require("q");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDOztBQUVqQyxZQUFJLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLGlCQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDN0IsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQyIsImZpbGUiOiJzbWFydGdpdC5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuXG5leHBvcnQgbGV0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmV4cG9ydCBsZXQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcbmV4cG9ydCBsZXQgbm9kZWdpdCA9IHJlcXVpcmUoXCJub2RlZ2l0XCIpO1xuZXhwb3J0IGxldCBRID0gcmVxdWlyZShcInFcIik7XG5cblxuIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
exports.shelljs = require("shelljs");
exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath");
exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQTtBQUNWLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNwQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNqQyxtQkFBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDIn0=

3
dist/smartgit.pull.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let pull: (dirPathArg: string, sourceArg?: string, branchArg?: string) => plugins.Q.Promise<{}>;

20
dist/smartgit.pull.js vendored Normal file
View File

@ -0,0 +1,20 @@
"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)) {
var err = new Error("smartgit.pull expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
// if everything is allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git pull " + sourceArg + " " + branchArg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9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUN6QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ==

3
dist/smartgit.push.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let push: (dirPathArg: string, remoteNameArg?: string, remoteBranchArg?: string) => plugins.Q.Promise<{}>;

19
dist/smartgit.push.js vendored Normal file
View File

@ -0,0 +1,19 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.push = function (dirPathArg, remoteNameArg, remoteBranchArg) {
if (remoteNameArg === void 0) { remoteNameArg = ""; }
if (remoteBranchArg === void 0) { remoteBranchArg = ""; }
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.push expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git push " + remoteNameArg + " " + remoteBranchArg + ")");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVzaC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1c2gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFFLGFBQXlCLEVBQUUsZUFBMkI7SUFBdEQsNkJBQXlCLEdBQXpCLGtCQUF5QjtJQUFFLCtCQUEyQixHQUEzQixvQkFBMkI7SUFDeEYsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ3BDLElBQUksR0FBRyxHQUFHLElBQUksS0FBSyxDQUFDLDZDQUE2QyxDQUFDLENBQUM7UUFDbkUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ3JDLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDakIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDeEIsQ0FBQztJQUNELHVDQUF1QztJQUN2QyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxTQUFPLFVBQVUscUJBQWdCLGFBQWEsU0FBSSxlQUFlLE1BQUcsQ0FBQyxDQUFDO0lBQzNGLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9

7
dist/smartgit.remote.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let remote: {
add: (dirPathArg: any, remoteNameArg: string, remoteLinkArg: string) => plugins.Q.Promise<{}>;
list: (dirPathArg: any) => plugins.Q.Promise<{}>;
remove: (dirPathArg: string) => plugins.Q.Promise<{}>;
};

66
dist/smartgit.remote.js vendored Normal file
View File

@ -0,0 +1,66 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
var add = function (dirPathArg, remoteNameArg, remoteLinkArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.remote.add expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
if (!remoteNameArg) {
var err = new Error("smartgit.remote.add expects a valid remote name");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
if (!remoteLinkArg) {
var err = new Error();
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
// if everything is all right proceed
plugins.shelljs.exec("cd " + dirPathArg + " && git remote add " + remoteNameArg + " " + remoteLinkArg);
exports.remote.list(dirPathArg);
done.resolve();
return done.promise;
};
var check = function (dirPathArg, remoteNameArg, remoteLinkArg) {
};
var list = function (dirPathArg) {
var done = plugins.Q.defer();
var remotes = {};
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.remote.list expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
// if everything is all right proceed
plugins.shelljs.exec("cd " + dirPathArg + " && git remote -v").stdout;
done.resolve(remotes);
return done.promise;
};
var remove = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.remote.remove expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
// if everything is all right
};
exports.remote = {
add: add,
list: list,
remove: remove
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucmVtb3RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQucmVtb3RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFOUMsSUFBSSxHQUFHLEdBQUcsVUFBQyxVQUFVLEVBQUMsYUFBb0IsRUFBRSxhQUFvQjtJQUM1RCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUs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BQUM7SUFDdEIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDO0FBRUYsSUFBSSxNQUFNLEdBQUcsVUFBQyxVQUFpQjtJQUMzQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsSUFBSSxHQUFHLEdBQUcsSUFBSSxLQUFLLENBQUMsc0RBQXNELENBQUMsQ0FBQztRQUM1RSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDckMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNqQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLDhCQUE4QjtBQUNsQyxDQUFDLENBQUE7QUFFVSxjQUFNLEdBQUc7SUFDaEIsR0FBRyxFQUFFLEdBQUc7SUFDUixJQUFJLEVBQUUsSUFBSTtJQUNWLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUEifQ==

3
dist/smartgit.status.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as plugins from "./smartgit.plugins";
export declare let status: (dirPathArg: string) => plugins.Q.Promise<{}>;

18
dist/smartgit.status.js vendored Normal file
View File

@ -0,0 +1,18 @@
"use strict";
var plugins = require("./smartgit.plugins");
var helpers = require("./smartgit.helpers");
exports.status = function (dirPathArg) {
var done = plugins.Q.defer();
if (!helpers.isGitDirectory(dirPathArg)) {
var err = new Error("smartgit.status expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
;
// if everything seems allright proceed
plugins.shelljs.exec("(cd " + dirPathArg + " && git status)");
done.resolve();
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuc3RhdHVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQuc3RhdHVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsY0FBTSxHQUFHLFVBQUMsVUFBaUI7SUFDbEMsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztJQUM3QixFQUFFLENBQUEsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQSxDQUFDO1FBQ3BDLElBQUksR0FBRyxHQUFHLElBQUksS0FBSyxDQUFDLCtDQUErQyxDQUFDLENBQUM7UUFDckUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ3JDLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLENBQUM7UUFDakIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDeEIsQ0FBQztJQUFBLENBQUM7SUFDRix1Q0FBdUM7SUFDdkMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsU0FBTyxVQUFVLG9CQUFpQixDQUFDLENBQUM7SUFDekQsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=

View File

@ -1,14 +1,17 @@
{
"name": "smartgit",
"version": "0.0.10",
"description": "an easy wrapper for nodegit",
"version": "0.1.9",
"description": "an easy wrapper for git",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
"cleanTest": "rm -rf test/temp*",
"test": "(npm run cleanTest && npmts)",
"install": "node dist/postinstall.js"
},
"repository": {
"type": "git",
"url": "https://github.com/pushrocks/smartgit.git"
"url": "https://gitlab.com/pushrocks/smartgit.git"
},
"keywords": [
"json",
@ -18,16 +21,22 @@
"author": "Smart Coordination GmbH <office@push.rocks> (https://push.rocks)",
"license": "MIT",
"bugs": {
"url": "https://github.com/pushrocks/smartgit/issues"
"url": "https://gitlab.com/pushrocks/smartgit/issues"
},
"homepage": "https://github.com/pushrocks/smartgit",
"homepage": "https://gitlab.com/pushrocks/smartgit",
"dependencies": {
"beautylog": "^3.1.2",
"nodegit": "^0.12.1",
"q": "^1.4.1"
"@types/minimatch": "*",
"beautylog": "^5.0.13",
"q": "^1.4.1",
"shelljs": "^0.7.0",
"smartfile": "^4.0.10",
"smartpath": "^3.2.2",
"smartstring": "^2.0.10",
"typings-global": "^1.0.5"
},
"devDependencies": {
"npmts": "^4.0.1",
"should": "^8.3.0"
"npmts-g": "^5.2.6",
"should": "^9.0.2",
"typings-test": "^1.0.1"
}
}

2
test/test.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import "typings-test";
import "should";

View File

@ -1,26 +1,93 @@
/// <reference path="../ts/typings/main.d.ts" />
var smartgit = require("../dist/index.js");
var beautylog = require("beautylog");
"use strict";
require("typings-test");
var shelljs = require("shelljs");
var path = require("path");
var should = require("should");
require("should");
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(".clone", function () {
it("should clone a repository", function (done) {
this.timeout(10000);
it("should clone a repository using ssh and sshkey", function (done) {
this.timeout(40000);
smartgit.clone({
from: "https://github.com/pushrocks/docs.git",
to: path.resolve("./test/temp/")
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to: paths.temp
}).then(function () {
done();
});
});
it("should clone a repository using https", function (done) {
this.timeout(40000);
smartgit.clone({
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to: paths.temp2
}).then(function () {
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 () {
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 () {
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(40000);
it("should error for noGit", function () {
smartgit.pull(paths.noGit);
});
it("should pull from origin", function () {
smartgit.pull(paths.temp);
});
});
describe("push", function () {
this.timeout(40000);
it("should error for noGit", function () {
smartgit.push(paths.noGit);
});
it("should push to origin", function () {
smartgit.push(paths.temp, "origin", "master");
});
});
describe("remote", function () {
it("should error for noGit", function () {
smartgit.remote.add(paths.noGit, null, null);
});
it("should error for no remote name", function () {
smartgit.remote.add(paths.temp, null, null);
});
it("should error for no remote link", function () {
smartgit.remote.add(paths.temp, "origin", null);
});
it("should add a remote", function () {
smartgit.remote.add(paths.temp, "origin2", "https://github.com/pushrocks/somerepo");
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzNDLElBQUksU0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XCIpO1xubGV0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmxldCBzaG91bGQgPSByZXF1aXJlKFwic2hvdWxkXCIpO1xuXG5kZXNjcmliZShcInNtYXJ0Z2l0XCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5jbG9uZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgIGl0KFwic2hvdWxkIGNsb25lIGEgcmVwb3NpdG9yeVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcbiAgICAgICAgICAgIHNtYXJ0Z2l0LmNsb25lKHtcbiAgICAgICAgICAgICAgICBmcm9tOlwiaHR0cHM6Ly9naXRodWIuY29tL3B1c2hyb2Nrcy9kb2NzLmdpdFwiLFxuICAgICAgICAgICAgICAgIHRvOnBhdGgucmVzb2x2ZShcIi4vdGVzdC90ZW1wL1wiKVxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9KTtcbiAgICBkZXNjcmliZShcIi5jaGVja1wiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbiAgICBkZXNjcmliZShcImNvbW1pdFwiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbiAgICBkZXNjcmliZShcImluaXRcIixmdW5jdGlvbigpe1xuXG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBSSxPQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0F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BQUM7SUFDSCxRQUFRLENBQUMsUUFBUSxFQUFDO1FBQ2QsRUFBRSxDQUFDLHdCQUF3QixFQUFDO1lBQ3hCLFFBQVEsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLEVBQUMsSUFBSSxFQUFDLElBQUksQ0FBQyxDQUFDO1FBQy9DLENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLGlDQUFpQyxFQUFDO1lBQ2pDLFFBQVEsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUMsSUFBSSxFQUFDLElBQUksQ0FBQyxDQUFDO1FBQzlDLENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLGlDQUFpQyxFQUFDO1lBQ2pDLFFBQVEsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUMsUUFBUSxFQUFDLElBQUksQ0FBQyxDQUFDO1FBQ2xELENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLHFCQUFxQixFQUFDO1lBQ3JCLFFBQVEsQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxJQUFJLEVBQUMsU0FBUyxFQUFDLHVDQUF1QyxDQUFDLENBQUM7UUFDdEYsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLENBQUMsQ0FBQztBQUNQLENBQUMsQ0FBQyxDQUFDIn0=

View File

@ -1,28 +1,94 @@
/// <reference path="../ts/typings/main.d.ts" />
let smartgit = require("../dist/index.js");
let beautylog = require("beautylog");
let path = require("path");
let should = require("should");
import "typings-test";
import beautylog = require("beautylog");
let shelljs = require("shelljs");
import path = require("path");
import "should"
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(".clone",function(){
it("should clone a repository",function(done){
this.timeout(10000);
it("should clone a repository using ssh and sshkey",function(done){
this.timeout(40000);
smartgit.clone({
from:"https://github.com/pushrocks/docs.git",
to:path.resolve("./test/temp/")
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to:paths.temp
}).then(function(){
done();
});
});
it("should clone a repository using https",function(done){
this.timeout(40000);
smartgit.clone({
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to:paths.temp2
}).then(function(){
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(){
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(){
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(40000);
it("should error for noGit",function(){
smartgit.pull(paths.noGit);
});
it("should pull from origin",function(){
smartgit.pull(paths.temp);
})
});
describe("push",function(){
this.timeout(40000);
it("should error for noGit",function(){
smartgit.push(paths.noGit);
});
it("should push to origin",function(){
smartgit.push(paths.temp,"origin","master");
})
});
describe("remote",function(){
it("should error for noGit",function(){
smartgit.remote.add(paths.noGit,null,null);
});
it("should error for no remote name",function(){
smartgit.remote.add(paths.temp,null,null);
});
it("should error for no remote link",function(){
smartgit.remote.add(paths.temp,"origin",null);
});
it("should add a remote",function(){
smartgit.remote.add(paths.temp,"origin2","https://github.com/pushrocks/somerepo");
});
});
});

View File

@ -1,16 +1,10 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
import SmartgitClone = require("./smartgit.clone");
import SmartgitCommit = require("./smartgit.commit");
import SmartgitInit = require("./smartgit.init");
var smartgit:any = {};
smartgit.clone = SmartgitClone;
smartgit.commit = SmartgitCommit;
smartgit.check = SmartgitCheck;
smartgit.init = SmartgitInit;
module.exports = smartgit;
export {add} from "./smartgit.add";
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";
export {status} from "./smartgit.status";

2
ts/postinstall.ts Normal file
View File

@ -0,0 +1,2 @@
let shelljs = require("shelljs");
import beautylog = require("beautylog");

View File

@ -0,0 +1,20 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
let addAll = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.add expects a valid git directory!");
plugins.beautylog.error(err.message);
done.reject(err);
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
}

View File

@ -1,4 +1,3 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartgit.plugins");
export = function(repoArg) {
return true;

View File

@ -1,26 +1,16 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
export = function(options){
export let clone = (optionsArg: {
from: string,
to: string,
key?: string,
keyPath?: string,
keyPassphrase?: string
}) => {
let done = plugins.Q.defer();
/***** URL Checks ******/
if (options.from == "undefined" || options.to == "undefined") {
plugins.beautylog.error("smartgit.clone".blue + " : Something is strange about the way you invoked the function");
return;
}
/***** Path Checks ******/
if (!/^\/.*/.test(options.to)){ //check wether path is absolute
plugins.beautylog.error("It seems that the given path " + options.to + " is not absolute.");
return;
}
plugins.beautylog.log("Now cloning " + options.from);
var cloneOptions:any = {};
var cloneRepository = plugins.nodegit.Clone(options.from, options.to, cloneOptions);
SmartgitCheck(cloneRepository);
plugins.smartfile.fs.ensureDir(optionsArg.to);
plugins.shelljs.exec(`git clone ${optionsArg.from} ${optionsArg.to}`);
done.resolve();
return done.promise;
};
};

View File

@ -1,9 +1,16 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./smartgit.plugins");
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export = function(pathArg:string,commitMessage:string) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
}
export let commit = (dirPathArg:string,commitMessage:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.commit expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
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
View 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;
}
}

View File

@ -1,14 +1,15 @@
/// <reference path="./typings/main.d.ts" />
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
}
var isBare = 0; //lets create a subfolder
plugins.nodegit.Repository.init(dest, isBare).then(function (repo) {
// do something with repo here.
});
export let init = (dirPathArg:string) => {
let done = plugins.Q.defer();
if (typeof dirPathArg == "undefined") { //lets check if a destination is defined...
let err = new Error("smartgit.init requires an absolute directory path!")
plugins.beautylog.error(err.message);
done.reject("err");
return done.promise;
};
}
plugins.smartfile.fs.ensureDir(dirPathArg);
plugins.shelljs.exec(`(cd ${dirPathArg} && git init)`);
done.resolve(dirPathArg);
return done.promise;
};

View File

@ -1,8 +1,8 @@
/// <reference path="./typings/main.d.ts" />
export let path = require("path");
export let beautylog = require("beautylog");
export let nodegit = require("nodegit");
export let Q = require("q");
import "typings-global";
export import path = require("path");
export import beautylog = require("beautylog");
export import Q = require("q");
export let shelljs = require("shelljs");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");
export import smartstring = require("smartstring");

16
ts/smartgit.pull.ts Normal file
View File

@ -0,0 +1,16 @@
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)){
let err = new Error("smartgit.pull expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
// if everything is allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git pull ${sourceArg} ${branchArg})`);
done.resolve(dirPathArg);
return done.promise;
};

16
ts/smartgit.push.ts Normal file
View File

@ -0,0 +1,16 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let push = (dirPathArg:string, remoteNameArg:string = "", remoteBranchArg:string = "") => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.push expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
}
// if everything seems allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git push ${remoteNameArg} ${remoteBranchArg})`);
done.resolve();
return done.promise;
};

65
ts/smartgit.remote.ts Normal file
View File

@ -0,0 +1,65 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
let add = (dirPathArg,remoteNameArg:string, remoteLinkArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.remote.add expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
if(!remoteNameArg) {
let err = new Error("smartgit.remote.add expects a valid remote name");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
if(!remoteLinkArg) {
let err = new Error();
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`cd ${dirPathArg} && git remote add ${remoteNameArg} ${remoteLinkArg}`);
remote.list(dirPathArg);
done.resolve();
return done.promise;
};
let check = (dirPathArg:string, remoteNameArg:string, remoteLinkArg) => {
}
let list = (dirPathArg) => {
let done = plugins.Q.defer();
let remotes = {};
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.remote.list expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
// if everything is all right proceed
plugins.shelljs.exec(`cd ${dirPathArg} && git remote -v`).stdout;
done.resolve(remotes);
return done.promise;
};
let remove = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.remote.remove expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
// if everything is all right
}
export let remote = {
add: add,
list: list,
remove: remove
}

16
ts/smartgit.status.ts Normal file
View File

@ -0,0 +1,16 @@
import * as plugins from "./smartgit.plugins";
import * as helpers from "./smartgit.helpers";
export let status = (dirPathArg:string) => {
let done = plugins.Q.defer();
if(!helpers.isGitDirectory(dirPathArg)){
let err = new Error("smartgit.status expects a valid git directory");
plugins.beautylog.error(err.message);
done.reject(err);
return done.promise;
};
// if everything seems allright proceed
plugins.shelljs.exec(`(cd ${dirPathArg} && git status)`);
done.resolve();
return done.promise;
};

View File

@ -1,7 +0,0 @@
{
"ambientDependencies": {
"colors": "registry:dt/colors#0.6.0-1+20160317120654",
"mocha": "registry:dt/mocha#2.2.5+20160317120654",
"node": "registry:dt/node#4.0.0+20160330064709"
}
}