improve README
This commit is contained in:
		
							
								
								
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,6 +1,4 @@ | ||||
| docs/ | ||||
| coverage/ | ||||
| node_modules/ | ||||
| .yarn/ | ||||
| node_modules/ | ||||
| coverage/ | ||||
| public/ | ||||
| pages/ | ||||
|   | ||||
| @@ -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 | ||||
|     - 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 | ||||
							
								
								
									
										29
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,11 +1,25 @@ | ||||
| # dockersock | ||||
| easy communication with docker remote api from node, TypeScript ready | ||||
|  | ||||
| ## Status | ||||
| [](https://gitlab.com/pushrocks/dockersock/commits/master) | ||||
| ## Availabililty | ||||
| [](https://www.npmjs.com/package/dockersock) | ||||
| [](https://GitLab.com/mojoio/dockersock) | ||||
| [](https://github.com/mojoio/dockersock) | ||||
| [](https://mojoio.gitlab.io/dockersock/) | ||||
|  | ||||
| ## Status for master | ||||
| [](https://GitLab.com/mojoio/dockersock/commits/master) | ||||
| [](https://GitLab.com/mojoio/dockersock/commits/master) | ||||
| [](https://www.npmjs.com/package/dockersock) | ||||
| [](https://david-dm.org/mojoio/dockersock) | ||||
| [](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm) | ||||
| [](https://www.bithound.io/github/mojoio/dockersock) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](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" | ||||
| }) | ||||
|  | ||||
| ``` | ||||
| ``` | ||||
|  | ||||
| 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) | ||||
|  | ||||
| [](https://mojo.io) | ||||
|   | ||||
							
								
								
									
										49
									
								
								docs/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								docs/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| # dockersock | ||||
| easy communication with docker remote api from node, TypeScript ready | ||||
|  | ||||
| ## Availabililty | ||||
| [](https://www.npmjs.com/package/dockersock) | ||||
| [](https://GitLab.com/mojoio/dockersock) | ||||
| [](https://github.com/mojoio/dockersock) | ||||
| [](https://mojoio.gitlab.io/dockersock/) | ||||
|  | ||||
| ## Status for master | ||||
| [](https://GitLab.com/mojoio/dockersock/commits/master) | ||||
| [](https://GitLab.com/mojoio/dockersock/commits/master) | ||||
| [](https://www.npmjs.com/package/dockersock) | ||||
| [](https://david-dm.org/mojoio/dockersock) | ||||
| [](https://www.bithound.io/github/mojoio/dockersock/master/dependencies/npm) | ||||
| [](https://www.bithound.io/github/mojoio/dockersock) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](https://nodejs.org/dist/latest-v6.x/docs/api/) | ||||
| [](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) | ||||
|  | ||||
| [](https://mojo.io) | ||||
							
								
								
									
										61
									
								
								test/test.ts
									
									
									
									
									
								
							
							
						
						
									
										61
									
								
								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") | ||||
|     }); | ||||
| }); | ||||
| }); | ||||
|  | ||||
| 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(); | ||||
| }) | ||||
		Reference in New Issue
	
	Block a user