Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
dffc390637 | |||
ae5b6b5afd | |||
c7f87eebae | |||
63c54ff790 | |||
7670698e84 | |||
7e2481d511 | |||
9ae3acb3d8 | |||
4e12b7ee3b | |||
e07f5717c8 | |||
e0daf85e34 | |||
db27753aac | |||
5d00afcdf0 | |||
011ac2d7b4 | |||
ecede34127 | |||
08fe9e8727 | |||
80806fdca9 | |||
01499cc63a | |||
c8c9d8a407 | |||
527d1b7aa5 | |||
d35fac2278 | |||
776d5b2f23 | |||
f9a3cd4149 | |||
14492ff7a8 | |||
f0cab00277 | |||
6331887373 | |||
98d28a14c5 | |||
76eb47f245 | |||
2b9fa4e8b7 | |||
28845ec1fd | |||
6b8621588d | |||
ae0536d909 | |||
1dbfdeea3c | |||
7e75a788ab | |||
3073fc1f3c | |||
760b5557f3 | |||
1aae44a0ec | |||
53a5a3a805 | |||
c4958baf52 | |||
57f185080c | |||
adce81b084 | |||
bf77c64b78 | |||
072f4960f5 | |||
00f34eb67f |
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,7 @@ node_modules/
|
||||
.settings/
|
||||
.idea/
|
||||
test/temp/
|
||||
test/temp2/
|
||||
coverage/
|
||||
docs/
|
||||
|
||||
@ -10,4 +11,4 @@ npm-debug.log
|
||||
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
ts/typings/
|
||||
ts/typings/
|
||||
|
49
.gitlab-ci.yml
Normal file
49
.gitlab-ci.yml
Normal 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
|
@ -2,6 +2,10 @@ language: node_js
|
||||
node_js:
|
||||
- 4
|
||||
- stable
|
||||
before_install:
|
||||
- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install libstdc++-4.9-dev -y
|
||||
deploy:
|
||||
provider: npm
|
||||
email: npm@lossless.digital
|
||||
|
20
README.md
20
README.md
@ -1,15 +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
|
||||
[](https://travis-ci.org/pushrocks/smartgit)
|
||||
[](https://gitlab.com/pushrocks/smartgit/commits/master)
|
||||
[](https://david-dm.org/pushrocks/smartgit#info=devDependencies)
|
||||
[](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
8
dist/index.d.ts
vendored
Normal 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
30
dist/index.js
vendored
@ -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
3
dist/postinstall.js
vendored
Normal 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
5
dist/smartgit.add.d.ts
vendored
Normal 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
24
dist/smartgit.add.js
vendored
@ -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
2
dist/smartgit.check.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare var _default: (repoArg: any) => boolean;
|
||||
export = _default;
|
3
dist/smartgit.check.js
vendored
3
dist/smartgit.check.js
vendored
@ -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
9
dist/smartgit.clone.d.ts
vendored
Normal 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<{}>;
|
23
dist/smartgit.clone.js
vendored
23
dist/smartgit.clone.js
vendored
@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNsb25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUMvQyxJQUFPLGFBQWEsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRW5ELGlCQUFTLFVBQVMsT0FBTztJQUNyQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLHlCQUF5QjtJQUN6QixFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxJQUFJLFdBQVcsSUFBSSxPQUFPLENBQUMsRUFBRSxJQUFJLFdBQVcsQ0FBQyxDQUFDLENBQUM7UUFDM0QsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFL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ZXR1cm4gZG9uZS5wcm9taXNlO1xufTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQuY2xvbmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGdpdC5jbG9uZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUdwQyxhQUFLLEdBQUcsVUFBQyxVQU1uQjtJQUNHLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsU0FBUyxDQUFDLFVBQVUsQ0FBQyxFQUFFLENBQUMsQ0FBQztJQUM5QyxPQUFPLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxlQUFhLFVBQVUsQ0FBQyxJQUFJLFNBQUksVUFBVSxDQUFDLEVBQUksQ0FBQyxDQUFDO0lBQ3RFLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztJQUNmLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9
|
3
dist/smartgit.commit.d.ts
vendored
Normal file
3
dist/smartgit.commit.d.ts
vendored
Normal 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<{}>;
|
20
dist/smartgit.commit.js
vendored
20
dist/smartgit.commit.js
vendored
@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFL0MsaUJBQVMsVUFBUyxPQUFjLEVBQUMsYUFBb0I7SUFDakQsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRWxCLENBQUM7QUFDTCxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuXG5leHBvcnQgPSBmdW5jdGlvbihwYXRoQXJnOnN0cmluZyxjb21taXRNZXNzYWdlOnN0cmluZykge1xuICAgIHZhciByZXN1bHQg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UsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO0lBQ2YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDIn0=
|
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==
|
3
dist/smartgit.init.d.ts
vendored
Normal file
3
dist/smartgit.init.d.ts
vendored
Normal 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
28
dist/smartgit.init.js
vendored
@ -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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DLGlCQUFTO0lBQ0wsSUFBSSxPQUFPLEdBQUcsVUFBUyxJQUF5QjtRQUF6QixvQkFBeUIsR0FBekIsa0JBQXlCO1FBQzVDLEVBQUUsQ0FBQyxDQUFDLElBQUksSUFBSSxXQUFXLENBQUMsQ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3
dist/smartgit.interfaces.js
vendored
3
dist/smartgit.interfaces.js
vendored
@ -1,3 +0,0 @@
|
||||
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGdpdC5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOltdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
8
dist/smartgit.plugins.d.ts
vendored
Normal file
8
dist/smartgit.plugins.d.ts
vendored
Normal 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");
|
10
dist/smartgit.plugins.js
vendored
10
dist/smartgit.plugins.js
vendored
@ -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
3
dist/smartgit.pull.d.ts
vendored
Normal 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
20
dist/smartgit.pull.js
vendored
Normal 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 + ")");
|
||||
done.resolve(dirPathArg);
|
||||
return done.promise;
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucHVsbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z2l0LnB1bGwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFDOUMsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUVuQyxZQUFJLEdBQUcsVUFBQyxVQUFpQixFQUFDLFNBQXFCLEVBQUUsU0FBcUI7SUFBNUMseUJBQXFCLEdBQXJCLGNBQXFCO0lBQUUseUJBQXFCLEdBQXJCLGNBQXFCO0lBQzdFLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsRUFBRSxDQUFBLENBQUMsQ0FBQyxPQUFPLENBQUMsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUEsQ0FBQztRQUNwQyxJQUFJLEdBQUcsR0FBRyxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFDO1FBQ25FLE9BQU8sQ0FBQyxTQUFTLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNyQyxJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQ2pCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3hCLENBQUM7SUFBQSxDQUFDO0lBQ0Ysb0NBQW9DO0lBQ3BDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFNBQU8sVUFBVSxxQkFBZ0IsU0FBUyxTQUFJLFNBQVMsTUFBRyxDQUFDLENBQUM7SUFDakYsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztJQUN6QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztBQUN4QixDQUFDLENBQUMifQ==
|
3
dist/smartgit.push.d.ts
vendored
Normal file
3
dist/smartgit.push.d.ts
vendored
Normal 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
19
dist/smartgit.push.js
vendored
Normal 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
7
dist/smartgit.remote.d.ts
vendored
Normal 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
66
dist/smartgit.remote.js
vendored
Normal 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRnaXQucmVtb3RlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRnaXQucmVtb3RlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxJQUFZLE9BQU8sV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQzlDLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFOUMsSUFBSSxHQUFHLEdBQUcsVUFBQyxVQUFVLEVBQUMsYUFBb0IsRUFB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MsUUFBTSxVQUFVLHNCQUFtQixDQUFDLENBQUMsTUFBTSxDQUFDO0lBQ2pFLElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUM7SUFDdEIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFDO0FBRUYsSUFBSSxNQUFNLEdBQUcsVUFBQyxVQUFpQjtJQUMzQixJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQzdCLEVBQUUsQ0FBQSxDQUFDLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFBLENBQUM7UUFDcEMsSUFBSSxHQUFHLEdBQUcsSUFBSSxLQUFLLENBQUMsc0RBQXNELENBQUMsQ0FBQztRQUM1RSxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDckMsSUFBSSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNqQixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDO0lBQUEsQ0FBQztJQUNGLDhCQUE4QjtBQUNsQyxDQUFDLENBQUE7QUFFVSxjQUFNLEdBQUc7SUFDaEIsR0FBRyxFQUFFLEdBQUc7SUFDUixJQUFJLEVBQUUsSUFBSTtJQUNWLE1BQU0sRUFBRSxNQUFNO0NBQ2pCLENBQUEifQ==
|
3
dist/smartgit.status.d.ts
vendored
Normal file
3
dist/smartgit.status.d.ts
vendored
Normal 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
18
dist/smartgit.status.js
vendored
Normal 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=
|
5
npmts.json
Normal file
5
npmts.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"mode":"default",
|
||||
"codecov":true,
|
||||
"coverageTreshold":71
|
||||
}
|
31
package.json
31
package.json
@ -1,14 +1,17 @@
|
||||
{
|
||||
"name": "smartgit",
|
||||
"version": "0.0.8",
|
||||
"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": "3.6.10",
|
||||
"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
2
test/test.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
import "typings-test";
|
||||
import "should";
|
89
test/test.js
89
test/test.js
@ -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,eyJ2ZXJzaW9u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JlbmNlIHBhdGg9XCIuLi90cy90eXBpbmdzL21haW4uZC50c1wiIC8+XG5sZXQgc21hcnRnaXQgPSByZXF1aXJlKFwiLi4vZGlzdC9pbmRleC5qc1wiKTtcbmxldCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xubGV0IHBhdGggPSByZXF1aXJlKFwicGF0aFwiKTtcbmxldCBzaG91bGQgPSByZXF1aXJlKFwic2hvdWxkXCIpO1xuXG5kZXNjcmliZShcInNtYXJ0Z2l0XCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5jbG9uZVwiLGZ1bmN0aW9uKCl7XG4gICAgICAgIGl0KFwic2hvdWxkIGNsb25lIGEgcmVwb3NpdG9yeVwiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGhpcy50aW1lb3V0KDEwMDAwKTtcbiAgICAgICAgICAgIHNtYXJ0Z2l0LmNsb25lKHtcbiAgICAgICAgICAgICAgICBmcm9tOlwiaHR0cHM6Ly9naXRodWIuY29tL3B1c2hyb2Nrcy9kb2NzLmdpdFwiLFxuICAgICAgICAgICAgICAgIHRvOnBhdGgucmVzb2x2ZShcIi4vdGVzdC90ZW1wL1wiKVxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICB9KTtcbiAgICBkZXNjcmliZShcIi5jaGVja1wiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbiAgICBkZXNjcmliZShcImNvbW1pdFwiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbiAgICBkZXNjcmliZShcImluaXRcIixmdW5jdGlvbigpe1xuXG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsIn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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");
|
||||
});
|
||||
});
|
||||
});
|
22
ts/index.ts
22
ts/index.ts
@ -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
2
ts/postinstall.ts
Normal file
@ -0,0 +1,2 @@
|
||||
let shelljs = require("shelljs");
|
||||
import beautylog = require("beautylog");
|
@ -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
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./smartgit.plugins");
|
||||
export = function(repoArg) {
|
||||
return true;
|
||||
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
@ -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
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,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;
|
||||
};
|
@ -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
16
ts/smartgit.pull.ts
Normal 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
16
ts/smartgit.push.ts
Normal 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
65
ts/smartgit.remote.ts
Normal 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
16
ts/smartgit.status.ts
Normal 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;
|
||||
};
|
@ -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"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user