diff options
author | Rebecca Turner <me@re-becca.org> | 2015-07-07 23:44:20 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-07-07 23:44:20 +0300 |
commit | a78f81ae1ab917578425a4c8abf97a0c650a7157 (patch) | |
tree | 301fdda2d87b2efa52ad56ad2cfdded2ada2f4e9 /node_modules/gauge | |
parent | b375b77878e27c706074b929ec3d1cb7645265a0 (diff) |
gauge@1.2.1
PR-URL: https://github.com/iarna/gauge/pull/3
Fixes: https://github.com/npm/npm/issues/8812
Diffstat (limited to 'node_modules/gauge')
-rw-r--r-- | node_modules/gauge/README.md | 6 | ||||
-rw-r--r-- | node_modules/gauge/package.json | 36 | ||||
-rw-r--r-- | node_modules/gauge/progress-bar.js | 6 | ||||
-rw-r--r-- | node_modules/gauge/test/progress-bar.js | 32 |
4 files changed, 55 insertions, 25 deletions
diff --git a/node_modules/gauge/README.md b/node_modules/gauge/README.md index fb9eb0a7d..f996299da 100644 --- a/node_modules/gauge/README.md +++ b/node_modules/gauge/README.md @@ -117,7 +117,7 @@ will be turned into the gauge line. The default template is: ```javascript [ - {type: "name", separated: true, maxLength: 25, minWidth: 25, align: "left"}, + {type: "name", separated: true, maxLength: 25, minLength: 25, align: "left"}, {type: "spinner", separated: true}, {type: "startgroup"}, {type: "completionbar"}, @@ -131,7 +131,7 @@ be be included verbatum in the output. If the template element is an object, it can have the following keys: * *type* can be: - * `name` – The most recent name passed to `show`; if this is in response to a + * `name` – The most recent name passed to `show`; if this is in response to a `pulse` then the name passed to `pulse` will be appended along with the subsection property from the theme. * `spinner` – If you've ever called `pulse` this will be one of the characters @@ -148,7 +148,7 @@ If the template element is an object, it can have the following keys: will be padded according to the *align* value. * *align* – (Default: left) Possible values "left", "right" and "center". Works as you'd expect from word processors. -* *length* – Provides a single value for both *minLength* and *maxLength*. If both +* *length* – Provides a single value for both *minLength* and *maxLength*. If both *length* and *minLength or *maxLength* are specifed then the latter take precedence. ### Tracking Completion diff --git a/node_modules/gauge/package.json b/node_modules/gauge/package.json index ba69205a3..58a46abdb 100644 --- a/node_modules/gauge/package.json +++ b/node_modules/gauge/package.json @@ -1,37 +1,37 @@ { "_args": [ [ - "gauge@~1.2.0", - "/Users/rebecca/code/npm/node_modules/npmlog" + "gauge", + "/Users/rebecca/code/npm" ] ], - "_from": "gauge@>=1.2.0 <1.3.0", - "_id": "gauge@1.2.0", + "_from": "gauge@*", + "_id": "gauge@1.2.1", "_inCache": true, "_location": "/gauge", - "_nodeVersion": "1.1.0", + "_nodeVersion": "0.10.38", "_npmUser": { "email": "me@re-becca.org", "name": "iarna" }, - "_npmVersion": "2.6.0", + "_npmVersion": "3.1.0", "_phantomChildren": {}, "_requested": { "name": "gauge", - "raw": "gauge@~1.2.0", - "rawSpec": "~1.2.0", + "raw": "gauge", + "rawSpec": "", "scope": null, - "spec": ">=1.2.0 <1.3.0", + "spec": "*", "type": "range" }, "_requiredBy": [ + "#USER", "/npmlog" ], - "_resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.0.tgz", - "_shasum": "3094ab1285633f799814388fc8f2de67b4c012c5", + "_shasum": "923d55c9c6669ff9ce37528b50b40acadb15f63c", "_shrinkwrap": null, - "_spec": "gauge@~1.2.0", - "_where": "/Users/rebecca/code/npm/node_modules/npmlog", + "_spec": "gauge", + "_where": "/Users/rebecca/code/npm", "author": { "email": "me@re-becca.org", "name": "Rebecca Turner" @@ -52,10 +52,10 @@ }, "directories": {}, "dist": { - "shasum": "3094ab1285633f799814388fc8f2de67b4c012c5", - "tarball": "http://registry.npmjs.org/gauge/-/gauge-1.2.0.tgz" + "shasum": "923d55c9c6669ff9ce37528b50b40acadb15f63c", + "tarball": "http://registry.npmjs.org/gauge/-/gauge-1.2.1.tgz" }, - "gitHead": "db15c35374816b3fc3b9e1e54866f31ed7f4a733", + "gitHead": "3034dd52a902e54c8132830c0482c3c53e9ad94c", "homepage": "https://github.com/iarna/gauge", "keywords": [ "gauge", @@ -74,10 +74,10 @@ "optionalDependencies": {}, "repository": { "type": "git", - "url": "https://github.com/iarna/gauge" + "url": "git+https://github.com/iarna/gauge.git" }, "scripts": { "test": "tap test/*.js" }, - "version": "1.2.0" + "version": "1.2.1" } diff --git a/node_modules/gauge/progress-bar.js b/node_modules/gauge/progress-bar.js index 39dbf2ac4..67f4100a8 100644 --- a/node_modules/gauge/progress-bar.js +++ b/node_modules/gauge/progress-bar.js @@ -11,8 +11,10 @@ function isTTY() { return process.stderr.isTTY } function getWritableTTYColumns() { - // One less than the actual as writing to the final column wraps the line - return process.stderr.columns - 1 + // Writing to the final column wraps the line + // We have to use stdout here, because Node's magic SIGWINCH handler only + // updates process.stdout, not process.stderr + return process.stdout.columns - 1 } var ProgressBar = module.exports = function (options, cursor) { diff --git a/node_modules/gauge/test/progress-bar.js b/node_modules/gauge/test/progress-bar.js index 8e2a5ad64..39939269f 100644 --- a/node_modules/gauge/test/progress-bar.js +++ b/node_modules/gauge/test/progress-bar.js @@ -70,7 +70,7 @@ test("hide", function (t) { test("renderTemplate", function (t) { t.plan(16) - process.stderr.columns = 11 + process.stdout.columns = 11 var result = bar.renderTemplate(ProgressBar.ascii,[{type: "name"}],{name: "NAME"}) t.is(result, "NAME", "name substitution") var result = bar.renderTemplate(ProgressBar.ascii,[{type: "completionbar"}],{completed: 0}) @@ -108,7 +108,7 @@ test("renderTemplate", function (t) { test("show & pulse", function (t) { t.plan(23) - process.stderr.columns = 16 + process.stdout.columns = 16 cursor = [] process.stderr.isTTY = false bar.template[0].length = 6 @@ -146,3 +146,31 @@ test("show & pulse", function (t) { [ 'write', 'S -> P | |----|\n' ], [ 'show' ] ]) }) + +test("window resizing", function (t) { + t.plan(16) + process.stderr.isTTY = true + process.stdout.columns = 32 + bar.show("NAME", 0.1) + cursor = [] + bar.last = new Date(0) + bar.pulse() + isOutput(t, "32 columns", + [ [ 'up', 1 ], + [ 'hide' ], + [ 'horizontalAbsolute', 0 ], + [ 'write', 'NAME / |##------------------|\n' ], + [ 'show' ] ]) + + process.stdout.columns = 16 + bar.show("NAME", 0.5) + cursor = [] + bar.last = new Date(0) + bar.pulse() + isOutput(t, "16 columns", + [ [ 'up', 1 ], + [ 'hide' ], + [ 'horizontalAbsolute', 0 ], + [ 'write', 'NAME - |##--|\n' ], + [ 'show' ] ]); +}); |