Comparing version 3.8.0 to 3.9.0
{ | ||
"name": "devlab", | ||
"version": "3.8.0", | ||
"version": "3.9.0", | ||
"description": "Node utility for running containerized tasks", | ||
@@ -71,2 +71,3 @@ "keywords": [ | ||
"os-tmpdir": "^1.0.2", | ||
"semver-compare": "^1.0.0", | ||
"shortid": "^2.2.6", | ||
@@ -73,0 +74,0 @@ "update-notifier": "^2.1.0" |
@@ -1,2 +0,2 @@ | ||
[![CircleCI branch](https://img.shields.io/circleci/project/TechnologyAdvice/DevLab/master.svg?maxAge=2592000)]() | ||
[![Travis branch](https://img.shields.io/travis/TechnologyAdvice/DevLab/master.svg)](https://travis-ci.org/TechnologyAdvice/DevLab) | ||
[![Code Climate](https://codeclimate.com/github/TechnologyAdvice/DevLab/badges/gpa.svg)](https://codeclimate.com/github/TechnologyAdvice/DevLab) | ||
@@ -3,0 +3,0 @@ [![codecov](https://codecov.io/gh/TechnologyAdvice/DevLab/branch/master/graph/badge.svg)](https://codecov.io/gh/TechnologyAdvice/DevLab) |
@@ -106,4 +106,3 @@ 'use strict' | ||
const cwd = process.cwd() | ||
/* istanbul ignore next */ | ||
const serviceArgs = process.env.DEVLAB_NO_RM ? ['run', '-d', '--privileged'] : ['run', '-d', '--rm', '--privileged'] | ||
const serviceArgs = cfg.rmOnShutdown ? ['run', '-d', '--privileged'] : ['run', '-d', '--rm', '--privileged'] | ||
let args = primary ? ['run', '--rm', '-it', '-v', `${cwd}:${cwd}`, '-v', `${tmpdir}:${tmpdir}`, '-w', cwd, '--privileged'] : serviceArgs | ||
@@ -110,0 +109,0 @@ args = args.concat(_.flatten([ |
@@ -34,3 +34,3 @@ 'use strict' | ||
*/ | ||
getConfig: () => { | ||
getConfig: (rmOnShutdown) => { | ||
return Promise.resolve() | ||
@@ -40,3 +40,3 @@ .then(args.parse) | ||
const cfg = services.filterEnabled(_.merge(config.load(parsedArgs.configPath), parsedArgs)) | ||
return { services: services.get(cfg), primary: command.get(cfg, 'primary', tmpdir, true) } | ||
return { services: services.get(cfg), primary: command.get(_.merge(cfg, { rmOnShutdown }), 'primary', tmpdir, true) } | ||
}) | ||
@@ -71,6 +71,6 @@ }, | ||
*/ | ||
stopServices: () => { | ||
stopServices: (cfg) => { | ||
if (!services.running.length) return Promise.resolve() | ||
const servicesStopSpinner = output.spinner('Stopping services') | ||
return services.stop() | ||
return services.stop(cfg) | ||
.then(() => servicesStopSpinner.succeed()) | ||
@@ -107,2 +107,3 @@ .catch((err) => { | ||
.then(instance.checkForUpdates) | ||
.then(utils.checkVersion) | ||
.then(instance.getConfig) | ||
@@ -115,3 +116,3 @@ .then(cfg => { | ||
.then(instance.runCommand) | ||
.then(instance.stopServices) | ||
.then(() => instance.stopServices(cfg)) | ||
}) | ||
@@ -118,0 +119,0 @@ .catch((e) => { |
@@ -64,3 +64,3 @@ 'use strict' | ||
stopTimeSecs: services.getStopTimeSecs(cfg, value), | ||
args: command.get(value, name, null) | ||
args: command.get(_.merge(value, { rmOnShutdown: cfg.rmOnShutdown }), name, null) | ||
})]), cfg.services), | ||
@@ -95,3 +95,3 @@ /** | ||
*/ | ||
stop: () => { | ||
stop: (cfg) => { | ||
const errors = [] | ||
@@ -101,3 +101,6 @@ return Promise.all( | ||
_.filter(svc => _.test(/dl_/, svc.name)), | ||
_.map(svc => proc.run(['stop', '-t', svc.stopTimeSecs, svc.name], true).catch(() => errors.push(svc.name))) | ||
_.map(svc => proc.run(['stop', '-t', svc.stopTimeSecs, svc.name], true) | ||
.then(() => cfg.rmOnShutdown ? proc.run(['rm', svc.name], true) : Promise.resolve()) | ||
.catch(() => errors.push(svc.name)) | ||
) | ||
])(services.running)) | ||
@@ -104,0 +107,0 @@ .then(() => { |
@@ -7,2 +7,3 @@ 'use strict' | ||
const cp = require('child_process') | ||
const cmp = require('semver-compare') | ||
@@ -92,5 +93,18 @@ /* istanbul ignore next: just a helper, will fail other tests */ | ||
return true | ||
}) | ||
}), | ||
/** | ||
* Parses Docker version information and stores version globally, or throws error | ||
* if Docker is not installed. | ||
* @returns {object} promise | ||
*/ | ||
checkVersion: () => proc.exec('docker -v') | ||
.then((v) => { | ||
const version = v.split(' ')[2].match(/([^,])/g).join('') | ||
return !!(cmp(version, '1.13') === -1) | ||
}) | ||
.catch(() => { | ||
throw new Error('Docker not installed') | ||
}) | ||
} | ||
module.exports = utils |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
36837
705
10
11
+ Addedsemver-compare@^1.0.0
+ Addedsemver-compare@1.0.0(transitive)