commands/plugin: uninstall works again

This commit is contained in:
Mitchell Hashimoto 2014-01-05 16:02:00 -08:00
parent 8cfa24143d
commit e1c9431085
3 changed files with 23 additions and 5 deletions

View File

@ -67,13 +67,19 @@ module Vagrant
::Bundler::Installer.install(root, definition, opts)
end
# Clean up any unused/old gems
runtime = ::Bundler::Runtime.new(root, definition)
#runtime.clean
definition.specs
end
# Clean removes any unused gems.
def clean(plugins)
gemfile = build_gemfile(plugins)
lockfile = "#{gemfile.path}.lock"
definition = ::Bundler::Definition.build(gemfile, lockfile, nil)
root = File.dirname(gemfile.path)
runtime = ::Bundler::Runtime.new(root, definition)
runtime.clean
end
# Builds a valid Gemfile for use with Bundler given the list of
# plugins.
#

View File

@ -40,6 +40,16 @@ module Vagrant
result
end
# Uninstalls the plugin with the given name.
#
# @param [String] name
def uninstall_plugin(name)
@global_file.remove_plugin(name)
# Clean the environment, removing any old plugins
Vagrant::Bundler.instance.clean(installed_plugins)
end
# This returns the list of plugins that should be enabled.
#
# @return [Array<String>]

View File

@ -13,7 +13,9 @@ module VagrantPlugins
# Remove it!
env[:ui].info(I18n.t("vagrant.commands.plugin.uninstalling",
:name => env[:plugin_name]))
env[:plugin_state_file].remove_plugin(env[:plugin_name])
manager = Vagrant::Plugin::Manager.instance
manager.uninstall_plugin(env[:plugin_name])
@app.call(env)
end