Comparing version 3.9.0 to 3.10.0
{ | ||
"name": "devlab", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"description": "Node utility for running containerized tasks", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
[![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) | ||
[![codecov](https://codecov.io/gh/TechnologyAdvice/DevLab/branch/master/graph/badge.svg)](https://codecov.io/gh/TechnologyAdvice/DevLab) | ||
@@ -144,2 +143,14 @@ | ||
For one-off cases, individual services can also be disabled via the command line: | ||
``` | ||
lab lint -d mongo | ||
``` | ||
or all services: | ||
``` | ||
lab lint --disable-all | ||
``` | ||
## Container Management | ||
@@ -146,0 +157,0 @@ |
@@ -7,2 +7,3 @@ 'use strict' | ||
const utils = require('./utils') | ||
const services = require('./services') | ||
@@ -29,2 +30,4 @@ /* istanbul ignore next */ | ||
'c': { prop: 'configPath', help: 'Run with custom config file path' }, | ||
'd': { action: 'disable', help: 'Disable specified service' }, | ||
'disable-all': { action: 'disableAll', help: 'Disable all configured services' }, | ||
'tasks': { action: 'tasks', help: 'List all available tasks' }, | ||
@@ -35,2 +38,14 @@ 'cleanup': { action: 'cleanupDL', help: 'Stops and removes any non-persisted Devlab containers' }, | ||
/** | ||
* Adds specified service names to disabled list | ||
*/ | ||
disable: () => { | ||
services.disabled = Array.isArray(args.raw.d) ? _.unique(args.raw.d) : [ args.raw.d ] | ||
}, | ||
/** | ||
* Marks all services to be disabled | ||
*/ | ||
disableAll: () => { | ||
services.disableAll = true | ||
}, | ||
/** | ||
* List all available tasks | ||
@@ -37,0 +52,0 @@ */ |
@@ -25,5 +25,14 @@ 'use strict' | ||
const objs = _.filter(_.isType('object'), tasks) | ||
// If any running task doesn't have object config, keep all services | ||
if (objs.length !== tasks.length) return cfg | ||
const svcs = _.chain(t => t.disable === '*' ? _.map(_.keys, cfg.services) : t.disable, objs) | ||
// If any running task doesn't have object config and no services specified in command line, keep all services | ||
if (objs.length !== tasks.length && !services.disabled.length && !services.disableAll) return cfg | ||
const allSvcs = _.map(_.keys, cfg.services) | ||
let svcs | ||
if (services.disableAll) { | ||
svcs = _.flatten(allSvcs) | ||
} else { | ||
svcs = _.unique([ | ||
...services.disabled, | ||
..._.chain(t => t.disable === '*' ? allSvcs : t.disable, objs) | ||
]) | ||
} | ||
// Track which services are disabled by running tasks | ||
@@ -35,3 +44,3 @@ const counts = _.pipe([ | ||
// Add service to list if disabled by all running tasks | ||
services.disabled = _.keys(_.filter(_.equals(objs.length), counts)) | ||
services.disabled = _.keys(_.filter(_.equals(tasks.length), counts)) | ||
/* istanbul ignore if: lots of work, testing doesn't prove anything... */ | ||
@@ -38,0 +47,0 @@ if (!services.disabled.length) return cfg |
37618
729
243