Hello community, here is the log from the commit of package nodejs-npmlog for openSUSE:Factory checked in at 2015-07-02 22:42:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-npmlog (Old) and /work/SRC/openSUSE:Factory/.nodejs-npmlog.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-npmlog" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-npmlog/nodejs-npmlog.changes 2015-04-27 13:02:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-npmlog.new/nodejs-npmlog.changes 2015-07-02 22:42:25.000000000 +0200 @@ -1,0 +2,10 @@ +Sat Jun 27 06:29:08 UTC 2015 - i...@marguerite.su + +- update version 1.2.1 + +------------------------------------------------------------------- +Fri Apr 24 12:35:17 UTC 2015 - hvo...@suse.com + +- Update to version 1.2.0 + +------------------------------------------------------------------- Old: ---- npmlog-0.1.1.tgz New: ---- npmlog-1.2.1.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-npmlog.spec ++++++ --- /var/tmp/diff_new_pack.qXthH1/_old 2015-07-02 22:42:26.000000000 +0200 +++ /var/tmp/diff_new_pack.qXthH1/_new 2015-07-02 22:42:26.000000000 +0200 @@ -19,7 +19,7 @@ %define base_name npmlog Name: nodejs-npmlog -Version: 0.1.1 +Version: 1.2.1 Release: 0 Summary: NPM log utility License: BSD-2-Clause ++++++ npmlog-0.1.1.tgz -> npmlog-1.2.1.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/LICENSE new/package/LICENSE --- old/package/LICENSE 2012-07-24 03:28:42.000000000 +0200 +++ new/package/LICENSE 2015-05-19 03:40:18.000000000 +0200 @@ -1,27 +1,15 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. +The ISC License -The BSD License +Copyright (c) Isaac Z. Schlueter and Contributors -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/README.md new/package/README.md --- old/package/README.md 2012-06-06 11:11:18.000000000 +0200 +++ new/package/README.md 2015-05-19 03:39:25.000000000 +0200 @@ -80,6 +80,26 @@ Disable colors on all messages. +## log.enableProgress() + +Enable the display of log activity spinner and progress bar + +## log.disableProgress() + +Disable the display of a progress bar + +## log.enableUnicode() + +Force the unicode theme to be used for the progress bar. + +## log.disableUnicode() + +Disable the use of unicode in the progress bar. + +## log.setGaugeTemplate(template) + +Overrides the default gauge template. + ## log.pause() Stop emitting messages to the stream, but do not drop them. @@ -123,6 +143,28 @@ will cause all log messages to be suppressed. If the number is `-Infinity`, then the only way to show it is to enable all log messages. +## log.newItem(name, todo, weight) + +* `name` {String} Optional; progress item name. +* `todo` {Number} Optional; total amount of work to be done. Default 0. +* `weight` {Number} Optional; the weight of this item relative to others. Default 1. + +This adds a new `are-we-there-yet` item tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `Tracker` object. + +## log.newStream(name, todo, weight) + +This adds a new `are-we-there-yet` stream tracker to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerStream` object. + +## log.newGroup(name, weight) + +This adds a new `are-we-there-yet` tracker group to the progress tracker. The +object returned has the `log[level]` methods but is otherwise an +`are-we-there-yet` `TrackerGroup` object. + # Events Events are all emitted with the message object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/log.js new/package/log.js --- old/package/log.js 2013-07-11 08:15:43.000000000 +0200 +++ new/package/log.js 2015-05-19 03:39:25.000000000 +0200 @@ -1,3 +1,6 @@ +'use strict' +var Progress = require('are-we-there-yet') +var Gauge = require('gauge') var EE = require('events').EventEmitter var log = exports = module.exports = new EE var util = require('util') @@ -20,6 +23,88 @@ // default level log.level = 'info' +log.gauge = new Gauge(log.cursor) +log.tracker = new Progress.TrackerGroup() + +// no progress bars unless asked +log.progressEnabled = false + +var gaugeTheme = undefined + +log.enableUnicode = function () { + gaugeTheme = Gauge.unicode + log.gauge.setTheme(gaugeTheme) +} + +log.disableUnicode = function () { + gaugeTheme = Gauge.ascii + log.gauge.setTheme(gaugeTheme) +} + +var gaugeTemplate = undefined +log.setGaugeTemplate = function (template) { + gaugeTemplate = template + log.gauge.setTemplate(gaugeTemplate) +} + +log.enableProgress = function () { + if (this.progressEnabled) return + this.progressEnabled = true + if (this._pause) return + this.tracker.on('change', this.showProgress) + this.gauge.enable() + this.showProgress() +} + +log.disableProgress = function () { + if (!this.progressEnabled) return + this.clearProgress() + this.progressEnabled = false + this.tracker.removeListener('change', this.showProgress) + this.gauge.disable() +} + +var trackerConstructors = ['newGroup', 'newItem', 'newStream'] + +var mixinLog = function (tracker) { + // mixin the public methods from log into the tracker + // (except: conflicts and one's we handle specially) + Object.keys(log).forEach(function (P) { + if (P[0] === '_') return + if (trackerConstructors.filter(function (C) { return C === P }).length) return + if (tracker[P]) return + if (typeof log[P] !== 'function') return + var func = log[P] + tracker[P] = function () { + return func.apply(log, arguments) + } + }) + // if the new tracker is a group, make sure any subtrackers get + // mixed in too + if (tracker instanceof Progress.TrackerGroup) { + trackerConstructors.forEach(function (C) { + var func = tracker[C] + tracker[C] = function () { return mixinLog(func.apply(tracker, arguments)) } + }) + } + return tracker +} + +// Add tracker constructors to the top level log object +trackerConstructors.forEach(function (C) { + log[C] = function () { return mixinLog(this.tracker[C].apply(this.tracker, arguments)) } +}) + +log.clearProgress = function () { + if (!this.progressEnabled) return + this.gauge.hide() +} + +log.showProgress = function (name) { + if (!this.progressEnabled) return + this.gauge.show(name, this.tracker.completed()) +}.bind(log) // bind for use in tracker's on-change listener + // temporarily stop emitting, but don't drop log.pause = function () { this._paused = true @@ -34,6 +119,7 @@ b.forEach(function (m) { this.emitLog(m) }, this) + if (this.progressEnabled) this.enableProgress() } log._buffer = [] @@ -88,6 +174,7 @@ this._buffer.push(m) return } + if (this.progressEnabled) this.gauge.pulse(m.prefix) var l = this.levels[m.level] if (l === undefined) return if (l < this.levels[this.level]) return @@ -95,6 +182,7 @@ var style = log.style[m.level] var disp = log.disp[m.level] || m.level + this.clearProgress() m.message.split(/\r?\n/).forEach(function (line) { if (this.heading) { this.write(this.heading, this.headingStyle) @@ -106,12 +194,17 @@ this.write(p, this.prefixStyle) this.write(' ' + line + '\n') }, this) + this.showProgress() } log.write = function (msg, style) { if (!this.cursor) return if (this.stream !== this.cursor.stream) { this.cursor = ansi(this.stream, { enabled: colorEnabled }) + var options = {} + if (gaugeTheme != null) options.theme = gaugeTheme + if (gaugeTemplate != null) options.template = gaugeTemplate + this.gauge = new Gauge(options, this.cursor) } style = style || {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2014-06-14 01:51:00.000000000 +0200 +++ new/package/package.json 2015-05-19 03:40:20.000000000 +0200 @@ -2,7 +2,7 @@ "author": "Isaac Z. Schlueter <i...@izs.me> (http://blog.izs.me/)", "name": "npmlog", "description": "logger for npm", - "version": "0.1.1", + "version": "1.2.1", "repository": { "type": "git", "url": "git://github.com/isaacs/npmlog.git" @@ -12,10 +12,12 @@ "test": "tap test/*.js" }, "dependencies": { - "ansi": "~0.3.0" + "ansi": "~0.3.0", + "are-we-there-yet": "~1.0.0", + "gauge": "~1.2.0" }, "devDependencies": { "tap": "" }, - "license": "BSD" + "license": "ISC" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/progress.js new/package/test/progress.js --- old/package/test/progress.js 1970-01-01 01:00:00.000000000 +0100 +++ new/package/test/progress.js 2015-05-19 03:39:25.000000000 +0200 @@ -0,0 +1,114 @@ +'use strict' + +var test = require('tap').test +var log = require('../log.js') + +var actions = [] +log.gauge = { + enable: function () { + actions.push(['enable']) + }, + disable: function () { + actions.push(['disable']) + }, + hide: function () { + actions.push(['hide']) + }, + show: function (name, completed) { + actions.push(['show', name, completed]) + }, + pulse: function (name) { + actions.push(['pulse', name]) + } +} + +function didActions(t, msg, output) { + var tests = [] + for (var ii = 0; ii < output.length; ++ ii) { + for (var jj = 0; jj < output[ii].length; ++ jj) { + tests.push({cmd: ii, arg: jj}) + } + } + t.is(actions.length, output.length, msg) + tests.forEach(function (test) { + t.is(actions[test.cmd] ? actions[test.cmd][test.arg] : null, + output[test.cmd][test.arg], + msg + ': ' + output[test.cmd] + (test.arg ? ' arg #'+test.arg : '')) + }) + actions = [] +} + + +test('enableProgress', function (t) { + t.plan(6) + log.enableProgress() + didActions(t, 'enableProgress', [ [ 'enable' ], [ 'show', undefined, 0 ] ]) + log.enableProgress() + didActions(t, 'enableProgress again', []) +}) + +test('disableProgress', function (t) { + t.plan(4) + log.disableProgress() + didActions(t, 'disableProgress', [ [ 'hide' ], [ 'disable' ] ]) + log.disableProgress() + didActions(t, 'disableProgress again', []) +}) + +test('showProgress', function (t) { + t.plan(5) + log.showProgress('foo') + didActions(t, 'showProgress disabled', []) + log.enableProgress() + actions = [] + log.showProgress('foo') + didActions(t, 'showProgress', [ [ 'show', 'foo', 0 ] ]) +}) + +test('clearProgress', function (t) { + t.plan(3) + log.clearProgress() + didActions(t, 'clearProgress', [ [ 'hide' ] ]) + log.disableProgress() + actions = [] + log.clearProgress() + didActions(t, 'clearProgress disabled', [ ]) +}) + +test("newItem", function (t) { + t.plan(12) + log.enableProgress() + actions = [] + var a = log.newItem("test", 10) + didActions(t, "newItem", [ [ 'show', undefined, 0 ] ]) + a.completeWork(5) + didActions(t, "newItem:completeWork", [ [ 'show', 'test', 0.5 ] ]) + a.finish() + didActions(t, "newItem:finish", [ [ 'show', 'test', 1 ] ]) +}) + +// test that log objects proxy through. And test that completion status filters up +test("newGroup", function (t) { + t.plan(23) + var a = log.newGroup("newGroup") + didActions(t, "newGroup", [ [ 'show', undefined, 0.5 ] ]) + a.warn("test", "this is a test") + didActions(t, "newGroup:warn", [ [ 'pulse', 'test' ], [ 'hide' ], [ 'show', undefined, 0.5 ] ]) + var b = a.newItem("newGroup2", 10) + didActions(t, "newGroup:newItem", [ [ 'show', 'newGroup', 0.5 ] ]) + b.completeWork(5) + didActions(t, "newGroup:completeWork", [ [ 'show', 'newGroup2', 0.75 ] ]) + a.finish() + didActions(t, "newGroup:finish", [ [ 'show', 'newGroup', 1 ] ]) +}) + +test("newStream", function (t) { + t.plan(13) + var a = log.newStream("newStream", 10) + didActions(t, "newStream", [ [ 'show', undefined, 0.6666666666666666 ] ]) + a.write("abcde") + didActions(t, "newStream", [ [ 'show', 'newStream', 0.8333333333333333 ] ]) + a.write("fghij") + didActions(t, "newStream", [ [ 'show', 'newStream', 1 ] ]) + t.is(log.tracker.completed(), 1, "Overall completion") +})