From e926ac46c9da2a4f9f96f4b74bc97ecc663b08ff Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 9 Jul 2015 08:18:06 -0400 Subject: [PATCH] Remove selfupdate functionality. Notify in all cases. --- build/update.js | 23 ++++++++--------------- lib/update.coffee | 21 +++++++-------------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/build/update.js b/build/update.js index c7df4b62..9bfef2c9 100644 --- a/build/update.js +++ b/build/update.js @@ -1,21 +1,19 @@ (function() { - var packageJSON, updateAction, updateNotifier; + var _, packageJSON, updateNotifier; updateNotifier = require('update-notifier'); + _ = require('lodash'); + + _.str = require('underscore.string'); + packageJSON = require('../package.json'); - updateAction = require('./actions/update'); - - exports.perform = function(callback) { - return updateAction.update.action(null, null, callback); - }; - exports.notify = function(update) { if (!process.stdout.isTTY) { return; } - return console.log("> Major update available: " + update.current + " -> " + update.latest + "\n> Run resin update to update.\n> Beware that a major release might introduce breaking changes.\n"); + return console.log("> " + (_.str.capitalize(update.type)) + " update available: " + update.current + " -> " + update.latest + "\n> Run:\n> $ resin update"); }; exports.check = function(callback) { @@ -23,15 +21,10 @@ notifier = updateNotifier({ pkg: packageJSON }); - if (notifier.update == null) { - return callback(); - } - if (notifier.update.type === 'major') { + if (notifier.update != null) { exports.notify(notifier.update); - return callback(); } - console.log("Performing " + notifier.update.type + " update, hold tight..."); - return exports.perform(callback); + return callback(); }; }).call(this); diff --git a/lib/update.coffee b/lib/update.coffee index c8f3cc6b..6978ce35 100644 --- a/lib/update.coffee +++ b/lib/update.coffee @@ -1,26 +1,19 @@ updateNotifier = require('update-notifier') +_ = require('lodash') +_.str = require('underscore.string') packageJSON = require('../package.json') -updateAction = require('./actions/update') - -exports.perform = (callback) -> - updateAction.update.action(null, null, callback) exports.notify = (update) -> return if not process.stdout.isTTY console.log """ - > Major update available: #{update.current} -> #{update.latest} - > Run resin update to update. - > Beware that a major release might introduce breaking changes.\n + > #{_.str.capitalize(update.type)} update available: #{update.current} -> #{update.latest} + > Run: + > $ resin update """ exports.check = (callback) -> notifier = updateNotifier(pkg: packageJSON) - return callback() if not notifier.update? - - if notifier.update.type is 'major' + if notifier.update? exports.notify(notifier.update) - return callback() - - console.log("Performing #{notifier.update.type} update, hold tight...") - exports.perform(callback) + return callback()