diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d033e13
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+.idea/
+coverage/
+docs/
+node_modules
+ts/**/*.js
+ts/**/*.js.map
+ts/typings/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..fb178bb
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,12 @@
+language: node_js
+node_js:
+- '0.11'
+- '0.10'
+deploy:
+ provider: npm
+ email: npm@lossless.digital
+ api_key:
+ secure: oKx1gdYYBnaoUcpxn3WM4SdZdInIYaa3ZgbXLSh88K+PjbcSw3NNbYEnAtWFV1eAQQchDjOHId4D1Ne68DtJb5umahvhYoejtZzawjPaa6Uyi46VPk31wXYzZJyadiyefuwOhLLMM4i3yzYwEC2BeTpbU8Tvaj6B42DoySKNGUnSF9+K2wsFNp13mRje6PLe+fjo+9H4CEKLwf74alwvAWd/PLzv47KKdCZ4/9zX7TxevrIBNie+n6VxjqXm/dTv9k7J3dCunojehBr9X9sn1sd8mR+FexjcgfCA2dz8ViP8qZCslzZixGVuasmjpQH9OabrlOfQ6e+Hs4puv+U7s53SVa9nWntiYHloT29UKCPG6ofuDFq5Nd+1PCNvPfrh99F87IKTOw9DQ9Lx7Q//To4LrbnsC85/uHgkWHhbr/ZGax7wuX9og1rem1MSjYr7gQ1sx9edtDSQe3Yjhi22xDREL5/uCbnThmrd1P44CtAU7UG4TQvnHADFqi4Oogf/VBQvsC+aUJPSfZuoxX31yCYuNToH65j1Vblj9tYuPdHSriPj2OdxbuWh68lpgsh7K64Imb++3oKjh3fKZEzeJsByI+QytyUwO/Qu1c6whlkyv8yMyoaD0WARufU+zcG4P7j4rFlAO/CoezSd6l5HBUiXJNe7XniIi6KZjA1zkZc=
+ on:
+ tags: true
+ repo: pushrocks/smartstring
diff --git a/dist/index.js b/dist/index.js
new file mode 100644
index 0000000..8302516
--- /dev/null
+++ b/dist/index.js
@@ -0,0 +1,8 @@
+///
+var git = require("./smartstring.git");
+var smartstring = {
+ git: git
+};
+module.exports = smartstring;
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFPLEdBQUcsV0FBVyxtQkFBbUIsQ0FBQyxDQUFDO0FBRTFDLElBQUksV0FBVyxHQUFHO0lBQ2QsR0FBRyxFQUFHLEdBQUc7Q0FDWixDQUFDO0FBRUYsaUJBQVMsV0FBVyxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuaW1wb3J0IGdpdCA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLmdpdFwiKTtcblxubGV0IHNtYXJ0c3RyaW5nID0ge1xuICAgIGdpdCA6IGdpdFxufTtcblxuZXhwb3J0ID0gc21hcnRzdHJpbmc7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
diff --git a/dist/smartstring.git.js b/dist/smartstring.git.js
new file mode 100644
index 0000000..2e4357d
--- /dev/null
+++ b/dist/smartstring.git.js
@@ -0,0 +1,57 @@
+///
+var plugins = require("./smartstring.plugins");
+/* ---------------------------------------------- *
+ * ------------------ classes ------------------- *
+ * ---------------------------------------------- */
+var gitRepo = (function () {
+ function gitRepo(stringArg, tokenArg) {
+ var regexMatches = gitRegex(stringArg);
+ this.host = regexMatches[1];
+ this.user = regexMatches[2];
+ this.repo = regexMatches[3];
+ this.accessToken = tokenArg;
+ this.sshUrl = gitLink(this.host, this.user, this.repo, this.accessToken, "ssh");
+ this.httpsUrl = gitLink(this.host, this.user, this.repo, this.accessToken, "https");
+ }
+ ;
+ return gitRepo;
+})();
+/* ---------------------------------------------- *
+ * ------------------ helpers ------------------- *
+ * ---------------------------------------------- */
+var gitRegex = function (stringArg) {
+ var regexString = /(?:git\+|git\@|https\:\/\/|)(?:https\:\/\/|)([^\/|\:]*)(?:\/|:)([^\/]+)*(?:\/|:)([^\.]+)/;
+ var regexMatches = regexString.exec(stringArg);
+ return regexMatches;
+};
+var gitLink = function (hostArg, userArg, repoArg, tokenArg, linkTypeArg) {
+ if (tokenArg === void 0) { tokenArg = ""; }
+ var returnString;
+ if (tokenArg !== "") {
+ tokenArg = tokenArg + "@";
+ }
+ switch (linkTypeArg) {
+ case "https":
+ returnString = "https://" +
+ tokenArg + hostArg + "/" + userArg + "/" + repoArg + ".git";
+ break;
+ case "ssh":
+ returnString = "git@" +
+ hostArg + ":" + userArg + "/" + repoArg + ".git";
+ break;
+ default:
+ plugins.beautylog.error("Link Type " + linkTypeArg + " not known");
+ break;
+ }
+ return returnString;
+};
+/* ---------------------------------------------- *
+ * ------------------ exports ------------------- *
+ * ---------------------------------------------- */
+var git = function (stringArg, tokenArg) {
+ var localGitRepo = new gitRepo(stringArg, tokenArg);
+ return localGitRepo;
+};
+module.exports = git;
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLmdpdC50cyJdLCJuYW1lcyI6WyJnaXRSZXBvIiwiZ2l0UmVwby5jb25zdHJ1Y3RvciJdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLHVCQUF1QixDQUFDLENBQUM7QUFFbEQ7O29EQUVvRDtBQUNwRDtJQU9JQSxpQkFBWUEsU0FBZ0JBLEVBQUNBLFFBQWdCQTtRQUN6Q0MsSUFBSUEsWUFBWUEsR0FBR0EsUUFBUUEsQ0FBQ0EsU0FBU0EsQ0FBQ0EsQ0FBQ0E7UUFDdkNBLElBQUlBLENBQUNBLElBQUlBLEdBQUdBLFlBQVlBLENBQUNBLENBQUNBLENBQUNBLENBQUNBO1FBQzVCQSxJQUFJQSxDQUFDQSxJQ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ICAgICB0b2tlbkFyZyArIGhvc3RBcmcgKyBcIi9cIiArIHVzZXJBcmcgKyBcIi9cIiArIHJlcG9BcmcgKyBcIi5naXRcIjtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICBjYXNlIFwic3NoXCI6XG4gICAgICAgICAgICByZXR1cm5TdHJpbmcgPSBcImdpdEBcIiArXG4gICAgICAgICAgICAgICAgaG9zdEFyZyArIFwiOlwiICsgdXNlckFyZyArIFwiL1wiICsgcmVwb0FyZyArIFwiLmdpdFwiO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICBwbHVnaW5zLmJlYXV0eWxvZy5lcnJvcihcIkxpbmsgVHlwZSBcIiArIGxpbmtUeXBlQXJnICsgXCIgbm90IGtub3duXCIpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgfVxuICAgIHJldHVybiByZXR1cm5TdHJpbmc7XG59O1xuXG4vKiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tICpcbiAqIC0tLS0tLS0tLS0tLS0tLS0tLSBleHBvcnRzIC0tLS0tLS0tLS0tLS0tLS0tLS0gKlxuICogLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSAqL1xubGV0IGdpdCA9IGZ1bmN0aW9uKHN0cmluZ0FyZzpzdHJpbmcsdG9rZW5Bcmc/OnN0cmluZyl7XG4gICAgbGV0IGxvY2FsR2l0UmVwbyA9IG5ldyBnaXRSZXBvKHN0cmluZ0FyZyx0b2tlbkFyZyk7XG4gICAgcmV0dXJuIGxvY2FsR2l0UmVwbztcbn07XG5cbmV4cG9ydCA9IGdpdDsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
diff --git a/dist/smartstring.plugins.js b/dist/smartstring.plugins.js
new file mode 100644
index 0000000..2a8ca9b
--- /dev/null
+++ b/dist/smartstring.plugins.js
@@ -0,0 +1,7 @@
+///
+var plugins = {
+ beautylog: require("beautylog")
+};
+module.exports = plugins;
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7Q0FDbEMsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJzbWFydHN0cmluZy5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHBsdWdpbnMgPSB7XG4gICAgYmVhdXR5bG9nOiByZXF1aXJlKFwiYmVhdXR5bG9nXCIpXG59O1xuXG5leHBvcnQgPSBwbHVnaW5zOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..788348b
--- /dev/null
+++ b/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "smartstring",
+ "version": "0.0.0",
+ "description": "bundles a bunch of (regex) matching and altering methods.",
+ "main": "dist/index.js",
+ "scripts": {
+ "test": "(npmts)"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/pushrocks/smartstring.git"
+ },
+ "keywords": [
+ "regex",
+ "string"
+ ],
+ "author": "Lossless GmbH",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/pushrocks/smartstring/issues"
+ },
+ "homepage": "https://github.com/pushrocks/smartstring#readme",
+ "devDependencies": {
+ "npmts": "^3.1.2",
+ "should": "^8.2.2"
+ },
+ "dependencies": {
+ "beautylog": "^3.0.2"
+ }
+}
diff --git a/test/test.js b/test/test.js
new file mode 100644
index 0000000..899b355
--- /dev/null
+++ b/test/test.js
@@ -0,0 +1,30 @@
+///
+var smartstring = require("../dist/index.js");
+var should = require("should");
+describe("smartstring", function () {
+ describe(".git()", function () {
+ var testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git");
+ it("should return a .host", function () {
+ testGit.host
+ .should.equal("github.com");
+ });
+ it("should return a .user", function () {
+ testGit.user
+ .should.equal("pushrocks");
+ });
+ it("should return a .repo", function () {
+ testGit.repo
+ .should.equal("smartstring");
+ });
+ it("should return a .httpsUrl", function () {
+ testGit.httpsUrl
+ .should.equal("https://github.com/pushrocks/smartstring.git");
+ });
+ it("should return a .sshUrl", function () {
+ testGit.sshUrl
+ .should.equal("git@github.com:pushrocks/smartstring.git");
+ });
+ });
+});
+
+//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxRQUFRLEVBQUM7UUFDZCxJQUFJLE9BQU8sR0FBRyxXQUFXLENBQUMsR0FBRyxDQUFDLGtEQUFrRCxDQUFDLENBQUM7UUFDbEYsRUFBRSxDQUFDLHVCQUF1QixFQUFDO1lBQ3ZCLE9BQU8sQ0FBQyxJQUFJO2lCQUNQLE1BQU0sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDcEMsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQUMsdUJBQXVCLEVBQUM7WUFDdkIsT0FBTyxDQUFDLElBQUk7aUJBQ1AsTUFBTSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0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AgICAgdGVzdEdpdC5ob3N0XG4gICAgICAgICAgICAgICAgLnNob3VsZC5lcXVhbChcImdpdGh1Yi5jb21cIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSAudXNlclwiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0R2l0LnVzZXJcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwicHVzaHJvY2tzXCIpO1xuICAgICAgICB9KTtcbiAgICAgICAgaXQoXCJzaG91bGQgcmV0dXJuIGEgLnJlcG9cIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdEdpdC5yZXBvXG4gICAgICAgICAgICAgICAgLnNob3VsZC5lcXVhbChcInNtYXJ0c3RyaW5nXCIpO1xuICAgICAgICB9KTtcbiAgICAgICAgaXQoXCJzaG91bGQgcmV0dXJuIGEgLmh0dHBzVXJsXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RHaXQuaHR0cHNVcmxcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwiaHR0cHM6Ly9naXRodWIuY29tL3B1c2hyb2Nrcy9zbWFydHN0cmluZy5naXRcIik7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSAuc3NoVXJsXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RHaXQuc3NoVXJsXG4gICAgICAgICAgICAgICAgLnNob3VsZC5lcXVhbChcImdpdEBnaXRodWIuY29tOnB1c2hyb2Nrcy9zbWFydHN0cmluZy5naXRcIik7XG4gICAgICAgIH0pO1xuICAgIH0pXG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
diff --git a/test/test.js.map b/test/test.js.map
new file mode 100644
index 0000000..ed106bc
--- /dev/null
+++ b/test/test.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,QAAQ,EAAC;QACd,IAAI,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAClF,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,uBAAuB,EAAC;YACvB,OAAO,CAAC,IAAI;iBACP,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,2BAA2B,EAAC;YAC3B,OAAO,CAAC,QAAQ;iBACX,MAAM,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,yBAAyB,EAAC;YACzB,OAAO,CAAC,MAAM;iBACT,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/test/test.ts b/test/test.ts
new file mode 100644
index 0000000..257e4a3
--- /dev/null
+++ b/test/test.ts
@@ -0,0 +1,29 @@
+///
+let smartstring = require("../dist/index.js");
+let should = require("should");
+
+describe("smartstring",function(){
+ describe(".git()",function(){
+ let testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git");
+ it("should return a .host",function(){
+ testGit.host
+ .should.equal("github.com");
+ });
+ it("should return a .user",function(){
+ testGit.user
+ .should.equal("pushrocks");
+ });
+ it("should return a .repo",function(){
+ testGit.repo
+ .should.equal("smartstring");
+ });
+ it("should return a .httpsUrl",function(){
+ testGit.httpsUrl
+ .should.equal("https://github.com/pushrocks/smartstring.git");
+ });
+ it("should return a .sshUrl",function(){
+ testGit.sshUrl
+ .should.equal("git@github.com:pushrocks/smartstring.git");
+ });
+ })
+});
\ No newline at end of file
diff --git a/ts/index.ts b/ts/index.ts
new file mode 100644
index 0000000..beaccfe
--- /dev/null
+++ b/ts/index.ts
@@ -0,0 +1,8 @@
+///
+import git = require("./smartstring.git");
+
+let smartstring = {
+ git : git
+};
+
+export = smartstring;
\ No newline at end of file
diff --git a/ts/smartstring.git.ts b/ts/smartstring.git.ts
new file mode 100644
index 0000000..5d95606
--- /dev/null
+++ b/ts/smartstring.git.ts
@@ -0,0 +1,63 @@
+///
+import plugins = require("./smartstring.plugins");
+
+/* ---------------------------------------------- *
+ * ------------------ classes ------------------- *
+ * ---------------------------------------------- */
+class gitRepo {
+ host:string;
+ user:string;
+ repo:string;
+ accessToken:string;
+ sshUrl:string;
+ httpsUrl:string;
+ constructor(stringArg:string,tokenArg?:string){
+ let regexMatches = gitRegex(stringArg);
+ this.host = regexMatches[1];
+ this.user = regexMatches[2];
+ this.repo = regexMatches[3];
+ this.accessToken = tokenArg;
+ this.sshUrl = gitLink(this.host,this.user,this.repo,this.accessToken, "ssh");
+ this.httpsUrl = gitLink(this.host,this.user,this.repo,this.accessToken, "https");
+ };
+}
+
+/* ---------------------------------------------- *
+ * ------------------ helpers ------------------- *
+ * ---------------------------------------------- */
+let gitRegex = function(stringArg:string){
+ let regexString = /(?:git\+|git\@|https\:\/\/|)(?:https\:\/\/|)([^\/|\:]*)(?:\/|:)([^\/]+)*(?:\/|:)([^\.]+)/;
+ let regexMatches = regexString.exec(stringArg);
+ return regexMatches;
+};
+
+let gitLink = function(hostArg:string, userArg:string, repoArg:string, tokenArg:string = "", linkTypeArg):string{
+ let returnString;
+ if (tokenArg !== ""){
+ tokenArg = tokenArg + "@"
+ }
+ switch (linkTypeArg) {
+ case "https":
+ returnString = "https://" +
+ tokenArg + hostArg + "/" + userArg + "/" + repoArg + ".git";
+ break;
+ case "ssh":
+ returnString = "git@" +
+ hostArg + ":" + userArg + "/" + repoArg + ".git";
+ break;
+ default:
+ plugins.beautylog.error("Link Type " + linkTypeArg + " not known");
+ break;
+ }
+ return returnString;
+};
+
+/* ---------------------------------------------- *
+ * ------------------ exports ------------------- *
+ * ---------------------------------------------- */
+let git = function(stringArg:string,tokenArg?:string){
+ let localGitRepo = new gitRepo(stringArg,tokenArg);
+ return localGitRepo;
+};
+
+export = git;
\ No newline at end of file
diff --git a/ts/smartstring.plugins.ts b/ts/smartstring.plugins.ts
new file mode 100644
index 0000000..6c6d0a4
--- /dev/null
+++ b/ts/smartstring.plugins.ts
@@ -0,0 +1,6 @@
+///
+let plugins = {
+ beautylog: require("beautylog")
+};
+
+export = plugins;
\ No newline at end of file
diff --git a/ts/typings.json b/ts/typings.json
new file mode 100644
index 0000000..57323dd
--- /dev/null
+++ b/ts/typings.json
@@ -0,0 +1,7 @@
+{
+ "ambientDependencies": {
+ "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
+ "mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
+ "colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
+ }
+}