From 7cc23741307b86fdf3af7992e36e624617fb4afc Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 2 Apr 2017 12:05:29 +0200 Subject: [PATCH] improve README --- .gitignore | 6 ++--- .gitlab-ci.yml | 29 ++++++++++++++++++++---- README.md | 29 ++++++++++++++++++++---- docs/README.md | 49 ++++++++++++++++++++++++++++++++++++++++ test/test.ts | 61 +++++++++++++++++++++++++------------------------- 5 files changed, 131 insertions(+), 43 deletions(-) create mode 100644 docs/README.md diff --git a/.gitignore b/.gitignore index 8909d83..67fa559 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ -docs/ -coverage/ -node_modules/ .yarn/ +node_modules/ +coverage/ public/ -pages/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eda8a77..fbe2f4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,18 @@ -image: hosttoday/ht-docker-dbase:npmts +image: hosttoday/ht-docker-dbase:npmci services: - docker:dind +cache: + paths: + - .yarn/ + key: "$CI_BUILD_STAGE" + stages: - build - test - release - trigger + - pages before_script: - npmci prepare docker-gitlab @@ -32,7 +38,7 @@ test: - priv release: - image: hosttoday/ht-docker-node:npmts + image: hosttoday/ht-docker-node:npmci stage: release script: - npmci publish npm @@ -43,7 +49,7 @@ release: - priv trigger: - image: hosttoday/ht-docker-node:npmts + image: hosttoday/ht-docker-node:npmci stage: trigger script: - npmci trigger @@ -51,4 +57,19 @@ trigger: - tags tags: - lossless - - priv \ No newline at end of file + - priv + +pages: + image: hosttoday/ht-docker-node:npmci + stage: pages + script: + - npmci command yarn global add npmpage + - npmci command npmpage --publish gitlab + tags: + - docker + only: + - tags + artifacts: + expire_in: 1 week + paths: + - public \ No newline at end of file diff --git a/README.md b/README.md index 34eb52f..7ff69fc 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,25 @@ # dockersock easy communication with docker remote api from node, TypeScript ready -## Status -[![build status](https://gitlab.com/pushrocks/dockersock/badges/master/build.svg)](https://gitlab.com/pushrocks/dockersock/commits/master) +## Availabililty +[![npm](https://mojoio.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/dockersock) +[![git](https://mojoio.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/mojoio/dockersock) +[![git](https://mojoio.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/mojoio/dockersock) +[![docs](https://mojoio.gitlab.io/assets/repo-button-docs.svg)](https://mojoio.gitlab.io/dockersock/) + +## Status for master +[![build status](https://GitLab.com/mojoio/dockersock/badges/master/build.svg)](https://GitLab.com/mojoio/dockersock/commits/master) +[![coverage report](https://GitLab.com/mojoio/dockersock/badges/master/coverage.svg)](https://GitLab.com/mojoio/dockersock/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/dockersock.svg)](https://www.npmjs.com/package/dockersock) +[![Dependency Status](https://david-dm.org/mojoio/dockersock.svg)](https://david-dm.org/mojoio/dockersock) +[![bitHound Dependencies](https://www.bithound.io/github/mojoio/dockersock/badges/dependencies.svg)](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/mojoio/dockersock/badges/code.svg)](https://www.bithound.io/github/mojoio/dockersock) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) ## Usage -We recommend the use of TypeScript for best Intellisense. +Use TypeScript for best in class instellisense. ```TypeScript import {Dockersock} from "dockersock"; // require Dockersock class @@ -25,4 +39,11 @@ myDockersock.newContainer({ // start new Container, equals "docker run" shell co image: "someimagetag" }) -``` \ No newline at end of file +``` + +For further information read the linked docs at the top of this README. + +> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) + +[![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io) diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..7ff69fc --- /dev/null +++ b/docs/README.md @@ -0,0 +1,49 @@ +# dockersock +easy communication with docker remote api from node, TypeScript ready + +## Availabililty +[![npm](https://mojoio.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/dockersock) +[![git](https://mojoio.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/mojoio/dockersock) +[![git](https://mojoio.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/mojoio/dockersock) +[![docs](https://mojoio.gitlab.io/assets/repo-button-docs.svg)](https://mojoio.gitlab.io/dockersock/) + +## Status for master +[![build status](https://GitLab.com/mojoio/dockersock/badges/master/build.svg)](https://GitLab.com/mojoio/dockersock/commits/master) +[![coverage report](https://GitLab.com/mojoio/dockersock/badges/master/coverage.svg)](https://GitLab.com/mojoio/dockersock/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/dockersock.svg)](https://www.npmjs.com/package/dockersock) +[![Dependency Status](https://david-dm.org/mojoio/dockersock.svg)](https://david-dm.org/mojoio/dockersock) +[![bitHound Dependencies](https://www.bithound.io/github/mojoio/dockersock/badges/dependencies.svg)](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm) +[![bitHound Code](https://www.bithound.io/github/mojoio/dockersock/badges/code.svg)](https://www.bithound.io/github/mojoio/dockersock) +[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/) +[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) + +## Usage +Use TypeScript for best in class instellisense. + +```TypeScript +import {Dockersock} from "dockersock"; // require Dockersock class + +let myDockersock = new Dockersock(); // optional: you can pass a domain to the contructor, defaults to /var/run/docker.sock + +myDockersock.listContainers() // promise, resolve gets container data +myDockersock.listContainersDetailed() // promise, resolve gets more detailed container data (by combining several requests internally) +myDockersock.listContainersRunning() // promise, resolve gets container data for currently running containers +myDockersock.listContainersStopped() // promise, resolve gets container data for stopped containers + +myDockersock.startContainer({ // starts a already present container + name: "somecontainername" +}) + +myDockersock.newContainer({ // start new Container, equals "docker run" shell command + image: "someimagetag" +}) + +``` + +For further information read the linked docs at the top of this README. + +> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) +| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) + +[![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io) diff --git a/test/test.ts b/test/test.ts index af5136f..060e56f 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,35 +1,34 @@ import "typings-global"; -import { Dockersock } from "../dist/index"; import { expect, tap } from 'tapbundle' -tap.test("dockersock", function () { - tap.test(function () { - let testDockersock: Dockersock; - tap.ok(function () { - testDockersock = new Dockersock(); - testDockersock.should.be.instanceof(Dockersock); - }, "should create a new Dockersock instance"); - tap.ok("should list containers", function (done) { - testDockersock.listContainers() - .then((dataArg) => { - console.log(dataArg); - done(); - }); +import { Dockersock } from "../dist/index"; + +let testDockersock: Dockersock; + +tap.test("should create a new Dockersock instance", async () => { + testDockersock = new Dockersock(); + return expect(testDockersock).to.be.instanceof(Dockersock); +}); + +tap.test("should list containers", async () => { + await testDockersock.listContainers() + .then(async (dataArg) => { + console.log(dataArg); }); - tap.ok(function (done) { - testDockersock.listContainersDetailed() - .then((dataArg) => { - console.log(dataArg); - done(); - }); - }, "should list detailed containers"); - tap.ok(function () { - return testDockersock.pullImage("hosttoday/ht-docker-dbase") - }, "should pull an image from imagetag"); - tap.ok(function (done) { - testDockersock.getChangeObservable(); - testDockersock.endRequests(); - done(); - }, "should return a change Objservable") - }); -}); \ No newline at end of file +}); + +tap.test("should list detailed containers", async () => { + await testDockersock.listContainersDetailed() + .then(async (dataArg) => { + console.log(dataArg); + }); +}); + +tap.test("should pull an image from imagetag", async () => { + await testDockersock.pullImage("hosttoday/ht-docker-dbase") +}); + +tap.test("should return a change Objservable", async () => { + testDockersock.getChangeObservable(); + testDockersock.endRequests(); +}) \ No newline at end of file