Use Manager#installed_plugins information to display updates

This commit is contained in:
Chris Roberts 2016-11-16 13:27:05 -08:00
parent 818f7acb7b
commit ae21c31a6c
1 changed files with 8 additions and 10 deletions

View File

@ -19,17 +19,15 @@ module VagrantPlugins
end end
manager = Vagrant::Plugin::Manager.instance manager = Vagrant::Plugin::Manager.instance
installed_specs = manager.installed_specs installed_plugins = manager.installed_plugins
new_specs = manager.update_plugins(names) new_specs = manager.update_plugins(names)
updated_plugins = manager.installed_plugins
updated = {} updated = {}
installed_specs.each do |ispec| installed_plugins.each do |name, info|
new_specs.each do |uspec| update = updated_plugins[name]
next if uspec.name != ispec.name if update && update["installed_gem_version"] != info["installed_gem_version"]
next if ispec.version >= uspec.version updated[name] = update["installed_gem_version"]
next if updated[uspec.name] && updated[uspec.name].version >= uspec.version
updated[uspec.name] = uspec
end end
end end
@ -37,9 +35,9 @@ module VagrantPlugins
env[:ui].success(I18n.t("vagrant.commands.plugin.up_to_date")) env[:ui].success(I18n.t("vagrant.commands.plugin.up_to_date"))
end end
updated.values.each do |spec| updated.each do |name, version|
env[:ui].success(I18n.t("vagrant.commands.plugin.updated", env[:ui].success(I18n.t("vagrant.commands.plugin.updated",
name: spec.name, version: spec.version.to_s)) name: name, version: version.to_s))
end end
# Continue # Continue