Comparing version 0.0.4 to 0.0.5
@@ -1,2 +0,6 @@ | ||
### 0.0.4-pre | ||
### 0.0.5-pre | ||
* Add cli formatter | ||
* Fix CLI exit code to be the number of non-ok status | ||
### 0.0.4 | ||
* Add CLI with init and check commands | ||
@@ -3,0 +7,0 @@ |
@@ -10,3 +10,3 @@ { | ||
{ "arg": "-s, --setup-file <setupFile>", "desc": "Setup file, default: health.json" }, | ||
{ "arg": "-f, --formatter <formatter>", "desc": "Result formatter: html, text, or xml, default: text" } | ||
{ "arg": "-f, --formatter <formatter>", "desc": "Result formatter: cli, html, text, or xml, default: cli" } | ||
] | ||
@@ -13,0 +13,0 @@ } |
@@ -1,3 +0,5 @@ | ||
var bag = require('bagofholding'), | ||
Health = require('./health'); | ||
var _ = require('underscore'), | ||
bag = require('bagofholding'), | ||
Health = require('./health'), | ||
util = require('util'); | ||
@@ -9,15 +11,26 @@ function _init() { | ||
function _check(args) { | ||
var setup = JSON.parse(bag.cli.lookupFile(args.setupFile || 'health.json')), | ||
opts = { | ||
setup: setup, | ||
formatter: args.formatter || 'text' | ||
}; | ||
new Health(opts).check(bag.cli.exitCb(null, function (result) { | ||
if (Array.isArray(result)) { | ||
result.forEach(function (line) { | ||
function log(result) { | ||
var formatted = require('./formatters/' + (args.formatter || 'cli')).format(result); | ||
if (Array.isArray(formatted)) { | ||
formatted.forEach(function (line) { | ||
console.log(line); | ||
}); | ||
} else { | ||
console.log(result); | ||
console.log(formatted); | ||
} | ||
} | ||
function exit(result) { | ||
var numNonOk = _.countBy(result, function (item) { | ||
return (item.status === 'ok') ? 'ok' : 'non-ok'; | ||
})['non-ok']; | ||
process.exit(numNonOk); | ||
} | ||
var setup = JSON.parse(bag.cli.lookupFile(args.setupFile || 'health.json')); | ||
new Health({ setup: setup }).check(bag.cli.exitCb(null, function (result) { | ||
console.dir(result); | ||
log(result); | ||
exit(result); | ||
})); | ||
@@ -24,0 +37,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"homepage": "http://github.com/cliffano/health", | ||
@@ -35,2 +35,3 @@ "author": "Cliffano Subagio <blah@cliffano.com> (http://blog.cliffano.com)", | ||
"bagofholding": "0.1.6", | ||
"colors": "0.6.0-1", | ||
"fs.extra": "1.2.0", | ||
@@ -37,0 +38,0 @@ "memory-cache": "0.0.5", |
@@ -42,2 +42,6 @@ Health [![Build Status](https://secure.travis-ci.org/cliffano/health.png?branch=master)](http://travis-ci.org/cliffano/health) [![Dependencies Status](https://david-dm.org/cliffano/health.png)](http://david-dm.org/cliffano/health) | ||
From command-line: | ||
health -f html -s health.json check | ||
Configuration | ||
@@ -44,0 +48,0 @@ ------------- |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
18438
18
337
122
9
5
+ Addedcolors@0.6.0-1
+ Addedcolors@0.6.0-1(transitive)