Plugin listing is a bit more sophisticated, shows version

This commit is contained in:
Mitchell Hashimoto 2013-02-03 12:59:32 -08:00
parent 693b825eb1
commit 9690754983
2 changed files with 17 additions and 8 deletions

View File

@ -25,14 +25,23 @@ module VagrantPlugins
Gem::Specification.find_all
end
# Go through each spec and if it is an installed plugin, then
# output it. This means that both the installed state and
# gem match up.
# Get the latest version of the installed plugins
installed_map = {}
specs.each do |spec|
if installed.include?(spec.name)
# TODO: Formatting
env[:ui].info spec.name
end
# 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
installed_map[spec.name] = spec
end
# Output!
installed_map.values.each do |spec|
env[:ui].info "#{spec.name} (#{spec.version})"
end
@app.call(env)

View File

@ -418,7 +418,7 @@ en:
`vagrantup.com` for more information on using Vagrant.
plugin:
installing: |-
Installing the '%{name}' plugin...
Installing the '%{name}' plugin. This can take a few minutes...
uninstalling: |-
Uninstalling the '%{name}' plugin...
status: