From 7fb326245ec1e92aee8cb62662440049ef0d50fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Cruz?= Date: Fri, 31 May 2013 18:17:32 +0100 Subject: [PATCH] Print update notice. --- bin/bower_new | 2 +- lib/renderers/StandardRenderer.js | 8 +++++--- templates/std/update-notice.std | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 templates/std/update-notice.std diff --git a/bin/bower_new b/bin/bower_new index 57b504a8..1cb6cd3f 100755 --- a/bin/bower_new +++ b/bin/bower_new @@ -86,5 +86,5 @@ notifier = updateNotifier({ }); if (notifier.update && levels.info >= loglevel) { - renderer.updateAvailable(notifier.update); + renderer.updateNotice(notifier.update); } \ No newline at end of file diff --git a/lib/renderers/StandardRenderer.js b/lib/renderers/StandardRenderer.js index 4fabb0f6..45f96bbd 100644 --- a/lib/renderers/StandardRenderer.js +++ b/lib/renderers/StandardRenderer.js @@ -66,11 +66,13 @@ StandardRenderer.prototype.notification = function (notification) { } }; -StandardRenderer.prototype.updateAvailable = function (update) { - // TODO +StandardRenderer.prototype.updateNotice = function (data) { + template('std/update-notice.std', data) + .then(function (str) { + this._write(process.stderr, str); + }.bind(this), this.error.bind(this)); }; - // ------------------------- StandardRenderer.prototype._install = function (installed) { diff --git a/templates/std/update-notice.std b/templates/std/update-notice.std new file mode 100644 index 00000000..e214b7f3 --- /dev/null +++ b/templates/std/update-notice.std @@ -0,0 +1,4 @@ +{{#red}}-----------------------------------------{{/red}} +Update available: {{#yellow}}{{latest}}{{/yellow}} {{#cyan}}(current: {{current}}){{/cyan}} +Run {{#yellow}}npm update -g {{name}}{{/yellow}} to update +{{#red}}-----------------------------------------{{/red}} \ No newline at end of file