This commit is contained in:
Philipp Kunz 2017-03-26 13:02:20 +02:00
parent 14b2105a49
commit 526bb5bbd0
12 changed files with 2001 additions and 86 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
docs/ docs/
coverage/ coverage/
node_modules/ node_modules/
.yarn/
public/
pages/

View File

@ -1,10 +1,12 @@
/// <reference types="request" />
/// <reference types="q" /> /// <reference types="q" />
import "typings-global"; import "typings-global";
import * as plugins from "./dockersock.plugins"; import * as plugins from "./dockersock.plugins";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { Objectmap } from 'lik';
export declare class Dockersock { export declare class Dockersock {
sockPath: string; sockPath: string;
requestObjectmap: plugins.lik.Objectmap; requestObjectmap: Objectmap<plugins.request.Request>;
constructor(pathArg?: string); constructor(pathArg?: string);
auth(userArg: string, passArg: string): plugins.q.Promise<{}>; auth(userArg: string, passArg: string): plugins.q.Promise<{}>;
listContainers(): plugins.q.Promise<{}>; listContainers(): plugins.q.Promise<{}>;

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,9 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global"); require("typings-global");
exports.beautylog = require("beautylog"); exports.beautylog = require("beautylog");
exports.lik = require("lik"); exports.lik = require("lik");
exports.q = require("q"); exports.q = require("q");
exports.request = require("request"); exports.request = require("request");
exports.rxjs = require("rxjs"); exports.rxjs = require("rxjs");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9ja2Vyc29jay5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZG9ja2Vyc29jay5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDVixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDO0FBQ2pDLFdBQUcsV0FBVyxLQUFLLENBQUMsQ0FBQztBQUNyQixTQUFDLFdBQVcsR0FBRyxDQUFDLENBQUM7QUFDakIsZUFBTyxXQUFXLFNBQVMsQ0FBQyxDQUFDO0FBQzdCLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQyJ9 //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG9ja2Vyc29jay5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZG9ja2Vyc29jay5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsMEJBQXdCO0FBQ3hCLHlDQUErQztBQUMvQyw2QkFBbUM7QUFDbkMseUJBQStCO0FBQy9CLHFDQUEyQztBQUMzQywrQkFBcUMifQ==

3
dist/index.js vendored
View File

@ -1,5 +1,6 @@
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global"); require("typings-global");
var dockersock_classes_dockersock_1 = require("./dockersock.classes.dockersock"); var dockersock_classes_dockersock_1 = require("./dockersock.classes.dockersock");
exports.Dockersock = dockersock_classes_dockersock_1.Dockersock; exports.Dockersock = dockersock_classes_dockersock_1.Dockersock;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLDhDQUEyQixpQ0FBaUMsQ0FBQztBQUFwRCxnRUFBb0QifQ== //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF3QjtBQUN4QixpRkFBNkQ7QUFBcEQscURBQUEsVUFBVSxDQUFBIn0=

View File

@ -4,8 +4,8 @@
"coverageTreshold":10 "coverageTreshold":10
}, },
"npmdocker":{ "npmdocker":{
"baseImage":"hosttoday/ht-docker-node:npmts", "baseImage":"hosttoday/ht-docker-node:npmci",
"command":"npmts", "command":"npmci command yarn global add npmts && npmci command npmts",
"dockerSock":"true" "dockerSock":"true"
} }
} }

View File

@ -25,18 +25,16 @@
}, },
"homepage": "https://gitlab.com/pushrocks/dockersock#README", "homepage": "https://gitlab.com/pushrocks/dockersock#README",
"dependencies": { "dependencies": {
"@types/q": "0.x.x", "@types/q": "1.x.x",
"@types/request": "0.x.x", "@types/request": "0.x.x",
"beautylog": "^5.0.20", "beautylog": "^6.1.5",
"lik": "^1.0.9", "lik": "^1.0.27",
"q": "^1.4.1", "q": "^1.5.0",
"request": "^2.74.0", "request": "^2.81.0",
"rxjs": "^5.0.0-beta.10", "rxjs": "^5.2.0",
"typings-global": "^1.0.6" "typings-global": "^1.0.14"
}, },
"devDependencies": { "devDependencies": {
"npmts-g": "^5.2.8", "tapbundle": "^1.0.5"
"should": "^10.0.0",
"typings-test": "^1.0.1"
} }
} }

2
test/test.d.ts vendored
View File

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

View File

@ -1,42 +0,0 @@
"use strict";
require("typings-test");
require("should");
const index_1 = require("../dist/index");
describe("dockersock", function () {
describe(".Dockersock()", function () {
let testDockersock;
it("should create a new Dockersock instance", function () {
testDockersock = new index_1.Dockersock();
testDockersock.should.be.instanceof(index_1.Dockersock);
});
it("should list containers", function (done) {
testDockersock.listContainers()
.then((dataArg) => {
console.log(dataArg);
done();
});
});
it("should list detailed containers", function (done) {
this.timeout(5000);
testDockersock.listContainersDetailed()
.then((dataArg) => {
console.log(dataArg);
done();
});
});
it("should pull an image from imagetag", function (done) {
this.timeout(60000);
testDockersock.pullImage("hosttoday/ht-docker-dbase")
.then((dataArg) => {
done();
});
});
it("should return a change Objservable", function (done) {
this.timeout(10000);
testDockersock.getChangeObservable();
testDockersock.endRequests();
done();
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUVoQix3QkFBMkIsZUFBZSxDQUFDLENBQUE7QUFFM0MsUUFBUSxDQUFDLFlBQVksRUFBRTtJQUNuQixRQUFRLENBQUMsZUFBZSxFQUFFO1FBQ3RCLElBQUksY0FBMEIsQ0FBQztRQUMvQixFQUFFLENBQUMseUNBQXlDLEVBQUU7WUFDMUMsY0FBYyxHQUFHLElBQUksa0JBQVUsRUFBRSxDQUFDO1lBQ2xDLGNBQWMsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxrQkFBVSxDQUFDLENBQUM7UUFDcEQsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQUMsd0JBQXdCLEVBQUUsVUFBVSxJQUFJO1lBQ3ZDLGNBQWMsQ0FBQyxjQUFjLEVBQUU7aUJBQzFCLElBQUksQ0FBQyxDQUFDLE9BQU87Z0JBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztnQkFDckIsSUFBSSxFQUFFLENBQUM7WUFDWCxDQUFDLENBQUMsQ0FBQztRQUNYLENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLGlDQUFpQyxFQUFFLFVBQVUsSUFBSTtZQUNoRCxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO1lBQ25CLGNBQWMsQ0FBQyxzQkFBc0IsRUFBRTtpQkFDbEMsSUFBSSxDQUFDLENBQUMsT0FBTztnQkFDVixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO2dCQUNyQixJQUFJLEVBQUUsQ0FBQztZQUNYLENBQUMsQ0FBQyxDQUFDO1FBQ1gsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQUMsb0NBQW9DLEVBQUUsVUFBVSxJQUFJO1lBQ25ELElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDcEIsY0FBYyxDQUFDLFNBQVMsQ0FBQywyQkFBMkIsQ0FBQztpQkFDaEQsSUFBSSxDQUFDLENBQUMsT0FBTztnQkFDVixJQUFJLEVBQUUsQ0FBQztZQUNYLENBQUMsQ0FBQyxDQUFDO1FBQ1gsQ0FBQyxDQUFDLENBQUM7UUFDSCxFQUFFLENBQUMsb0NBQW9DLEVBQUUsVUFBVSxJQUFJO1lBQ25ELElBQUksQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7WUFDcEIsY0FBYyxDQUFDLG1CQUFtQixFQUFFLENBQUM7WUFDckMsY0FBYyxDQUFDLFdBQVcsRUFBRSxDQUFDO1lBQzdCLElBQUksRUFBRSxDQUFDO1FBQ1gsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQztBQUNQLENBQUMsQ0FBQyxDQUFDIn0=

View File

@ -1,42 +1,35 @@
import "typings-test"; import "typings-global";
import "should";
import { Dockersock } from "../dist/index"; import { Dockersock } from "../dist/index";
import { expect, tap } from 'tapbundle'
describe("dockersock", function () { tap.test("dockersock", function () {
describe(".Dockersock()", function () { tap.test(function () {
let testDockersock: Dockersock; let testDockersock: Dockersock;
it("should create a new Dockersock instance", function () { tap.ok(function () {
testDockersock = new Dockersock(); testDockersock = new Dockersock();
testDockersock.should.be.instanceof(Dockersock); testDockersock.should.be.instanceof(Dockersock);
}); }, "should create a new Dockersock instance");
it("should list containers", function (done) { tap.ok("should list containers", function (done) {
testDockersock.listContainers() testDockersock.listContainers()
.then((dataArg) => { .then((dataArg) => {
console.log(dataArg); console.log(dataArg);
done(); done();
}); });
}); });
it("should list detailed containers", function (done) { tap.ok(function (done) {
this.timeout(5000);
testDockersock.listContainersDetailed() testDockersock.listContainersDetailed()
.then((dataArg) => { .then((dataArg) => {
console.log(dataArg); console.log(dataArg);
done(); done();
}); });
}); }, "should list detailed containers");
it("should pull an image from imagetag", function (done) { tap.ok(function () {
this.timeout(60000); return testDockersock.pullImage("hosttoday/ht-docker-dbase")
testDockersock.pullImage("hosttoday/ht-docker-dbase") }, "should pull an image from imagetag");
.then((dataArg) => { tap.ok(function (done) {
done();
});
});
it("should return a change Objservable", function (done) {
this.timeout(10000);
testDockersock.getChangeObservable(); testDockersock.getChangeObservable();
testDockersock.endRequests(); testDockersock.endRequests();
done(); done();
}) }, "should return a change Objservable")
}); });
}); });

View File

@ -2,9 +2,12 @@ import "typings-global"
import * as plugins from "./dockersock.plugins"; import * as plugins from "./dockersock.plugins";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
// interfaces
import { Objectmap } from 'lik'
export class Dockersock { export class Dockersock {
sockPath: string; sockPath: string;
requestObjectmap: plugins.lik.Objectmap = new plugins.lik.Objectmap(); requestObjectmap = new plugins.lik.Objectmap<plugins.request.Request>();
constructor(pathArg: string = "http://unix:/var/run/docker.sock:") { constructor(pathArg: string = "http://unix:/var/run/docker.sock:") {
this.sockPath = pathArg; this.sockPath = pathArg;
} }
@ -138,7 +141,7 @@ export class Dockersock {
}; };
}); });
requestStream.on("response", (response) => { requestStream.on("response", (response) => {
this.requestObjectmap.add(response); this.requestObjectmap.add(requestStream);
if (response.statusCode == 200) { if (response.statusCode == 200) {
plugins.beautylog.ok("request returned status 200, so we are good!"); plugins.beautylog.ok("request returned status 200, so we are good!");
} else { } else {
@ -201,7 +204,7 @@ export class Dockersock {
}; };
}); });
requestStream.on("response", (response) => { requestStream.on("response", (response) => {
this.requestObjectmap.add(response); this.requestObjectmap.add(requestStream);
if (response.statusCode == 200) { if (response.statusCode == 200) {
plugins.beautylog.ok("request returned status 200, so we are good!"); plugins.beautylog.ok("request returned status 200, so we are good!");
} else { } else {

1957
yarn.lock Normal file

File diff suppressed because it is too large Load Diff