From 38dca0c9a08770bf3154a3403e27478a30f2f160 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Thu, 16 Jun 2016 01:56:53 +0200 Subject: [PATCH] update test Environment --- dist/dockersock.class.dockersock.js | 87 ------------------- ....ts => dockersock.classes.dockersock.d.ts} | 2 +- dist/dockersock.classes.dockersock.js | 87 +++++++++++++++++++ dist/index.d.ts | 2 + dist/index.js | 6 ++ docker-compose.yml | 22 +++++ npmts.json | 3 +- package.json | 6 +- test/test.d.ts | 2 + test/test.js | 15 ++++ test/test.ts | 14 +++ test/testEnv.sh | 4 + ...ck.ts => dockersock.classes.dockersock.ts} | 2 +- ts/index.ts | 2 + 14 files changed, 162 insertions(+), 92 deletions(-) delete mode 100644 dist/dockersock.class.dockersock.js rename dist/{dockersock.class.dockersock.d.ts => dockersock.classes.dockersock.d.ts} (90%) create mode 100644 dist/dockersock.classes.dockersock.js create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 docker-compose.yml create mode 100644 test/test.d.ts create mode 100644 test/test.js create mode 100644 test/test.ts create mode 100644 test/testEnv.sh rename ts/{dockersock.class.dockersock.ts => dockersock.classes.dockersock.ts} (98%) create mode 100644 ts/index.ts diff --git a/dist/dockersock.class.dockersock.js b/dist/dockersock.class.dockersock.js deleted file mode 100644 index fccae88..0000000 --- a/dist/dockersock.class.dockersock.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; -require("typings-global"); -var plugins = require("./dockersock.plugins"); -var dockersock = (function () { - function dockersock(pathArg) { - if (pathArg === void 0) { pathArg = "http://unix:/var/run/docker.sock:"; } - this.sockPath = pathArg; - } - // methods - dockersock.prototype.listContainers = function () { - var done = plugins.q.defer(); - this.request("GET", "/containers") - .then(done.resolve); - return done.promise; - }; - ; - dockersock.prototype.listContainersDetailed = function () { - var done = plugins.q.defer(); - var detailedDataObject = []; - this.listContainers() - .then(function (dataArg) { - var recursiveCounter = 0; - var makeDetailed = function () { - if (typeof dataArg[recursiveCounter] != "undefined") { - this.request.get("GET", "/containers/" + dataArg[recursiveCounter].Id) - .then(function (data) { - recursiveCounter++; - detailedDataObject.push(data); - makeDetailed(); - }); - } - else { - done.resolve(detailedDataObject); - } - }; - makeDetailed(); - }); - return done.promise; - }; - ; - dockersock.prototype.listContainersRunning = function () { - var done = plugins.q.defer(); - return done.promise; - }; - dockersock.prototype.listContainersStopped = function () { - var done = plugins.q.defer(); - return done.promise; - }; - dockersock.prototype.listImages = function () { - var done = plugins.q.defer(); - return done.promise; - }; - dockersock.prototype.clean = function () { - var done = plugins.q.defer(); - return done.promise; - }; - dockersock.prototype.request = function (methodArg, routeArg, dataArg) { - if (dataArg === void 0) { dataArg = {}; } - var done = plugins.q.defer(); - var jsonArg = JSON.stringify(dataArg); - var options = { - method: methodArg, - url: this.sockPath + routeArg + "/json", - headers: { - "Content-Type": "application/json" - }, - body: jsonArg - }; - plugins.request(options, function (err, res, body) { - if (!err && res.statusCode == 200) { - var responseObj = JSON.parse(body); - done.resolve(responseObj); - } - else { - console.log(err); - console.log(res); - done.reject(err); - } - ; - }); - return done.promise; - }; - return dockersock; -}()); -exports.dockersock = dockersock; - -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRvY2tlcnNvY2suY2xhc3MuZG9ja2Vyc29jay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ3ZCLElBQVksT0FBTyxXQUFNLHNCQUFzQixDQUFDLENBQUE7QUFFaEQ7SUFFSSxvQkFBWSxPQUFvRDtRQUFwRCx1QkFBb0QsR0FBcEQsNkNBQW9EO1FBQzVELElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDO0lBQzVCLENBQUM7SUFFRCxVQUFVO0lBQ1YsbUNBQWMsR0FBZDtRQUNJLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFF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G5leHBvcnQgY2xhc3MgZG9ja2Vyc29jayB7XG4gICAgc29ja1BhdGg6c3RyaW5nO1xuICAgIGNvbnN0cnVjdG9yKHBhdGhBcmc6c3RyaW5nID0gXCJodHRwOi8vdW5peDovdmFyL3J1bi9kb2NrZXIuc29jazpcIil7XG4gICAgICAgIHRoaXMuc29ja1BhdGggPSBwYXRoQXJnO1xuICAgIH1cblxuICAgIC8vIG1ldGhvZHNcbiAgICBsaXN0Q29udGFpbmVycygpIHtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgdGhpcy5yZXF1ZXN0KFwiR0VUXCIsXCIvY29udGFpbmVyc1wiKVxuICAgICAgICAgICAgLnRoZW4oZG9uZS5yZXNvbHZlKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9O1xuICAgIGxpc3RDb250YWluZXJzRGV0YWlsZWQoKSB7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIGxldCBkZXRhaWxlZERhdGFPYmplY3QgPSBbXTtcbiAgICAgICAgdGhpcy5saXN0Q29udGFpbmVycygpXG4gICAgICAgICAgICAudGhlbigoZGF0YUFyZykgPT4ge1xuICAgICAgICAgICAgICAgIGxldCByZWN1cnNpdmVDb3VudGVyID0gMDtcbiAgICAgICAgICAgICAgICAgICAgbGV0IG1ha2VEZXRhaWxlZCA9IGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICAgICAgICAgICAgICBpZih0eXBlb2YgZGF0YUFyZ1tyZWN1cnNpdmVDb3VudGVyXSAhPSBcInVuZGVmaW5lZFwiKXtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnJlcXVlc3QuZ2V0KFwiR0VUXCIsXCIvY29udGFpbmVycy9cIiArIGRhdGFBcmdbcmVjdXJzaXZlQ291bnRlcl0uSWQpXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC50aGVuKChkYXRhKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWN1cnNpdmVDb3VudGVyKys7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBkZXRhaWxlZERhdGFPYmplY3QucHVzaChkYXRhKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1ha2VEZXRhaWxlZCgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKGRldGFpbGVkRGF0YU9iamVjdCk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIG1ha2VEZXRhaWxlZCgpO1xuICAgICAgICAgICAgfSk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfTtcbiAgICBsaXN0Q29udGFpbmVyc1J1bm5pbmcoKSB7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuICAgIGxpc3RDb250YWluZXJzU3RvcHBlZCgpIHtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG4gICAgbGlzdEltYWdlcygpIHtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG4gICAgY2xlYW4oKSB7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuXG4gICAgcmVxdWVzdChtZXRob2RBcmc6c3RyaW5nLHJvdXRlQXJnOnN0cmluZyxkYXRhQXJnID0ge30pe1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICBsZXQganNvbkFyZzpzdHJpbmcgPSBKU09OLnN0cmluZ2lmeShkYXRhQXJnKTtcbiAgICAgICAgbGV0IG9wdGlvbnMgPSB7XG4gICAgICAgICAgICBtZXRob2Q6bWV0aG9kQXJnLFxuICAgICAgICAgICAgdXJsOnRoaXMuc29ja1BhdGggKyByb3V0ZUFyZyArIFwiL2pzb25cIixcbiAgICAgICAgICAgIGhlYWRlcnM6e1xuICAgICAgICAgICAgICAgIFwiQ29udGVudC1UeXBlXCI6XCJhcHBsaWNhdGlvbi9qc29uXCJcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICBib2R5Ompzb25BcmdcbiAgICAgICAgfTtcbiAgICAgICAgcGx1Z2lucy5yZXF1ZXN0KG9wdGlvbnMsZnVuY3Rpb24oZXJyLCByZXMsIGJvZHkpe1xuICAgICAgICAgICAgaWYgKCFlcnIgJiYgcmVzLnN0YXR1c0NvZGUgPT0gMjAwKSB7XG4gICAgICAgICAgICAgICAgdmFyIHJlc3BvbnNlT2JqID0gSlNPTi5wYXJzZShib2R5KTtcbiAgICAgICAgICAgICAgICBkb25lLnJlc29sdmUocmVzcG9uc2VPYmopO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhlcnIpO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHJlcyk7XG4gICAgICAgICAgICAgICAgZG9uZS5yZWplY3QoZXJyKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbn0iXX0= diff --git a/dist/dockersock.class.dockersock.d.ts b/dist/dockersock.classes.dockersock.d.ts similarity index 90% rename from dist/dockersock.class.dockersock.d.ts rename to dist/dockersock.classes.dockersock.d.ts index 4fc223c..ffd4537 100644 --- a/dist/dockersock.class.dockersock.d.ts +++ b/dist/dockersock.classes.dockersock.d.ts @@ -1,5 +1,5 @@ import "typings-global"; -export declare class dockersock { +export declare class Dockersock { sockPath: string; constructor(pathArg?: string); listContainers(): any; diff --git a/dist/dockersock.classes.dockersock.js b/dist/dockersock.classes.dockersock.js new file mode 100644 index 0000000..57c29ff --- /dev/null +++ b/dist/dockersock.classes.dockersock.js @@ -0,0 +1,87 @@ +"use strict"; +require("typings-global"); +var plugins = require("./dockersock.plugins"); +var Dockersock = (function () { + function Dockersock(pathArg) { + if (pathArg === void 0) { pathArg = "http://unix:/var/run/docker.sock:"; } + this.sockPath = pathArg; + } + // methods + Dockersock.prototype.listContainers = function () { + var done = plugins.q.defer(); + this.request("GET", "/containers") + .then(done.resolve); + return done.promise; + }; + ; + Dockersock.prototype.listContainersDetailed = function () { + var done = plugins.q.defer(); + var detailedDataObject = []; + this.listContainers() + .then(function (dataArg) { + var recursiveCounter = 0; + var makeDetailed = function () { + if (typeof dataArg[recursiveCounter] != "undefined") { + this.request.get("GET", "/containers/" + dataArg[recursiveCounter].Id) + .then(function (data) { + recursiveCounter++; + detailedDataObject.push(data); + makeDetailed(); + }); + } + else { + done.resolve(detailedDataObject); + } + }; + makeDetailed(); + }); + return done.promise; + }; + ; + Dockersock.prototype.listContainersRunning = function () { + var done = plugins.q.defer(); + return done.promise; + }; + Dockersock.prototype.listContainersStopped = function () { + var done = plugins.q.defer(); + return done.promise; + }; + Dockersock.prototype.listImages = function () { + var done = plugins.q.defer(); + return done.promise; + }; + Dockersock.prototype.clean = function () { + var done = plugins.q.defer(); + return done.promise; + }; + Dockersock.prototype.request = function (methodArg, routeArg, dataArg) { + if (dataArg === void 0) { dataArg = {}; } + var done = plugins.q.defer(); + var jsonArg = JSON.stringify(dataArg); + var options = { + method: methodArg, + url: this.sockPath + routeArg + "/json", + headers: { + "Content-Type": "application/json" + }, + body: jsonArg + }; + plugins.request(options, function (err, res, body) { + if (!err && res.statusCode == 200) { + var responseObj = JSON.parse(body); + done.resolve(responseObj); + } + else { + console.log(err); + console.log(res); + done.reject(err); + } + ; + }); + return done.promise; + }; + return Dockersock; +}()); +exports.Dockersock = Dockersock; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRvY2tlcnNvY2suY2xhc3Nlcy5kb2NrZXJzb2NrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFDdkIsSUFBWSxPQUFPLFdBQU0sc0JBQXNCLENBQUMsQ0FBQTtBQUVoRDtJQUVJLG9CQUFZLE9BQW9EO1FBQXBELHVCQUFvRCxHQUFwRCw2Q0FBb0Q7UUFDNUQsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUM7SUFDNUIsQ0FBQztJQUVELFVBQVU7SUFDVixtQ0FBYyxHQUFkO1FBQ0ksSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUM3QixJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBQyxhQUFhLENBQUM7YUFDNUIsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUN4QixNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN4QixDQUFDOztJQUNELDJDQUFzQixHQUF0QjtRQUNJLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7UUFDN0IsSUFBSSxrQkFBa0IsR0FBRyxFQUFFLENBQUM7UUFDNUIsSUFBSSxDQUFDLGNBQWMsRUFBRTthQUNoQixJQUFJLENBQUMsVUFBQyxPQUFPO1lBQ1YsSUFBSSxnQkFBZ0IsR0FBRyxDQUFDLENBQUM7WUFDckIsS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7XG4gICAgfTtcbiAgICBsaXN0Q29udGFpbmVyc0RldGFpbGVkKCkge1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICBsZXQgZGV0YWlsZWREYXRhT2JqZWN0ID0gW107XG4gICAgICAgIHRoaXMubGlzdENvbnRhaW5lcnMoKVxuICAgICAgICAgICAgLnRoZW4oKGRhdGFBcmcpID0+IHtcbiAgICAgICAgICAgICAgICBsZXQgcmVjdXJzaXZlQ291bnRlciA9IDA7XG4gICAgICAgICAgICAgICAgICAgIGxldCBtYWtlRGV0YWlsZWQgPSBmdW5jdGlvbigpe1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYodHlwZW9mIGRhdGFBcmdbcmVjdXJzaXZlQ291bnRlcl0gIT0gXCJ1bmRlZmluZWRcIil7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5yZXF1ZXN0LmdldChcIkdFVFwiLFwiL2NvbnRhaW5lcnMvXCIgKyBkYXRhQXJnW3JlY3Vyc2l2ZUNvdW50ZXJdLklkKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAudGhlbigoZGF0YSkgPT4ge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVjdXJzaXZlQ291bnRlcisrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV0YWlsZWREYXRhT2JqZWN0LnB1c2goZGF0YSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBtYWtlRGV0YWlsZWQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRvbmUucmVzb2x2ZShkZXRhaWxlZERhdGFPYmplY3QpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICBtYWtlRGV0YWlsZWQoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH07XG4gICAgbGlzdENvbnRhaW5lcnNSdW5uaW5nKCkge1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbiAgICBsaXN0Q29udGFpbmVyc1N0b3BwZWQoKSB7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuICAgIGxpc3RJbWFnZXMoKSB7XG4gICAgICAgIGxldCBkb25lID0gcGx1Z2lucy5xLmRlZmVyKCk7XG4gICAgICAgIHJldHVybiBkb25lLnByb21pc2U7XG4gICAgfVxuICAgIGNsZWFuKCkge1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cblxuICAgIHJlcXVlc3QobWV0aG9kQXJnOnN0cmluZyxyb3V0ZUFyZzpzdHJpbmcsZGF0YUFyZyA9IHt9KXtcbiAgICAgICAgbGV0IGRvbmUgPSBwbHVnaW5zLnEuZGVmZXIoKTtcbiAgICAgICAgbGV0IGpzb25Bcmc6c3RyaW5nID0gSlNPTi5zdHJpbmdpZnkoZGF0YUFyZyk7XG4gICAgICAgIGxldCBvcHRpb25zID0ge1xuICAgICAgICAgICAgbWV0aG9kOm1ldGhvZEFyZyxcbiAgICAgICAgICAgIHVybDp0aGlzLnNvY2tQYXRoICsgcm91dGVBcmcgKyBcIi9qc29uXCIsXG4gICAgICAgICAgICBoZWFkZXJzOntcbiAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOlwiYXBwbGljYXRpb24vanNvblwiXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYm9keTpqc29uQXJnXG4gICAgICAgIH07XG4gICAgICAgIHBsdWdpbnMucmVxdWVzdChvcHRpb25zLGZ1bmN0aW9uKGVyciwgcmVzLCBib2R5KXtcbiAgICAgICAgICAgIGlmICghZXJyICYmIHJlcy5zdGF0dXNDb2RlID09IDIwMCkge1xuICAgICAgICAgICAgICAgIHZhciByZXNwb25zZU9iaiA9IEpTT04ucGFyc2UoYm9keSk7XG4gICAgICAgICAgICAgICAgZG9uZS5yZXNvbHZlKHJlc3BvbnNlT2JqKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5sb2coZXJyKTtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhyZXMpO1xuICAgICAgICAgICAgICAgIGRvbmUucmVqZWN0KGVycik7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9KTtcbiAgICAgICAgcmV0dXJuIGRvbmUucHJvbWlzZTtcbiAgICB9XG59Il19 diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..1f09182 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,2 @@ +import "typings-global"; +export { Dockersock } from "./dockersock.classes.dockersock"; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..035764c --- /dev/null +++ b/dist/index.js @@ -0,0 +1,6 @@ +"use strict"; +require("typings-global"); +var dockersock_classes_dockersock_1 = require("./dockersock.classes.dockersock"); +exports.Dockersock = dockersock_classes_dockersock_1.Dockersock; + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsOENBQXlCLGlDQUFpQyxDQUFDO0FBQW5ELGdFQUFrRCIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XG5leHBvcnQge0RvY2tlcnNvY2t9IGZyb20gXCIuL2RvY2tlcnNvY2suY2xhc3Nlcy5kb2NrZXJzb2NrXCIiXX0= diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0667aa6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,22 @@ +nginx1 : + image: "nginx" + environment: + VIRTUAL_HOST: "test100.labkomp.de" + restart: always + container_name: nginx1 +nginx2: + image: nginx + environment: + VIRTUAL_HOST: "test101.labkomp.de" + restart: always + container_name: nginx2 +dockersock: + image: "trafficimg" + ports: + - "80:80" + - "443:443" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + env_file: "nogit/nogit.env" + restart: always + container_name: dockersock-container \ No newline at end of file diff --git a/npmts.json b/npmts.json index 84b168f..b23c020 100644 --- a/npmts.json +++ b/npmts.json @@ -1,3 +1,4 @@ { - "mode":"default" + "mode":"default", + "coverageTreshold":10 } \ No newline at end of file diff --git a/package.json b/package.json index 5061d43..a52f9cd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "scripts": { "test": "npmts", - "testindocker": "npmts && docker-machine start default; eval \"$(docker-machine env default)\" && docker build -t test-image . && docker run test-image" + "testindocker": "bash -x ./test/testEnv.sh" }, "repository": { "type": "git", @@ -31,6 +31,8 @@ "typings-global": "^1.0.3" }, "devDependencies": { - "npmts-g": "^5.2.6" + "npmts-g": "^5.2.6", + "should": "^9.0.2", + "typings-test": "^1.0.1" } } diff --git a/test/test.d.ts b/test/test.d.ts new file mode 100644 index 0000000..b973566 --- /dev/null +++ b/test/test.d.ts @@ -0,0 +1,2 @@ +import "typings-test"; +import "should"; diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..edfad6d --- /dev/null +++ b/test/test.js @@ -0,0 +1,15 @@ +"use strict"; +require("typings-test"); +require("should"); +var index_1 = require("../dist/index"); +describe("dockersock", function () { + describe(".Dockersock()", function () { + var testDockersock; + it("should create a new Dockersock instance", function () { + testDockersock = new index_1.Dockersock(); + testDockersock.should.be.instanceof(index_1.Dockersock); + }); + }); +}); + +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUVQLENBQUMsQ0FGYztBQUVmLHNCQUF5QixlQUV6QixDQUFDLENBRnVDO0FBRXhDLFFBQVEsQ0FBQyxZQUFZLEVBQUM7SUFDbEIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixJQUFJLGNBQXlCLENBQUM7UUFDOUIsRUFBRSxDQUFDLHlDQUF5QyxFQUFDO1lBQ3pDLGNBQWMsR0FBRyxJQUFJLGtCQUFVLEVBQUUsQ0FBQztZQUNsQyxjQUFjLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsa0JBQVUsQ0FBQyxDQUFDO1FBQ3BELENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCI7XG5pbXBvcnQgXCJzaG91bGRcIlxuXG5pbXBvcnQge0RvY2tlcnNvY2t9IGZyb20gXCIuLi9kaXN0L2luZGV4XCJcblxuZGVzY3JpYmUoXCJkb2NrZXJzb2NrXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5Eb2NrZXJzb2NrKClcIixmdW5jdGlvbigpe1xuICAgICAgICBsZXQgdGVzdERvY2tlcnNvY2s6RG9ja2Vyc29jaztcbiAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgbmV3IERvY2tlcnNvY2sgaW5zdGFuY2VcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2sgPSBuZXcgRG9ja2Vyc29jaygpO1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2suc2hvdWxkLmJlLmluc3RhbmNlb2YoRG9ja2Vyc29jayk7XG4gICAgICAgIH0pO1xuICAgIH0pO1xufSk7Il19 diff --git a/test/test.ts b/test/test.ts new file mode 100644 index 0000000..176c6c1 --- /dev/null +++ b/test/test.ts @@ -0,0 +1,14 @@ +import "typings-test"; +import "should" + +import {Dockersock} from "../dist/index" + +describe("dockersock",function(){ + describe(".Dockersock()",function(){ + let testDockersock:Dockersock; + it("should create a new Dockersock instance",function(){ + testDockersock = new Dockersock(); + testDockersock.should.be.instanceof(Dockersock); + }); + }); +}); \ No newline at end of file diff --git a/test/testEnv.sh b/test/testEnv.sh new file mode 100644 index 0000000..f35da9b --- /dev/null +++ b/test/testEnv.sh @@ -0,0 +1,4 @@ +npmts +docker-machine start default; eval \"$(docker-machine env default)\" +docker build -t dockersock-image . +docker-compose up \ No newline at end of file diff --git a/ts/dockersock.class.dockersock.ts b/ts/dockersock.classes.dockersock.ts similarity index 98% rename from ts/dockersock.class.dockersock.ts rename to ts/dockersock.classes.dockersock.ts index 0d0057c..478f6a1 100644 --- a/ts/dockersock.class.dockersock.ts +++ b/ts/dockersock.classes.dockersock.ts @@ -1,7 +1,7 @@ import "typings-global" import * as plugins from "./dockersock.plugins"; -export class dockersock { +export class Dockersock { sockPath:string; constructor(pathArg:string = "http://unix:/var/run/docker.sock:"){ this.sockPath = pathArg; diff --git a/ts/index.ts b/ts/index.ts new file mode 100644 index 0000000..c9dda23 --- /dev/null +++ b/ts/index.ts @@ -0,0 +1,2 @@ +import "typings-global"; +export {Dockersock} from "./dockersock.classes.dockersock" \ No newline at end of file