plugin installation takes a version now, and queries nbbpm, #2363

better error handling for #2363

upgrades now also call the suggestion route from nbbpm

upgrade button will show alert now if you try to upgrade past the suggested version, #2363
This commit is contained in:
Julian Lam
2014-11-07 13:46:16 -05:00
parent 0f66077bf5
commit 19297e2d22
4 changed files with 93 additions and 43 deletions

View File

@@ -550,7 +550,7 @@ var fs = require('fs'),
});
};
Plugins.toggleInstall = function(id, callback) {
Plugins.toggleInstall = function(id, version, callback) {
Plugins.isInstalled(id, function(err, installed) {
if (err) {
return callback(err);
@@ -573,7 +573,7 @@ var fs = require('fs'),
npm.load({}, next);
},
function(res, next) {
npm.commands[installed ? 'uninstall' : 'install'](installed ? id : [id], next);
npm.commands[installed ? 'uninstall' : 'install'](installed ? id : [id + '@' + (version || 'latest')], next);
}
], function(err) {
callback(err, {
@@ -584,13 +584,13 @@ var fs = require('fs'),
});
};
Plugins.upgrade = function(id, callback) {
Plugins.upgrade = function(id, version, callback) {
async.waterfall([
function(next) {
npm.load({}, next);
},
function(res, next) {
npm.commands.install([id], next);
npm.commands.install([id + '@' + (version || 'latest')], next);
}
], callback);
};