now correctly parsing a Domain

This commit is contained in:
Philipp Kunz 2016-05-25 05:06:19 +02:00
parent 6a1fb1ec50
commit bd4de36143
22 changed files with 176 additions and 62 deletions

5
dist/index.d.ts vendored
View File

@ -1,6 +1,7 @@
import SmartstringGit = require("./smartstring.git"); import "typings-global";
import SmartstringDocker = require("./smartstring.docker"); import SmartstringDocker = require("./smartstring.docker");
import SmartstringTypescript = require("./smartstring.typescript"); import SmartstringTypescript = require("./smartstring.typescript");
export declare let git: (stringArg: string, tokenArg?: string) => SmartstringGit.gitRepo; export { Domain } from "./smartstring.domain";
export { GitRepo } from "./smartstring.git";
export declare let docker: typeof SmartstringDocker; export declare let docker: typeof SmartstringDocker;
export declare let typescript: typeof SmartstringTypescript; export declare let typescript: typeof SmartstringTypescript;

10
dist/index.js vendored
View File

@ -1,10 +1,12 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var SmartstringGit = require("./smartstring.git");
var SmartstringDocker = require("./smartstring.docker"); var SmartstringDocker = require("./smartstring.docker");
var SmartstringTypescript = require("./smartstring.typescript"); var SmartstringTypescript = require("./smartstring.typescript");
exports.git = SmartstringGit.git; var smartstring_domain_1 = require("./smartstring.domain");
exports.Domain = smartstring_domain_1.Domain;
var smartstring_git_1 = require("./smartstring.git");
exports.GitRepo = smartstring_git_1.GitRepo;
exports.docker = SmartstringDocker; exports.docker = SmartstringDocker;
exports.typescript = SmartstringTypescript; exports.typescript = SmartstringTypescript;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxjQUFjLFdBQVcsbUJBQW1CLENBQUMsQ0FBQztBQUNyRCxJQUFPLGlCQUFpQixXQUFXLHNCQUFzQixDQUFDLENBQUM7QUFDM0QsSUFBTyxxQkFBcUIsV0FBVywwQkFBMEIsQ0FBQyx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FBTSxHQUFHLGlCQUFpQixDQUFDO0FBQzNCLGtCQUFVLEdBQUcscUJBQXFCLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXHJcbmltcG9ydCBTbWFydHN0cmluZ0RvY2tlciA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLmRvY2tlclwiKTtcclxuaW1wb3J0IFNtYXJ0c3RyaW5nVHlwZXNjcmlwdCA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLnR5cGVzY3JpcHRcIik7XHJcblxyXG5leHBvcnQge0RvbWFpbn0gZnJvbSBcIi4vc21hcnRzdHJpbmcuZG9tYWluXCI7XHJcbmV4cG9ydCB7R2l0UmVwb30gZnJvbSBcIi4vc21hcnRzdHJpbmcuZ2l0XCI7XHJcbmV4cG9ydCBsZXQgZG9ja2VyID0gU21hcnRzdHJpbmdEb2NrZXI7XHJcbmV4cG9ydCBsZXQgdHlwZXNjcmlwdCA9IFNtYXJ0c3RyaW5nVHlwZXNjcmlwdDsiXX0=

View File

@ -1,3 +1,4 @@
import "typings-global";
/** /**
* converts an erray of env strings from docker remote api to an usable object. * converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg * @param envArrayArg

View File

@ -1,4 +1,5 @@
"use strict"; "use strict";
require("typings-global");
/** /**
* converts an erray of env strings from docker remote api to an usable object. * converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg * @param envArrayArg
@ -15,4 +16,4 @@ exports.makeEnvObject = function (envArrayArg) {
return returnObject; return returnObject;
}; };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLmRvY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBR0E7Ozs7R0FJRztBQUNRLHFCQUFhLEdBQUcsVUFBUyxXQUFvQjtJQUNwRCxJ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dHJpbmdzIGZyb20gZG9ja2VyIHJlbW90ZSBhcGkgdG8gYW4gdXNhYmxlIG9iamVjdC5cclxuICogQHBhcmFtIGVudkFycmF5QXJnXHJcbiAqIEByZXR1cm5zIHt9XHJcbiAqL1xyXG5leHBvcnQgbGV0IG1ha2VFbnZPYmplY3QgPSBmdW5jdGlvbihlbnZBcnJheUFyZzpzdHJpbmdbXSl7XHJcbiAgICBsZXQgcmV0dXJuT2JqZWN0ID0ge307XHJcbiAgICBsZXQgcmVnZXhTdHJpbmcgPSAvKC4qKT0oLiopLztcclxuICAgIGZvcihsZXQgZW52S2V5IGluIGVudkFycmF5QXJnKXtcclxuICAgICAgICBsZXQgcmVnZXhNYXRjaGVzID0gcmVnZXhTdHJpbmcuZXhlYyhlbnZBcnJheUFyZ1tlbnZLZXldKTtcclxuICAgICAgICByZXR1cm5PYmplY3RbcmVnZXhNYXRjaGVzWzFdXSA9IHJlZ2V4TWF0Y2hlc1syXTtcclxuICAgIH07XHJcbiAgICByZXR1cm4gcmV0dXJuT2JqZWN0O1xyXG59OyJdfQ==

14
dist/smartstring.domain.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import "typings-global";
export declare class Domain {
fullName: string;
level1: string;
level2: string;
level3: string;
level4: string;
level5: string;
protocol: string;
topLevel: string;
domainName: any;
subDomain: any;
constructor(domainStringArg: string);
}

30
dist/smartstring.domain.js vendored Normal file
View File

@ -0,0 +1,30 @@
"use strict";
require("typings-global");
var Domain = (function () {
function Domain(domainStringArg) {
this.fullName = domainStringArg;
var regexMatches = domainRegex(domainStringArg);
this.level1 = regexMatches[0];
this.level2 = regexMatches[1];
this.level3 = regexMatches[2];
this.level4 = regexMatches[3];
this.level5 = regexMatches[4];
// aliases
this.topLevel = this.level1;
this.domainName = this.level2;
this.subDomain = this.level3;
}
return Domain;
}());
exports.Domain = Domain;
var domainRegex = function (stringArg) {
var regexString = /([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}$/;
var regexMatches = regexString.exec(stringArg);
regexMatches.reverse();
var regexMatchesFiltered = regexMatches.filter(function (stringArg) {
return (stringArg != "");
});
return regexMatchesFiltered;
};
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLmRvbWFpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBR3ZCO0lBWUksZ0JBQVksZUFBc0I7UUFDOUIsSUFBSSxDQUFDLFFBQVEsR0FBRyxlQUFlLENBQUM7UUFDaEMsSUFBSSxZQUFZLEdBQUcsV0FBVyxDQUFDLGVBQWUsQ0FBQyxDQUFDO1FBQ2hELElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLElBQUksQ0FBQyxNQUFNLEdBQUcsWUFBWSxDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQzlCLFVBQVU7UUFDVixJQUFJLENBQUMsUUFBUSxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUM7UUFDNUIsSUFBSSxDQUFDLFVBQVUsR0FBRyxJQUFJLENBQUMsTUFBTSxDQUFDO1FBQzlCLElBQUksQ0FBQyxTQUFTLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQztJQUNqQyxDQUFDO0lBQ0wsYUFBQztBQUFELENBekJBLEFBeUJDLElBQUE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0cmluZ0FyZyAhPSBcIlwiKTtcclxuICAgIH0pO1xyXG4gICAgcmV0dXJuIHJlZ2V4TWF0Y2hlc0ZpbHRlcmVkO1xyXG59OyJdfQ==

View File

@ -1,4 +1,5 @@
export declare class gitRepo { import "typings-global";
export declare class GitRepo {
host: string; host: string;
user: string; user: string;
repo: string; repo: string;
@ -7,4 +8,3 @@ export declare class gitRepo {
httpsUrl: string; httpsUrl: string;
constructor(stringArg: string, tokenArg?: string); constructor(stringArg: string, tokenArg?: string);
} }
export declare let git: (stringArg: string, tokenArg?: string) => gitRepo;

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,2 @@
declare let plugins: { import "typings-global";
beautylog: any; export import beautylog = require("beautylog");
};
export = plugins;

View File

@ -1,8 +1,5 @@
"use strict"; "use strict";
/// <reference path="./typings/main.d.ts" /> require("typings-global");
var plugins = { exports.beautylog = require("beautylog");
beautylog: require("beautylog")
};
module.exports = plugins;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFJLE9BQU8sR0FBRztJQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO0NBQ2xDLENBQUM7QUFFRixpQkFBUyxPQUFPLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cclxubGV0IHBsdWdpbnMgPSB7XHJcbiAgICBiZWF1dHlsb2c6IHJlcXVpcmUoXCJiZWF1dHlsb2dcIilcclxufTtcclxuXHJcbmV4cG9ydCA9IHBsdWdpbnM7Il19 //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBRVAsQ0FBQyxDQUZzQjtBQUVULGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCJcclxuXHJcbmV4cG9ydCBpbXBvcnQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTsiXX0=

View File

@ -1 +1,2 @@
import "typings-global";
export declare let regexReferencePath: RegExp; export declare let regexReferencePath: RegExp;

View File

@ -1,4 +1,5 @@
"use strict"; "use strict";
require("typings-global");
exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/; exports.regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVXLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIiwiZmlsZSI6InNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLnBsdWdpbnNcIik7XHJcblxyXG5leHBvcnQgbGV0IHJlZ2V4UmVmZXJlbmNlUGF0aCA9IC9cXC9cXC9cXC9cXHMqPHJlZmVyZW5jZVxccytwYXRoXFxzKj1cXHMqW1wifCddLipbXCJ8J11cXHMqXFwvPlxccypbXFxcXG5dPy8iXX0= //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUdaLDBCQUFrQixHQUFHLDhEQUE4RCxDQUFBIiwiZmlsZSI6InNtYXJ0c3RyaW5nLnR5cGVzY3JpcHQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXHJcbmltcG9ydCBwbHVnaW5zID0gcmVxdWlyZShcIi4vc21hcnRzdHJpbmcucGx1Z2luc1wiKTtcclxuXHJcbmV4cG9ydCBsZXQgcmVnZXhSZWZlcmVuY2VQYXRoID0gL1xcL1xcL1xcL1xccyo8cmVmZXJlbmNlXFxzK3BhdGhcXHMqPVxccypbXCJ8J10uKltcInwnXVxccypcXC8+XFxzKltcXFxcbl0/LyJdfQ==

View File

@ -22,10 +22,12 @@
}, },
"homepage": "https://github.com/pushrocks/smartstring#readme", "homepage": "https://github.com/pushrocks/smartstring#readme",
"devDependencies": { "devDependencies": {
"npmts": "^5.1.5", "npmts": "^5.1.13",
"should": "^8.3.1" "should": "^8.4.0",
"typings-test": "^1.0.1"
}, },
"dependencies": { "dependencies": {
"beautylog": "^5.0.0" "beautylog": "^5.0.6",
"typings-global": "^1.0.3"
} }
} }

3
test/test.d.ts vendored
View File

@ -1,2 +1 @@
declare let smartstring: any; import "typings-test";
declare let should: any;

File diff suppressed because one or more lines are too long

View File

@ -1,10 +1,30 @@
/// <reference path="../ts/typings/main.d.ts" /> import "typings-test"
let smartstring = require("../dist/index.js"); import * as smartstring from "../dist/index";
let should = require("should"); let should = require("should");
describe("smartstring",function(){ describe("smartstring",function(){
describe(".git()",function(){ describe(".Domain class",function(){
let testGit = smartstring.git("git+https://github.com/pushrocks/smartstring.git"); let testDomain:smartstring.Domain;
it("should create a new Domain object",function(){
testDomain = new smartstring.Domain("level3D.level2D.level1D");
testDomain.should.be.instanceof(smartstring.Domain);
});
it("should have a .topLevel",function(){
testDomain.topLevel.should.equal("level1D");
});
it("should have a .level2",function(){
testDomain.level2.should.equal("level2D");
});
it("should have a .level3",function(){
testDomain.level3.should.equal("level3D");
});
})
describe(".Git class",function(){
let testGit:smartstring.GitRepo;
it("should create a new Git class GitRepo",function(){
testGit = new smartstring.GitRepo("git+https://github.com/pushrocks/smartstring.git");
testGit.should.be.instanceof(smartstring.GitRepo);
})
it("should return a .host",function(){ it("should return a .host",function(){
testGit.host testGit.host
.should.equal("github.com"); .should.equal("github.com");

View File

@ -1,8 +1,8 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global"
import SmartstringGit = require("./smartstring.git");
import SmartstringDocker = require("./smartstring.docker"); import SmartstringDocker = require("./smartstring.docker");
import SmartstringTypescript = require("./smartstring.typescript"); import SmartstringTypescript = require("./smartstring.typescript");
export let git = SmartstringGit.git; export {Domain} from "./smartstring.domain";
export {GitRepo} from "./smartstring.git";
export let docker = SmartstringDocker; export let docker = SmartstringDocker;
export let typescript = SmartstringTypescript; export let typescript = SmartstringTypescript;

View File

@ -1,4 +1,4 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global"
import plugins = require("./smartstring.plugins"); import plugins = require("./smartstring.plugins");
/** /**

40
ts/smartstring.domain.ts Normal file
View File

@ -0,0 +1,40 @@
import "typings-global"
import plugins = require("./smartstring.plugins");
export class Domain {
fullName:string;
level1:string;
level2:string;
level3:string;
level4:string;
level5:string;
protocol:string;
//aliases
topLevel:string;
domainName;
subDomain;
constructor(domainStringArg:string){
this.fullName = domainStringArg;
let regexMatches = domainRegex(domainStringArg);
this.level1 = regexMatches[0];
this.level2 = regexMatches[1];
this.level3 = regexMatches[2];
this.level4 = regexMatches[3];
this.level5 = regexMatches[4];
// aliases
this.topLevel = this.level1;
this.domainName = this.level2;
this.subDomain = this.level3;
}
}
let domainRegex = function(stringArg:string){
let regexString = /([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}([a-zA-Z0-9]*)\.{0,1}$/;
let regexMatches = regexString.exec(stringArg);
regexMatches.reverse();
let regexMatchesFiltered = regexMatches.filter(function(stringArg:string){
return(stringArg != "");
});
return regexMatchesFiltered;
};

View File

@ -1,10 +1,10 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global"
import plugins = require("./smartstring.plugins"); import plugins = require("./smartstring.plugins");
/* ---------------------------------------------- * /* ---------------------------------------------- *
* ------------------ classes ------------------- * * ------------------ classes ------------------- *
* ---------------------------------------------- */ * ---------------------------------------------- */
export class gitRepo { export class GitRepo {
host:string; host:string;
user:string; user:string;
repo:string; repo:string;
@ -51,11 +51,3 @@ let gitLink = function(hostArg:string, userArg:string, repoArg:string, tokenArg:
} }
return returnString; return returnString;
}; };
/* ---------------------------------------------- *
* ------------------ exports ------------------- *
* ---------------------------------------------- */
export let git = function(stringArg:string,tokenArg?:string){
let localGitRepo = new gitRepo(stringArg,tokenArg);
return localGitRepo;
};

View File

@ -1,3 +1,3 @@
/// <reference path="./typings/main.d.ts" /> import "typings-global"
export import beautylog = require("beautylog"); export import beautylog = require("beautylog");

View File

@ -1,3 +1,4 @@
import "typings-global"
import plugins = require("./smartstring.plugins"); import plugins = require("./smartstring.plugins");
export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/ export let regexReferencePath = /\/\/\/\s*<reference\s+path\s*=\s*["|'].*["|']\s*\/>\s*[\\n]?/