From bfc8c62ffe25f45fd6ac81afb1ca089e36334d62 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 1 Mar 2013 12:14:12 -0800 Subject: [PATCH] vagrant plugin list works properly with isolated gem env --- .../commands/plugin/action/list_plugins.rb | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/plugins/commands/plugin/action/list_plugins.rb b/plugins/commands/plugin/action/list_plugins.rb index 3da2cd5f6..b3a3392b1 100644 --- a/plugins/commands/plugin/action/list_plugins.rb +++ b/plugins/commands/plugin/action/list_plugins.rb @@ -20,23 +20,21 @@ module VagrantPlugins # Get the list of installed plugins according to the state file installed = Set.new(env[:plugin_state_file].installed_plugins) - # Get the actual specifications of installed gems - specs = env[:gem_helper].with_environment do - Gem::Specification.find_all - end - - # Get the latest version of the installed plugins + # Go through the plugins installed in this environment and + # get the latest version of each. installed_map = {} - specs.each do |spec| - # Ignore specs that aren't in our installed list - next if !installed.include?(spec.name) + env[:gem_helper].with_environment do + Gem::Specification.find_all.each do |spec| + # Ignore specs that aren't in our installed list + next if !installed.include?(spec.name) - # If we already have a newer version in our list of installed, - # then ignore it - next if installed_map.has_key?(spec.name) && - installed_map[spec.name].version >= spec.version + # If we already have a newer version in our list of installed, + # then ignore it + next if installed_map.has_key?(spec.name) && + installed_map[spec.name].version >= spec.version - installed_map[spec.name] = spec + installed_map[spec.name] = spec + end end # Output!