Compare commits

...

46 Commits

Author SHA1 Message Date
6cc245ae7e 1.0.11 2019-06-20 14:19:54 +02:00
1377fb6eb7 fix(core): update 2019-06-20 14:19:54 +02:00
daf8c80513 1.0.10 2019-06-20 14:10:42 +02:00
46fce49356 fix(core): update 2019-06-20 14:10:42 +02:00
8616613a95 1.0.9 2019-06-19 14:10:17 +02:00
352e4d8e96 fix(core): update 2019-06-19 14:10:16 +02:00
c2105ce78f 1.0.8 2019-06-19 14:00:44 +02:00
2864fc5507 fix(core): update 2019-06-19 14:00:44 +02:00
fea523ff5c 1.0.7 2019-06-18 15:41:04 +02:00
872f2354c5 fix(core): update 2019-06-18 15:41:03 +02:00
ff0318534f 1.0.6 2019-06-18 15:17:50 +02:00
e103074684 fix(core): update 2019-06-18 15:17:50 +02:00
f72beabd90 remove some white space 2016-12-31 23:20:38 +01:00
958a625633 1.0.5 2016-12-31 23:17:07 +01:00
871fd55c5c fix .addAll 2016-12-31 23:17:03 +01:00
07fd9b9fa7 1.0.4 2016-11-26 23:28:41 +01:00
62d6a8d685 add npmextra.json 2016-11-26 23:28:37 +01:00
047cf02e6a 1.0.3 2016-11-26 23:24:52 +01:00
69127cacdd remove postinstall 2016-11-26 23:24:48 +01:00
7529098a50 1.0.2 2016-11-22 22:22:32 +01:00
15c331690b added some tests 2016-11-22 22:22:24 +01:00
29d176bafa 1.0.1 2016-11-22 21:51:50 +01:00
8763926288 1.0.0 2016-11-22 21:51:38 +01:00
da16094e36 implement new class approach 2016-11-22 21:49:40 +01:00
5fd2b07266 Update README 2016-11-22 00:24:11 +01:00
6618463e0a update 2016-11-22 00:07:36 +01:00
93af3cd0e1 0.1.10 2016-11-21 19:35:02 +01:00
854598ab25 update deps 2016-11-21 19:34:59 +01:00
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
44 changed files with 2875 additions and 502 deletions

30
.gitignore vendored
View File

@ -1,14 +1,22 @@
node_modules/
.settings/
.idea/
test/temp/
test/temp2/
.nogit/
# artifacts
coverage/
docs/
public/
pages/
#npm devug
npm-debug.log
# installs
node_modules/
ts/*.js
ts/*.js.map
ts/typings/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_web/
dist_serve/
dist_ts_web/
# custom

View File

@ -1,49 +1,105 @@
image: hosttoday/ht-docker-node:npmts
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- metadata
before_script:
- npmci prepare ssh
testLEGACY:
stage: test
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci test legacy
- npmci git mirror
tags:
- docker
allow_failure: true
- docker
- notpriv
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLTS:
stage: test
script:
- npmci test lts
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testSTABLE:
stage: test
script:
- npmci test stable
tags:
- docker
- docker
- notpriv
release:
stage: release
script:
- npmci publish
- npmci node install lts
- npmci npm publish
only:
- tags
- tags
tags:
- docker
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
script:
- npmci command npm install -g tslint typescript
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

View File

@ -1,19 +0,0 @@
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
api_key:
secure: o/3H4keWRAvHZaJnUN9UX+hqu+prKGtBsOEWVIaRXUpf6nIHIDm9zlJrS5cv2VUseOZqLAOkzeGYPqlOJlxccy5frKEYMhtCY97BjKvUOf01roL82OGiahw5Bv04NcaBoSepCliyyXihlgZO/5tSoR1seY4ycul2qWLktaEmh8HcTPjem8gB49Svpfk8yPKLpq6cv/sSakt2X24Cq+vfdxYiz7GcgBfv3EVAndUmQ9KMQfkSbq8XgYEZKrLi5kdpXX0y1LRdsbn2rwuMwLOmefCenmQSuBCbYmbOxPgVHHHjVm9To/rhx8YHBCcZSH9go2pdDLwrd7VPOCK+vMHCz/rlASwVM/BGr+aJHCFLAyovrIU7cvbbjLPOUjto6xY2XckMmDBD1YDxYnAJAON1QrdXE9hVVRfMNfaC2leFAwhla1WMok5DcEv+/Q9cUXQCBGQHtBhkhmCCt54ERLFnjXCDZr1icR/0lhtQY54hin5jSHqnU2hTZtTpQX7sF0yZM2sbhTBpV5FTDAGH/ohNWSEnTwAXmL9iwZCTvtWUbBeOUSDRj8BLS54uiaIcIVytNY0p2PdnhwJAWO+4FGjSOT+RuK8RiKzyVXjPiX8TCzaOqBFs947m8SSNMSt6zyqOI27gOSzU7szgsKY769Fl+X9sdzFXaSa72rj4EdvgiBA=
on:
tags: true
repo: pushrocks/smartgit
notifications:
slack:
secure: f5Uss0z9RPl/QcA/DroB8loyE93aOYI6bqCkrsiUscmZtlv/TVQtT4dxqGA6uvcG6iTQDBi3Ul88dQxWkRm4IqbhY35/iMaV2dHW4FVYMAh8GQMbsfL2sALCcufxD9blw47awv3iFcwhV1EeyesscjgL0JIjduk96v/7G/6QIO2838M1lzlgtj+kRUkim8qkaEs1je3gRrhMUIjLuAdscMXyUKYFMjWo9ACSjVUl30R/ZNemb18itIja6i92GotreBgcfEMczvy58ovDC7xdJUsY8LjMI01DwY+WPRnI0tAhsuI8moBwwcdM4e3bAjKjucQRjO33O5bMWRZ6QCiYd0DnCEFyCPQLJ4GSy/tkD00n8ijLHAOSV3AH1zNbdK1EAdSPQXDvlI36KJn/2hyQLoitGHVUPr76ujJWP82ypO2tgIp3XQU0dJVCxDuHnwJO2+hjdI+gCPqxNTpjeujHx3UdkTGNRjuuf9dlZ/D08fApjYxy2fxItTqo3QjP/nrqvBXUOPP8yPHpjIT4H2t5Pr4SJjBGI6X4qhKyFj6s9rA/Xu1rL+45zu1C3uC3z+u3T9UwrbzJ/cZM6r6UQvQmUvIfBNaMlg4I/diQCDIPL+Rhop2nylY3IcHmJnk2itn7kOqj1tohCpFEml5pRuSZy4udWywkdtyBAsHWFLF7oiQ=

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015 Push.Rocks
Copyright (c) 2015 Lossless GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,17 +1,76 @@
# smartgit is an easy wrapper for nodegit
an easy wrapper for nodegit
# @pushrocks/smartgit
smart wrapper for nodegit
### Buildstatus/Dependencies
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartgit)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartgit)
* [github.com (source mirror)](https://github.com/pushrocks/smartgit)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartgit/)
## Status for master
[![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)
[![coverage report](https://gitlab.com/pushrocks/smartgit/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartgit/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartgit.svg)](https://www.npmjs.com/package/@pushrocks/smartgit)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartgit/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartgit)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
### Usage
This plugin exposes some easified method wrappers for nodegit.
This limits options but reduces errors (TypeScript) and speeds up usage.
## Usage
Features:
We recommend the use of TypeScript for best in class intellisense
* easily clone a git repo
* easily create a new git repo
* easily add all changes and make a new commit
```javascript
// import smartgit:
import { GitRepo } from 'smartgit';
// Initialize smartgit:
// -- note: there are 3 ways to initialize smartgit
// -- -- 1. with a existing Git repo
// -- -- 2. with a cloned Git repo
// -- -- 3. with a new Git repo
// -- 1. existing Git Repo:
let myExistingGitRepo = new GitRepo('/path/to/existing/git/repo/');
// -- 2. cloned Git Repo:
let myClonedGitRepo: GitRepo;
smartgit.createRepoFromClone('git@github.com:username/reponame.git').then(gitRepo => {
// non blocking
myClonedGitRepo = gitRepo;
});
// -- 3. new Git Repo
let myNewGitRepo: GitRepo;
smartgit
.createRepoFromInit('/path/to/new/folder') // smartgit will create any new folder, be careful
.then(gitRepo => {
// non blocking
myNewGitRepo = gitRepo;
});
// Using smartgit instance
// -- most used actions
// -- all actions return promises, so make sure to use promise chaining for any dependent tasks
myExistingGitRepo.addAll(); // returns promise, stages all changed files
myExistingGitRepo.add(['relative/path/to/file.txt', 'another/file2.txt']); // returns promise, stages specific files
myExistingGitRepo.commit('my commit message'); // returns promise, commits staged files
myExistingGitRepo
.status() // returns promise
.then(status => {
// Use TypeScript for status type information
});
myExistingGitRepo.check(); // returns promise, checks repo health
myExistingGitRepo.remoteAdd('git@github.com:username/reponame.git');
```
Tip: use [smartssh](https://npmjs.com/smartssh) to setup your SSH environment
[![npm](https://push.rocks/assets/repo-header.svg)](https://push.rocks)
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

2
dist/index.d.ts vendored
View File

@ -1,2 +0,0 @@
import "typings-global";
export { clone } from "./smartgit.clone";

6
dist/index.js vendored
View File

@ -1,6 +0,0 @@
"use strict";
require("typings-global");
var smartgit_clone_1 = require("./smartgit.clone");
exports.clone = smartgit_clone_1.clone;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUVQLENBQUMsQ0FGc0I7QUFJdkIsK0JBQW9CLGtCQUFrQixDQUFDO0FBQS9CLHVDQUErQiIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcblxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuaW1wb3J0IFNtYXJ0Z2l0Q2hlY2sgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5jaGVja1wiKTtcbmV4cG9ydCB7Y2xvbmV9IGZyb20gXCIuL3NtYXJ0Z2l0LmNsb25lXCI7XG5pbXBvcnQgU21hcnRnaXRDb21taXQgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5jb21taXRcIik7XG5pbXBvcnQgU21hcnRnaXRJbml0ID0gcmVxdWlyZShcIi4vc21hcnRnaXQuaW5pdFwiKTtcblxuXG4iXX0=

View File

@ -1,5 +0,0 @@
import "typings-global";
export declare let pull: (optionsArg: {
path: string;
ref?: string;
}) => void;

10
dist/smartgit.add.js vendored
View File

@ -1,10 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./smartgit.plugins");
exports.pull = function (optionsArg) {
if (!optionsArg.ref)
optionsArg.ref = "master";
plugins.nodegit.Repository.open(optionsArg.path);
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmFkZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFbkMsWUFBSSxHQUFHLFVBQUMsVUFBb0M7SUFDbkQsRUFBRSxDQUFBLENBQUMsQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDO1FBQUMsVUFBVSxDQUFDLEdBQUcsR0FBRyxRQUFRLENBQUM7SUFDOUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUNyRCxDQUFDLENBQUEiLCJmaWxlIjoic21hcnRnaXQuYWRkLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcbmltcG9ydCAqIGFzIHBsdWdpbnMgZnJvbSBcIi4vc21hcnRnaXQucGx1Z2luc1wiO1xuXG5leHBvcnQgbGV0IHB1bGwgPSAob3B0aW9uc0FyZzp7cGF0aDpzdHJpbmcscmVmPzpzdHJpbmd9KSA9PiB7XG4gICAgaWYoIW9wdGlvbnNBcmcucmVmKSBvcHRpb25zQXJnLnJlZiA9IFwibWFzdGVyXCI7XG4gICAgcGx1Z2lucy5ub2RlZ2l0LlJlcG9zaXRvcnkub3BlbihvcHRpb25zQXJnLnBhdGgpO1xufVxuIl19

View File

@ -1,3 +0,0 @@
import "typings-global";
declare var _default: (repoArg: any) => boolean;
export = _default;

View File

@ -1,7 +0,0 @@
"use strict";
require("typings-global");
module.exports = function (repoArg) {
return true;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNoZWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsaUJBQVMsVUFBUyxPQUFPO0lBQ3JCLE1BQU0sQ0FBQyxJQUFJLENBQUM7QUFDaEIsQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0Z2l0LmNoZWNrLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuZXhwb3J0ID0gZnVuY3Rpb24ocmVwb0FyZykge1xuICAgIHJldHVybiB0cnVlO1xufTsiXX0=

View File

@ -1,7 +0,0 @@
import "typings-global";
export declare let clone: (optionsArg: {
from: string;
to: string;
keyPath?: string;
keyPassphrase?: string;
}) => any;

View File

@ -1,42 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./smartgit.plugins");
var SmartgitCheck = require("./smartgit.check");
exports.clone = function (optionsArg) {
var done = plugins.Q.defer();
/***** URL Checks ******/
//TODO make smartstring URL test
/***** Path Checks ******/
if (!/^\/.*/.test(optionsArg.to)) {
plugins.beautylog.error("It seems that the given path " + optionsArg.to + " is not absolute.");
return;
}
plugins.beautylog.log("Now cloning " + optionsArg.from);
var cloneOptions = {
fetchOpts: {
callbacks: {
certificateCheck: function () { return 1; },
credentials: function (url, userName) {
var gitRepo = new plugins.smartstring.GitRepo(url);
var host = gitRepo.host;
var sshDir = plugins.path.join(plugins.smartpath.get.home(), ".ssh/");
var pubKeyPath = plugins.path.join(sshDir, host + ".pub");
var privKeyPath = plugins.path.join(sshDir, host);
if (!optionsArg.keyPassphrase)
optionsArg.keyPassphrase = "";
return plugins.nodegit.Cred.sshKeyNew(userName, pubKeyPath, privKeyPath, optionsArg.keyPassphrase);
}
}
}
};
var cloneRepository = plugins.nodegit.Clone.clone(optionsArg.from, optionsArg.to, cloneOptions)
.then(function () {
SmartgitCheck(cloneRepository);
done.resolve();
}, function (err) {
console.log(err);
});
return done.promise;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNsb25lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFDdkIsSUFBTyxPQUFPLFdBQVcsb0JBQW9CLENBQUMsQ0FBQztBQUMvQyxJQUFPLGFBQWEsV0FBVyxrQkFBa0IsQ0FBQyxDQUFDO0FBRXhDLG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pID0+IHtcbiAgICAgICAgICAgIGNvbnNvbGUubG9nKGVycik7XG4gICAgICAgIH0pO1xuICAgIHJldHVybiBkb25lLnByb21pc2U7XG59OyJdfQ==

View File

@ -1,3 +0,0 @@
import "typings-global";
declare var _default: (pathArg: string, commitMessage: string) => void;
export = _default;

View File

@ -1,10 +0,0 @@
"use strict";
require("typings-global");
var plugins = require("./smartgit.plugins");
module.exports = function (pathArg, commitMessage) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
}
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmNvbW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ3ZCLElBQU8sT0FBTyxXQUFXLG9CQUFvQixDQUFDLENBQUM7QUFFL0MsaUJBQVMsVUFBUyxPQUFjLEVBQUMsYUFBb0I7SUFDakQsSUFBSSxNQUFNLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0lBQ3RELEVBQUUsQ0FBQyxDQUFDLE1BQU0sSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRWxCLENBQUM7QUFDTCxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRnaXQuY29tbWl0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIlxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9zbWFydGdpdC5wbHVnaW5zXCIpO1xuXG5leHBvcnQgPSBmdW5jdGlvbihwYXRoQXJnOnN0cmluZyxjb21taXRNZXNzYWdlOnN0cmluZykge1xuICAgIHZhciByZXN1bHQgPSBwbHVnaW5zLm5vZGVnaXQuaW5kZXguYWRkQnlQYXRoKHBhdGhBcmcpO1xuICAgIGlmIChyZXN1bHQgPT0gMCkge1xuICAgICAgICBcbiAgICB9XG59OyJdfQ==

View File

@ -1,3 +0,0 @@
import "typings-global";
declare var _default: () => void;
export = _default;

17
dist/smartgit.init.js vendored
View File

@ -1,17 +0,0 @@
"use strict";
require("typings-global");
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.
});
};
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmluaXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUN2QixJQUFPLE9BQU8sV0FBVyxvQkFBb0IsQ0FBQyxDQUFDO0FBRS9DLGlCQUFTO0lBQ0wsSUFBSSxPQUFPLEdBQUcsVUFBUyxJQUF5QjtRQUF6QixvQkFBeUIsR0FBekIsa0JBQXlCO1FBQzVDLEVBQUUsQ0FBQyxDQUFDLElBQUksSUFBSSxXQUFXLENBQUMsQ0FBQyxDQUFDO1lBQ3RCLE1BQU0sQ0FBQyxDQUFDLHFDQUFxQztRQUNqRCxDQUFDO1FBQ0QsSUFBSSxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMseUJBQXlCO1FBQ3pDLE9BQU8sQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLEVBQUUsTUFBTSxDQUFDLENBQUMsSUFBSSxDQUFDLFVBQVUsSUFBSTtZQUM3RCwrQkFBK0I7UUFDbkMsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLENBQUM7QUFDTixDQUFDLENBQUEiLCJmaWxlIjoic21hcnRnaXQuaW5pdC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcbmltcG9ydCBwbHVnaW5zID0gcmVxdWlyZShcIi4vc21hcnRnaXQucGx1Z2luc1wiKTtcblxuZXhwb3J0ID0gZnVuY3Rpb24oKXtcbiAgICB2YXIgZ2l0aW5pdCA9IGZ1bmN0aW9uKGRlc3Q6c3RyaW5nID0gXCJ1bmRlZmluZWRcIikge1xuICAgICAgICBpZiAoZGVzdCA9PSBcInVuZGVmaW5lZFwiKSB7IC8vbGV0cyBjaGVjayBpZiBhIGRlc3RpbmF0aW9uIGlzIGRlZmluZWQuLi5cbiAgICAgICAgICAgIHJldHVybjsgLy8gLi4uYW5kIHJldHVybiBmdW5jdGlvbiBoZXJlIGlmIG5vdFxuICAgICAgICB9XG4gICAgICAgIHZhciBpc0JhcmUgPSAwOyAvL2xldHMgY3JlYXRlIGEgc3ViZm9sZGVyXG4gICAgICAgIHBsdWdpbnMubm9kZWdpdC5SZXBvc2l0b3J5LmluaXQoZGVzdCwgaXNCYXJlKS50aGVuKGZ1bmN0aW9uIChyZXBvKSB7XG4gICAgICAgICAgICAvLyBkbyBzb21ldGhpbmcgd2l0aCByZXBvIGhlcmUuXG4gICAgICAgIH0pO1xuICAgIH07XG59Il19

View File

@ -1 +0,0 @@
import "typings-global";

View File

@ -1,4 +0,0 @@
"use strict";
require("typings-global");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LmludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBRCIsImZpbGUiOiJzbWFydGdpdC5pbnRlcmZhY2VzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIiJdfQ==

View File

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

View File

@ -1,11 +0,0 @@
"use strict";
require("typings-global");
exports.path = require("path");
exports.beautylog = require("beautylog");
exports.nodegit = require("nodegit");
exports.Q = require("q");
exports.smartfile = require("smartfile");
exports.smartpath = require("smartpath");
exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0Z2l0LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBRVAsQ0FBQyxDQUZzQjtBQUVULFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ3BDLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDN0IsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNkLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNqQyxtQkFBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0Z2l0LnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXG5cbmV4cG9ydCBpbXBvcnQgcGF0aCA9IHJlcXVpcmUoXCJwYXRoXCIpO1xuZXhwb3J0IGltcG9ydCBiZWF1dHlsb2cgPSByZXF1aXJlKFwiYmVhdXR5bG9nXCIpO1xuZXhwb3J0IGxldCBub2RlZ2l0ID0gcmVxdWlyZShcIm5vZGVnaXRcIik7XG5leHBvcnQgbGV0IFEgPSByZXF1aXJlKFwicVwiKTtcbmV4cG9ydCBpbXBvcnQgc21hcnRmaWxlID0gcmVxdWlyZShcInNtYXJ0ZmlsZVwiKTtcbmV4cG9ydCBpbXBvcnQgc21hcnRwYXRoID0gcmVxdWlyZShcInNtYXJ0cGF0aFwiKTtcbmV4cG9ydCBpbXBvcnQgc21hcnRzdHJpbmcgPSByZXF1aXJlKFwic21hcnRzdHJpbmdcIik7XG5cblxuIl19

View File

View File

@ -1,3 +0,0 @@
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJzbWFydGdpdC5wdWxsLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ==

View File

@ -1,90 +0,0 @@
/// <reference path="./index.ts" />
var SmartgitPlugins;
(function (SmartgitPlugins) {
SmartgitPlugins.init = function () {
var plugins = {
path: require("path"),
beautylog: require("beautylog"),
nodegit: require("nodegit"),
Q: require("q")
};
return plugins;
};
})(SmartgitPlugins || (SmartgitPlugins = {}));
/// <reference path="./index.ts" />
var SmartgitClone;
(function (SmartgitClone) {
function init() {
var clone = function (options) {
/***** 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);
smartgit.check(cloneRepository);
};
return clone;
}
SmartgitClone.init = init;
})(SmartgitClone || (SmartgitClone = {}));
/// <reference path="./index.ts" />
var SmartgitInit;
(function (SmartgitInit) {
SmartgitInit.init = 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.
});
};
return gitinit;
};
})(SmartgitInit || (SmartgitInit = {}));
/// <reference path="./index.ts" />
var SmartgitCommit;
(function (SmartgitCommit) {
SmartgitCommit.init = function () {
var commit = function (pathArg, commitMessage) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
}
};
return commit;
};
})(SmartgitCommit || (SmartgitCommit = {}));
/// <reference path="./index.ts" />
var SmartgitCheck;
(function (SmartgitCheck) {
SmartgitCheck.init = function () {
var check = function () {
return true;
};
return check;
};
})(SmartgitCheck || (SmartgitCheck = {}));
/// <reference path="typings/tsd.d.ts" />
/// <reference path="smartgit.plugins.ts" />
/// <reference path="smartgit.clone.ts" />
/// <reference path="smartgit.init.ts" />
/// <reference path="smartgit.commit.ts" />
/// <reference path="smartgit.check.ts" />
var plugins = SmartgitPlugins.init();
//Build the smartgit object
var smartgit = {};
smartgit.clone = SmartgitClone.init();
smartgit.commit = SmartgitCommit.init();
smartgit.check = SmartgitCheck.init();
smartgit.init = SmartgitInit.init();
module.exports = smartgit;

22
npmextra.json Normal file
View File

@ -0,0 +1,22 @@
{
"npmts": {
"mode": "default",
"codecov": true,
"coverageTreshold": 71
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"gitzone": {
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smartgit",
"shortDescription": "smart wrapper for nodegit",
"npmPackagename": "@pushrocks/smartgit",
"license": "MIT"
}
}
}

View File

@ -1,5 +0,0 @@
{
"mode":"default",
"codecov":true,
"coverageTreshold":71
}

2535
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,16 @@
{
"name": "smartgit",
"version": "0.1.1",
"description": "an easy wrapper for nodegit",
"name": "@pushrocks/smartgit",
"version": "1.0.11",
"description": "smart wrapper for nodegit",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild)"
},
"repository": {
"type": "git",
"url": "https://github.com/pushrocks/smartgit.git"
"url": "https://gitlab.com/pushrocks/smartgit.git"
},
"keywords": [
"json",
@ -19,21 +20,35 @@
"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": "^5.0.12",
"nodegit": "^0.14.1",
"q": "^1.4.1",
"smartfile": "^4.0.5",
"smartpath": "^3.2.2",
"smartstring": "^2.0.10",
"typings-global": "^1.0.3"
"@pushrocks/smartfile": "^7.0.2",
"@pushrocks/smartpath": "^4.0.1",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartshell": "^2.0.23",
"@pushrocks/smartstring": "^3.0.10",
"@types/minimatch": "^3.0.3",
"@types/nodegit": "^0.24.8",
"nodegit": "^0.24.3"
},
"devDependencies": {
"npmts-g": "^5.2.6",
"should": "^9.0.2",
"typings-test": "^1.0.1"
}
"@gitzone/tsbuild": "^2.1.11",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.9",
"tslint": "^5.17.0",
"tslint-config-prettier": "^1.18.0"
},
"private": false,
"files": [
"ts/*",
"ts_web/*",
"dist/*",
"dist_web/*",
"assets/*",
"cli.js",
"npmextra.json",
"readme.md"
]
}

View File

@ -1,9 +0,0 @@
/// <reference path="typings/tsd.d.ts" />
var smartgit = require("./index.js");
var beautylog = require("beautylog");
var path = require("path");
smartgit.clone({
from: "https://github.com/pushrocks/docs.git",
to: path.resolve("./test/temp/")
});
beautylog.success("Test successfull");

2
test/test.d.ts vendored
View File

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

View File

@ -1,35 +0,0 @@
"use strict";
require("typings-test");
var path = require("path");
require("should");
var smartgit = require("../dist/index");
describe("smartgit", function () {
describe(".clone", function () {
it("should clone a repository using ssh and sshkey", function (done) {
this.timeout(10000);
smartgit.clone({
from: "git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to: path.resolve("./test/temp/")
}).then(function () {
done();
});
});
it("should clone a repository using https", function (done) {
this.timeout(10000);
smartgit.clone({
from: "https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to: path.resolve("./test/temp2/")
}).then(function () {
done();
});
});
});
describe(".check", function () {
});
describe("commit", function () {
});
describe("init", function () {
});
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFFdEIsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsUUFBTyxRQUVQLENBQUMsQ0FGYztBQUVmLElBQU8sUUFBUSxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBRTNDLFFBQVEsQ0FBQyxVQUFVLEVBQUM7SUFDaEIsUUFBUSxDQUFDLFFBQVEsRUFBQztRQUNkLEVBQUUsQ0FBQyxnREFBZ0QsRUFBQyxVQUFTLElBQUk7WUFDN0QsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQztZQUNwQixRQUFRLENBQUMsS0FBSyxDQUFDO2dCQUNYLElBQUksRUFBQyxpREFBaUQ7Z0JBQ3RELEVBQUUsRUFBQyxJQUFJLENBQUMsT0FBTyxDQUFDLGNBQWMsQ0FBQzthQUNsQyxDQUFDLENBQUMsSUFBSSxDQUFDO2dCQUNKLElBQUksRUFBRSxDQUFDO1lBQ1gsQ0FBQyxDQUFDLENBQUM7UUFDUCxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyx1Q0FBdUMsRUFBQyxVQUFTLElBQUk7WUFDcEQsSUFBSSxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQztZQUNwQixRQUFRLENBQUMsS0FBSyxDQUFDO2dCQUNYLElBQUksRU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W5kYm94LXRlc3RyZXBvLmdpdFwiLFxuICAgICAgICAgICAgICAgIHRvOnBhdGgucmVzb2x2ZShcIi4vdGVzdC90ZW1wL1wiKVxuICAgICAgICAgICAgfSkudGhlbihmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgaXQoXCJzaG91bGQgY2xvbmUgYSByZXBvc2l0b3J5IHVzaW5nIGh0dHBzXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoMTAwMDApO1xuICAgICAgICAgICAgc21hcnRnaXQuY2xvbmUoe1xuICAgICAgICAgICAgICAgIGZyb206XCJodHRwczovL2dpdGxhYi5jb20vc2FuZGJveHpvbmUvc2FuZGJveC10ZXN0cmVwby5naXRcIixcbiAgICAgICAgICAgICAgICB0bzpwYXRoLnJlc29sdmUoXCIuL3Rlc3QvdGVtcDIvXCIpXG4gICAgICAgICAgICB9KS50aGVuKGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiLmNoZWNrXCIsZnVuY3Rpb24oKXtcblxuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiY29tbWl0XCIsZnVuY3Rpb24oKXtcblxuICAgIH0pO1xuICAgIGRlc2NyaWJlKFwiaW5pdFwiLGZ1bmN0aW9uKCl7XG5cbiAgICB9KTtcbn0pOyJdfQ==

View File

@ -1 +0,0 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC3C,IAAI,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACrC,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,UAAU,EAAC;IAChB,QAAQ,CAAC,QAAQ,EAAC;QACd,EAAE,CAAC,2BAA2B,EAAC,UAAS,IAAI;YACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,QAAQ,CAAC,KAAK,CAAC;gBACX,IAAI,EAAC,uCAAuC;gBAC5C,EAAE,EAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;aAClC,CAAC,CAAC,IAAI,CAAC;gBACJ,IAAI,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAC;IAElB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,EAAC;IAElB,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,MAAM,EAAC;IAEhB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1,38 +1,12 @@
import "typings-test";
import beautylog = require("beautylog");
import path = require("path");
import "should"
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartgit from '../ts/index';
import smartgit = require("../dist/index");
import * as path from 'path';
describe("smartgit",function(){
describe(".clone",function(){
it("should clone a repository using ssh and sshkey",function(done){
this.timeout(10000);
smartgit.clone({
from:"git@gitlab.com:sandboxzone/sandbox-testrepo.git",
to:path.resolve("./test/temp/")
}).then(function(){
done();
});
});
it("should clone a repository using https",function(done){
this.timeout(10000);
smartgit.clone({
from:"https://gitlab.com/sandboxzone/sandbox-testrepo.git",
to:path.resolve("./test/temp2/")
}).then(function(){
done();
});
});
});
describe(".check",function(){
const testRepoDir = path.join(__dirname, '../.nogit/testrepo');
});
describe("commit",function(){
tap.test('should create a new repo at .nogit', async () => {
const gitRepo = await smartgit.GitRepo.fromCreatingRepoInDir(testRepoDir);
})
});
describe("init",function(){
});
});
tap.start();

View File

@ -1,9 +1,3 @@
import "typings-global"
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
export {clone} from "./smartgit.clone";
import SmartgitCommit = require("./smartgit.commit");
import SmartgitInit = require("./smartgit.init");
import plugins = require('./smartgit.plugins');
export * from './smartgit.classes.gitrepo';

View File

@ -1,7 +0,0 @@
import "typings-global";
import * as plugins from "./smartgit.plugins";
export let pull = (optionsArg:{path:string,ref?:string}) => {
if(!optionsArg.ref) optionsArg.ref = "master";
plugins.nodegit.Repository.open(optionsArg.path);
}

View File

@ -1,5 +0,0 @@
import "typings-global"
import plugins = require("./smartgit.plugins");
export = function(repoArg) {
return true;
};

View File

@ -0,0 +1,73 @@
import * as plugins from './smartgit.plugins';
/**
* class GitRepo allows access to git directories from node
*/
export class GitRepo {
// STATIC
/**
* creates a new GitRepo Instance after cloning a project
*/
public static async fromCloningIntoDir(fromArg: string, toArg: string): Promise<GitRepo> {
const dirArg = plugins.path.resolve(toArg);
const ngRespository = await plugins.nodegit.Clone.clone(fromArg, toArg, {
bare: 0,
checkoutBranch: 'master'
});
return new GitRepo(ngRespository);
}
public static async fromCreatingRepoInDir(dirArg: string): Promise<GitRepo> {
dirArg = plugins.path.resolve(dirArg);
const ngRepository = await plugins.nodegit.Repository.init(dirArg, 0);
return new GitRepo(ngRepository);
}
public static async fromOpeningRepoDir(dirArg: string) {
dirArg = plugins.path.resolve(dirArg);
const ngRepository = await plugins.nodegit.Repository.open(dirArg);
return new GitRepo(ngRepository);
}
// INSTANCE
public nodegitRepo: plugins.nodegit.Repository;
constructor(nodegitRepoArg: plugins.nodegit.Repository) {
this.nodegitRepo = nodegitRepoArg;
}
/**
* lists remotes
*/
public async listRemotes(): Promise<string[]> {
return this.nodegitRepo.getRemotes();
}
public async ensureRemote(remoteNameArg: string, remoteUrlArg: string): Promise<void> {
const existingUrl = await this.getUrlForRemote(remoteNameArg);
if (existingUrl === remoteUrlArg) {
return;
}
if (existingUrl) {
await plugins.nodegit.Remote.delete(this.nodegitRepo, remoteNameArg);
}
await plugins.nodegit.Remote.create(this.nodegitRepo, remoteNameArg, remoteUrlArg);
}
/**
* gets the url for a specific remote
*/
public async getUrlForRemote(remoteName: string): Promise<string> {
const ngRemote = await this.nodegitRepo.getRemote(remoteName);
if (ngRemote) {
return ngRemote.url();
} else {
return null;
}
}
public async pushBranchToRemote(branchName: string, remoteName: string) {
await this.nodegitRepo.checkoutBranch(branchName);
const ngRemote = await this.nodegitRepo.getRemote(remoteName);
ngRemote.push([branchName]);
}
}

View File

@ -1,46 +0,0 @@
import "typings-global"
import plugins = require("./smartgit.plugins");
import SmartgitCheck = require("./smartgit.check");
export let clone = (optionsArg:{
from:string,
to:string,
keyPath?:string,
keyPassphrase?:string
}) => {
let done = plugins.Q.defer();
/***** URL Checks ******/
//TODO make smartstring URL test
/***** Path Checks ******/
if (!/^\/.*/.test(optionsArg.to)){ //check wether path is absolute
plugins.beautylog.error("It seems that the given path " + optionsArg.to + " is not absolute.");
return;
}
plugins.beautylog.log("Now cloning " + optionsArg.from);
var cloneOptions:any = {
fetchOpts: {
callbacks: {
certificateCheck: function() { return 1; },
credentials: function(url, userName) {
let gitRepo = new plugins.smartstring.GitRepo(url);
let host = gitRepo.host;
let sshDir = plugins.path.join(plugins.smartpath.get.home(),".ssh/")
let pubKeyPath = plugins.path.join(sshDir,host + ".pub");
let privKeyPath:string = plugins.path.join(sshDir,host);
if(!optionsArg.keyPassphrase) optionsArg.keyPassphrase = "";
return plugins.nodegit.Cred.sshKeyNew(userName, pubKeyPath, privKeyPath,optionsArg.keyPassphrase);
}
}
}
};
var cloneRepository = plugins.nodegit.Clone.clone(optionsArg.from, optionsArg.to, cloneOptions)
.then(() => {
SmartgitCheck(cloneRepository);
done.resolve();
},(err) => {
console.log(err);
});
return done.promise;
};

View File

@ -1,9 +0,0 @@
import "typings-global"
import plugins = require("./smartgit.plugins");
export = function(pathArg:string,commitMessage:string) {
var result = plugins.nodegit.index.addByPath(pathArg);
if (result == 0) {
}
};

View File

@ -1,14 +0,0 @@
import "typings-global"
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.
});
};
}

View File

@ -1 +0,0 @@
import "typings-global"

View File

@ -1,11 +1,16 @@
import "typings-global"
// node native
import * as path from 'path';
export import path = require("path");
export import beautylog = require("beautylog");
export let nodegit = require("nodegit");
export let Q = require("q");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");
export import smartstring = require("smartstring");
export { path };
import * as smartfile from '@pushrocks/smartfile';
import * as smartpath from '@pushrocks/smartpath';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartstring from '@pushrocks/smartstring';
export { smartfile, smartpath, smartpromise, smartstring };
// third party
import nodegit from 'nodegit';
export { nodegit };

View File

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}