Handle the case a plugin install is a plugin not found

This commit is contained in:
Mitchell Hashimoto 2013-02-03 14:29:29 -08:00
parent 2079941e7d
commit 635949980b
3 changed files with 14 additions and 1 deletions

View File

@ -344,6 +344,10 @@ module Vagrant
error_key(:plugin_install_bad_entry_point)
end
class PluginInstallNotFound < VagrantError
error_key(:plugin_install_not_found)
end
class PluginLoadError < VagrantError
status_code(81)
error_key(:plugin_load_error)

View File

@ -22,7 +22,13 @@ module VagrantPlugins
:name => plugin_name))
installed_gems = env[:gem_helper].with_environment do
installer = Gem::DependencyInstaller.new(:document => [])
installer.install(plugin_name)
begin
installer.install(plugin_name)
rescue Gem::GemNotFoundException
raise Vagrant::Errors::PluginInstallNotFound,
:name => plugin_name
end
end
# The plugin spec is the last installed gem since RubyGems

View File

@ -175,6 +175,9 @@ en:
the entry point doesn't exist. The entry point attempted was
'%{entry_point}'. If this is not correct, please manually
specify an `--entry-point` when installing the plugin.
plugin_install_not_found: |-
The plugin '%{name}' could not be found in local or remote
repositories. Please check the name of the plugin and try again.
plugin_load_error: |-
The plugin "%{plugin}" could not be found. Please make sure that it is
properly installed via `vagrant plugin`.