Skip to content

Commit

Permalink
Update to version 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Mrak committed Oct 14, 2016
1 parent 1cc1b91 commit 99c80c2
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 26 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Changelog

## unreleased
## 4.0.0

* Adds `hits` to the endpoint data that is returned from the admin portal that represents the amount of times that endpoint has been hit from the stubs portal.
This project has been stable for some time, best we move to actual semver and
not prerelease versioning. This release on the old versioning system would have been release `0.4.0`. It is now `4.0.0` instead.

* __BREAKING CHANGES from 0.3.x__
* The `mute` option has been renamed `quiet` to be more consistent with other cli tools

* __New features__
* Adds `hits` to the endpoint data that is returned from the admin portal that represents the amount of times that endpoint has been hit from the stubs portal.

## 0.3.1

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Some systems require you to `sudo` before running services on port certain ports
## Command-line Switches

```
stubby [-a <port>] [-c <file>] [-d <file>] [-h] [-k <file>] [-l <hostname>] [-m] [-p <file>]
stubby [-a <port>] [-c <file>] [-d <file>] [-h] [-k <file>] [-l <hostname>] [-p <file>] [-q]
[-s <port>] [-t <port>] [-v] [-w]
-a, --admin <port> Port for admin portal. Defaults to 8889.
Expand All @@ -67,7 +67,7 @@ stubby [-a <port>] [-c <file>] [-d <file>] [-h] [-k <file>] [-l <hostname>] [-m]
-h, --help This help text.
-k, --key <file> Private key file. Use with --cert.
-l, --location <hostname> Hostname at which to bind stubby.
-m, --mute Prevent stubby from printing to the console.
-q, --quiet Prevent stubby from printing to the console.
-p, --pfx <file> PFX file. Ignored if used with --key/--cert
-s, --stubs <port> Port for stubs portal. Defaults to 8882.
-t, --tls <port> Port for https stubs portal. Defaults to 7443.
Expand Down Expand Up @@ -675,7 +675,7 @@ What can I do with it, you ask? Read on!
* `cert`: certificate file contents (in PEM format)
* `pfx`: pfx file contents (mutually exclusive with key/cert options)
* `watch`: filename to monitor and load as stubby's data when changes occur
* `mute`: defaults to `true`. Pass in `false` to have console output (if available)
* `quiet`: defaults to `true`. Pass in `false` to have console output (if available)
* `_httpsOptions`: additional options to pass to the [underlying tls
server](http://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener).
* `callback`: takes one parameter: the error message (if there is one), undefined otherwise
Expand Down
4 changes: 2 additions & 2 deletions man/stubby.1
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ And finally, a third "admin" portal that allows viewing configured data and chan

\-l, \-\-location <hostname> Hostname at which to bind stubby.

\-m, \-\-mute Prevent stubby from printing to the console.

\-p, \-\-pfx <file> PFX file. Ignored if used with \-\-key/\-\-cert.

\-q, \-\-quiet Prevent stubby from printing to the console.

\-s, \-\-stubs <port> Port for stubs portal. Defaults to 8882.

\-t, \-\-tls <port> Port for https stubs portal. Defaults to 7443.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stubby",
"preferGlobal": true,
"version": "0.3.1",
"version": "4.0.0",
"author": {
"name": "Eric Mrak",
"email": "mail@ericmrak.info"
Expand Down
4 changes: 2 additions & 2 deletions src/console/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ var options = [{
default: '0.0.0.0',
description: 'Hostname at which to bind stubby.'
}, {
name: 'mute',
flag: 'm',
name: 'quiet',
flag: 'q',
description: 'Prevent stubby from printing to the console.'
}, {
name: 'pfx',
Expand Down
22 changes: 11 additions & 11 deletions src/console/out.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,45 @@ var YELLOW = '\x1B[33m';
var RESET = '\x1B[0m';

var out = {
mute: false,
quiet: false,
log: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(msg);
},
status: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(BOLD + BLACK + msg + RESET);
},
dump: function (data) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.dir(data);
},
info: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.info(BLUE + msg + RESET);
},
ok: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(GREEN + msg + RESET);
},
error: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.error(RED + msg + RESET);
},
warn: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.warn(YELLOW + msg + RESET);
},
incoming: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(CYAN + msg + RESET);
},
notice: function (msg) {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(MAGENTA + msg + RESET);
},
trace: function () {
if (this.mute) { return; }
if (this.quiet) { return; }
console.log(RED);
console.trace();
console.log(RESET);
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function setupStartOptions(options, callback) {
options = {};
}

if (options.mute == null) { options.mute = true; }
if (options.quiet == null) { options.quiet = true; }

defaults = CLI.getArgs([]);
for (key in defaults) {
Expand All @@ -64,7 +64,7 @@ function setupStartOptions(options, callback) {
}
}

out.mute = options.mute;
out.quiet = options.quiet;
return [options, callback];
}

Expand Down
2 changes: 1 addition & 1 deletion test/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var Admin = require('../src/portals/admin').Admin;
var assert = require('assert');

require('../src/console/out').mute = true;
require('../src/console/out').quiet = true;

describe('Admin', function () {
var endpoints, request, response, sut;
Expand Down
4 changes: 2 additions & 2 deletions test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ describe('CLI', function () {
cert: 'a certificate',
pfx: 'a pfx',
tls: '443',
mute: true,
quiet: true,
watch: filename,
datadir: process.cwd(),
help: undefined, // eslint-disable-line no-undefined
Expand All @@ -255,7 +255,7 @@ describe('CLI', function () {
this.sandbox.stub(sut, 'cert').returns(expected.cert);
this.sandbox.stub(sut, 'pfx').returns(expected.pfx);

actual = sut.getArgs(['-s', expected.stubs, '-a', expected.admin, '-d', filename, '-l', expected.location, '-k', 'mocked', '-c', 'mocked', '-p', 'mocked', '-t', expected.tls, '-m', '-w']);
actual = sut.getArgs(['-s', expected.stubs, '-a', expected.admin, '-d', filename, '-l', expected.location, '-k', 'mocked', '-c', 'mocked', '-p', 'mocked', '-t', expected.tls, '-q', '-w']);

assert.deepStrictEqual(actual, expected);
});
Expand Down

0 comments on commit 99c80c2

Please sign in to comment.