now handling docker env strings allright
This commit is contained in:
parent
f62c74a064
commit
4c42bab6b9
9
dist/index.js
vendored
9
dist/index.js
vendored
@ -1,8 +1,11 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var git = require("./smartstring.git");
|
var SmartstringGit = require("./smartstring.git");
|
||||||
|
var SmartstringDocker = require("./smartstring.docker");
|
||||||
var smartstring = {
|
var smartstring = {
|
||||||
git: git
|
git: SmartstringGit,
|
||||||
|
docker: SmartstringDocker
|
||||||
};
|
};
|
||||||
module.exports = smartstring;
|
module.exports = smartstring;
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFPLEdBQUcsV0FBVyxtQkFBbUIsQ0FBQyxDQUFDO0FBRTFDLElBQUksV0FBVyxHQUFHO0lBQ2QsR0FBRyxFQUFHLEdBQUc7Q0FDWixDQUFDO0FBRUYsaUJBQVMsV0FBVyxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxuaW1wb3J0IGdpdCA9IHJlcXVpcmUoXCIuL3NtYXJ0c3RyaW5nLmdpdFwiKTtcblxubGV0IHNtYXJ0c3RyaW5nID0ge1xuICAgIGdpdCA6IGdpdFxufTtcblxuZXhwb3J0ID0gc21hcnRzdHJpbmc7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSw0Q0FBNEM7QUFDNUMsSUFBTyxjQUFjLFdBQVcsbUJBQW1CLENBQUMsQ0FBQztBQUNyRCxJQUFPLGlCQUFpQixXQUFXLHNCQUFzQixDQUFDLENBQUM7QUFFM0QsSUFBSSxXQUFXLEdBQUc7SUFDZCxHQUFHLEVBQUcsY0FBYztJQUNwQixNQUFNLEVBQUUsaUJBQWlCO0NBQzVCLENBQUM7QUFFRixpQkFBUyxXQUFXLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgU21hcnRzdHJpbmdHaXQgPSByZXF1aXJlKFwiLi9zbWFydHN0cmluZy5naXRcIik7XG5pbXBvcnQgU21hcnRzdHJpbmdEb2NrZXIgPSByZXF1aXJlKFwiLi9zbWFydHN0cmluZy5kb2NrZXJcIik7XG5cbmxldCBzbWFydHN0cmluZyA9IHtcbiAgICBnaXQgOiBTbWFydHN0cmluZ0dpdCxcbiAgICBkb2NrZXI6IFNtYXJ0c3RyaW5nRG9ja2VyXG59O1xuXG5leHBvcnQgPSBzbWFydHN0cmluZzsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||||
|
18
dist/smartstring.docker.js
vendored
Normal file
18
dist/smartstring.docker.js
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
/**
|
||||||
|
* converts an erray of env strings from docker remote api to an usable object.
|
||||||
|
* @param envArrayArg
|
||||||
|
* @returns {}
|
||||||
|
*/
|
||||||
|
exports.makeEnvObject = function (envArrayArg) {
|
||||||
|
var returnObject = {};
|
||||||
|
var regexString = /(.*)=(.*)/;
|
||||||
|
for (var envKey in envArrayArg) {
|
||||||
|
var regexMatches = regexString.exec(envArrayArg[envKey]);
|
||||||
|
returnObject[regexMatches[1]] = regexMatches[2];
|
||||||
|
}
|
||||||
|
;
|
||||||
|
return returnObject;
|
||||||
|
};
|
||||||
|
|
||||||
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uICAgIGxldCByZXR1cm5PYmplY3QgPSB7fTtcbiAgICBsZXQgcmVnZXhTdHJpbmcgPSAvKC4qKT0oLiopLztcbiAgICBmb3IobGV0IGVudktleSBpbiBlbnZBcnJheUFyZyl7XG4gICAgICAgIGxldCByZWdleE1hdGNoZXMgPSByZWdleFN0cmluZy5leGVjKGVudkFycmF5QXJnW2VudktleV0pO1xuICAgICAgICByZXR1cm5PYmplY3RbcmVnZXhNYXRjaGVzWzFdXSA9IHJlZ2V4TWF0Y2hlc1syXTtcbiAgICB9O1xuICAgIHJldHVybiByZXR1cm5PYmplY3Q7XG59OyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
5
dist/smartstring.git.js
vendored
5
dist/smartstring.git.js
vendored
File diff suppressed because one or more lines are too long
3
dist/smartstring.plugins.js
vendored
3
dist/smartstring.plugins.js
vendored
@ -1,7 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = {
|
var plugins = {
|
||||||
beautylog: require("beautylog")
|
beautylog: require("beautylog")
|
||||||
};
|
};
|
||||||
module.exports = plugins;
|
module.exports = plugins;
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQUksT0FBTyxHQUFHO0lBQ1YsU0FBUyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7Q0FDbEMsQ0FBQztBQUVGLGlCQUFTLE9BQU8sQ0FBQyIsImZpbGUiOiJzbWFydHN0cmluZy5wbHVnaW5zLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHBsdWdpbnMgPSB7XG4gICAgYmVhdXR5bG9nOiByZXF1aXJlKFwiYmVhdXR5bG9nXCIpXG59O1xuXG5leHBvcnQgPSBwbHVnaW5zOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3RyaW5nLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDRDQUE0QztBQUM1QyxJQUFJLE9BQU8sR0FBRztJQUNWLFNBQVMsRUFBRSxPQUFPLENBQUMsV0FBVyxDQUFDO0NBQ2xDLENBQUM7QUFFRixpQkFBUyxPQUFPLENBQUMiLCJmaWxlIjoic21hcnRzdHJpbmcucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vLyA8cmVmZXJlbmNlIHBhdGg9XCIuL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbmxldCBwbHVnaW5zID0ge1xuICAgIGJlYXV0eWxvZzogcmVxdWlyZShcImJlYXV0eWxvZ1wiKVxufTtcblxuZXhwb3J0ID0gcGx1Z2luczsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/pushrocks/smartstring#readme",
|
"homepage": "https://github.com/pushrocks/smartstring#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"npmts": "^3.1.2",
|
"npmts": "^5.0.4",
|
||||||
"should": "^8.2.2"
|
"should": "^8.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "^3.0.2"
|
"beautylog": "^4.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
test/test.js
13
test/test.js
@ -25,5 +25,16 @@ describe("smartstring", function () {
|
|||||||
.should.equal("git@github.com:pushrocks/smartstring.git");
|
.should.equal("git@github.com:pushrocks/smartstring.git");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe(".docker", function () {
|
||||||
|
describe(".makeEnvObject", function () {
|
||||||
|
it("should create a Env Object", function () {
|
||||||
|
var envStringArray = ["VIRTUAL_HOST=sub.domain.tld", "DEFAULT_HOST=some.domain.com"];
|
||||||
|
var envObject = smartstring.docker.makeEnvObject(envStringArray);
|
||||||
|
envObject.VIRTUAL_HOST.should.equal("sub.domain.tld");
|
||||||
|
envObject.DEFAULT_HOST.should.equal("some.domain.com");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=test.js.map
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzlDLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUUvQixRQUFRLENBQUMsYUFBYSxFQUFDO0lBQ25CLFFBQVEsQ0FBQyxRQUFRLEVBQUM7UUFDZCxJQUFJLE9BQU8sR0FBRyxXQUFXLENBQUMsR0FBRyxDQUFDLGtEQUFrRCxDQUFDLENBQUM7UUFDbEYsRUFBRSxDQUFDLHVCQUF1QixFQUFDO1lBQ3ZCLE9BQU8sQ0FBQyxJQUFJO2lCQUNQLE1BQU0sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUM7UUFDcEMsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQUMsdUJBQXVCLEVBQUM7WUFDdkIsT0FBTyxDQUFDLElBQUk7aUJBQ1AsTUFBTSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUNuQyxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUs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WwoXCJodHRwczovL2dpdGh1Yi5jb20vcHVzaHJvY2tzL3NtYXJ0c3RyaW5nLmdpdFwiKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIHJldHVybiBhIC5zc2hVcmxcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdEdpdC5zc2hVcmxcbiAgICAgICAgICAgICAgICAuc2hvdWxkLmVxdWFsKFwiZ2l0QGdpdGh1Yi5jb206cHVzaHJvY2tzL3NtYXJ0c3RyaW5nLmdpdFwiKTtcbiAgICAgICAgfSk7XG4gICAgfSlcbiAgICBkZXNjcmliZShcIi5kb2NrZXJcIixmdW5jdGlvbigpe1xuICAgICAgICBkZXNjcmliZShcIi5tYWtlRW52T2JqZWN0XCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIGl0KFwic2hvdWxkIGNyZWF0ZSBhIEVudiBPYmplY3RcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgIGxldCBlbnZTdHJpbmdBcnJheSA9IFtcIlZJUlRVQUxfSE9TVD1zdWIuZG9tYWluLnRsZFwiLFwiREVGQVVMVF9IT1NUPXNvbWUuZG9tYWluLmNvbVwiXTtcbiAgICAgICAgICAgICAgICBsZXQgZW52T2JqZWN0ID0gc21hcnRzdHJpbmcuZG9ja2VyLm1ha2VFbnZPYmplY3QoZW52U3RyaW5nQXJyYXkpO1xuICAgICAgICAgICAgICAgIGVudk9iamVjdC5WSVJUVUFMX0hPU1Quc2hvdWxkLmVxdWFsKFwic3ViLmRvbWFpbi50bGRcIik7XG4gICAgICAgICAgICAgICAgZW52T2JqZWN0LkRFRkFVTFRfSE9TVC5zaG91bGQuZXF1YWwoXCJzb21lLmRvbWFpbi5jb21cIik7XG4gICAgICAgICAgICB9KVxuICAgICAgICB9KVxuICAgIH0pXG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
||||||
|
@ -1 +1 @@
|
|||||||
{"version":3,"file":"test.js","sourceRoot":"","s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
10
test/test.ts
@ -26,4 +26,14 @@ describe("smartstring",function(){
|
|||||||
.should.equal("git@github.com:pushrocks/smartstring.git");
|
.should.equal("git@github.com:pushrocks/smartstring.git");
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
describe(".docker",function(){
|
||||||
|
describe(".makeEnvObject",function(){
|
||||||
|
it("should create a Env Object",function(){
|
||||||
|
let envStringArray = ["VIRTUAL_HOST=sub.domain.tld","DEFAULT_HOST=some.domain.com"];
|
||||||
|
let envObject = smartstring.docker.makeEnvObject(envStringArray);
|
||||||
|
envObject.VIRTUAL_HOST.should.equal("sub.domain.tld");
|
||||||
|
envObject.DEFAULT_HOST.should.equal("some.domain.com");
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
});
|
});
|
@ -1,8 +1,10 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import git = require("./smartstring.git");
|
import SmartstringGit = require("./smartstring.git");
|
||||||
|
import SmartstringDocker = require("./smartstring.docker");
|
||||||
|
|
||||||
let smartstring = {
|
let smartstring = {
|
||||||
git : git
|
git : SmartstringGit,
|
||||||
|
docker: SmartstringDocker
|
||||||
};
|
};
|
||||||
|
|
||||||
export = smartstring;
|
export = smartstring;
|
17
ts/smartstring.docker.ts
Normal file
17
ts/smartstring.docker.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import plugins = require("./smartstring.plugins");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* converts an erray of env strings from docker remote api to an usable object.
|
||||||
|
* @param envArrayArg
|
||||||
|
* @returns {}
|
||||||
|
*/
|
||||||
|
export let makeEnvObject = function(envArrayArg:string[]){
|
||||||
|
let returnObject = {};
|
||||||
|
let regexString = /(.*)=(.*)/;
|
||||||
|
for(let envKey in envArrayArg){
|
||||||
|
let regexMatches = regexString.exec(envArrayArg[envKey]);
|
||||||
|
returnObject[regexMatches[1]] = regexMatches[2];
|
||||||
|
};
|
||||||
|
return returnObject;
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user