docker-cli-js
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -11,5 +11,5 @@ export declare class Docker { | ||
export declare class Options implements IOptions { | ||
machineName: string; | ||
currentWorkingDirectory: string; | ||
constructor(machineName?: string, currentWorkingDirectory?: string); | ||
machineName?: string | undefined; | ||
currentWorkingDirectory?: string | undefined; | ||
constructor(machineName?: string | undefined, currentWorkingDirectory?: string | undefined); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const _ = require("lodash"); | ||
const child_process = require("child_process"); | ||
const nodeify_ts_1 = require("nodeify-ts"); | ||
const cli_table_2_json_1 = require("cli-table-2-json"); | ||
const dockermachine_cli_js_1 = require("dockermachine-cli-js"); | ||
const _ = require("lodash"); | ||
const nodeify_ts_1 = require("nodeify-ts"); | ||
const exec = child_process.exec; | ||
const splitLines = function (input) { | ||
return input.replace(/\r/g, '').split('\n'); | ||
return input.replace(/\r/g, "").split("\n"); | ||
}; | ||
@@ -18,5 +18,5 @@ const array2Oject = function (lines) { | ||
} | ||
const parts = line.split(':'); | ||
const parts = line.split(":"); | ||
let key = parts[0]; | ||
let value = parts.slice(1).join(':'); | ||
const value = parts.slice(1).join(":"); | ||
key = _.snakeCase(key); | ||
@@ -31,3 +31,3 @@ object[key] = value.trim(); | ||
re: / build /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -37,4 +37,4 @@ lines.forEach(function (line) { | ||
const str = line; | ||
let m; | ||
if ((m = re.exec(str)) !== null) { | ||
const m = re.exec(str); | ||
if (m !== null) { | ||
if (m.index === re.lastIndex) { | ||
@@ -55,3 +55,3 @@ re.lastIndex++; | ||
re: / run /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
resultp.containerId = resultp.raw.trim(); | ||
@@ -63,3 +63,3 @@ return resultp; | ||
re: / ps /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -72,3 +72,3 @@ resultp.containerList = cli_table_2_json_1.cliTable2Json(lines); | ||
re: / images /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -83,3 +83,3 @@ //const debug = require('debug')('docker-cli-js:lib/index.js extractResult images'); | ||
re: / network ls /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -94,3 +94,3 @@ //const debug = require('debug')('docker-cli-js:lib/index.js extractResult images'); | ||
re: / inspect /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const object = JSON.parse(resultp.raw); | ||
@@ -103,3 +103,3 @@ resultp.object = object; | ||
re: / info /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -112,3 +112,3 @@ resultp.object = array2Oject(lines); | ||
re: / search /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
const lines = splitLines(resultp.raw); | ||
@@ -121,3 +121,3 @@ resultp.images = cli_table_2_json_1.cliTable2Json(lines); | ||
re: / login /, | ||
run: function (resultp) { | ||
run(resultp) { | ||
resultp.login = resultp.raw.trim(); | ||
@@ -131,4 +131,4 @@ return resultp; | ||
const str = result.command; | ||
let m; | ||
if ((m = re.exec(str)) !== null) { | ||
const m = re.exec(str); | ||
if (m !== null) { | ||
if (m.index === re.lastIndex) { | ||
@@ -146,15 +146,15 @@ re.lastIndex++; | ||
constructor(options = { | ||
currentWorkingDirectory: undefined, | ||
machineName: undefined, | ||
}) { | ||
currentWorkingDirectory: undefined, | ||
machineName: undefined, | ||
}) { | ||
this.options = options; | ||
} | ||
command(command, callback) { | ||
let docker = this; | ||
let execCommand = 'docker '; | ||
let machineconfig = ''; | ||
const docker = this; | ||
let execCommand = "docker "; | ||
let machineconfig = ""; | ||
const promise = Promise.resolve().then(function () { | ||
if (docker.options.machineName) { | ||
const dockerMachine = new dockermachine_cli_js_1.DockerMachine(); | ||
return dockerMachine.command('config ' + docker.options.machineName).then(function (data) { | ||
return dockerMachine.command("config " + docker.options.machineName).then(function (data) { | ||
//console.log('data = ', data); | ||
@@ -165,7 +165,7 @@ machineconfig = data.machine.config; | ||
}).then(function () { | ||
execCommand += ' ' + machineconfig + ' ' + command + ' '; | ||
let execOptions = { | ||
execCommand += " " + machineconfig + " " + command + " "; | ||
const execOptions = { | ||
cwd: docker.options.currentWorkingDirectory, | ||
env: { | ||
DEBUG: '', | ||
DEBUG: "", | ||
HOME: process.env.HOME, | ||
@@ -191,3 +191,3 @@ PATH: process.env.PATH, | ||
//console.log('data:', data); | ||
let result = { | ||
const result = { | ||
command: execCommand, | ||
@@ -194,0 +194,0 @@ raw: data.result, |
{ | ||
"name": "docker-cli-js", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "A node.js wrapper for the docker command line interface CLI", | ||
@@ -32,18 +32,18 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/node": "~7.0.18", | ||
"@types/blue-tape": "~0.1.31", | ||
"blue-tape": "~0.2.0", | ||
"rimraf": "~2.5.2", | ||
"tap-diff": "~0.1.1", | ||
"ts-node": "~3.0.4", | ||
"tslint": "~3.10.2", | ||
"typescript": "~2.3.2" | ||
"@types/node": "10.9.1", | ||
"@types/blue-tape": "0.1.32", | ||
"blue-tape": "1.0.0", | ||
"rimraf": "2.6.2", | ||
"tap-diff": "0.1.1", | ||
"ts-node": "7.0.1", | ||
"tslint": "5.11.0", | ||
"typescript": "3.1.0-dev.20180824" | ||
}, | ||
"dependencies": { | ||
"@types/lodash": "~4.14.76", | ||
"cli-table-2-json": "~1.0.8", | ||
"dockermachine-cli-js": "~3.0.2", | ||
"lodash": "~4.12.0", | ||
"nodeify-ts": "~1.0.1" | ||
"@types/lodash": "4.14.116", | ||
"cli-table-2-json": "1.0.11", | ||
"dockermachine-cli-js": "3.0.3", | ||
"lodash": "4.17.10", | ||
"nodeify-ts": "1.0.6" | ||
} | ||
} |
41301
+ Added@ljharb/through@2.3.13(transitive)
+ Added@types/lodash@4.14.116(transitive)
+ Addedcli-table-2-json@1.0.101.0.11(transitive)
+ Addeddockermachine-cli-js@3.0.3(transitive)
+ Addedlodash@4.17.10(transitive)
- Removed@ljharb/through@2.3.14(transitive)
- Removed@types/lodash@4.14.1194.14.202(transitive)
- Removedcli-table-2-json@1.0.13(transitive)
- Removeddockermachine-cli-js@3.0.5(transitive)
- Removedlodash@4.12.04.17.21(transitive)
Updated@types/lodash@4.14.116
Updatedcli-table-2-json@1.0.11
Updateddockermachine-cli-js@3.0.3
Updatedlodash@4.17.10
Updatednodeify-ts@1.0.6