From 2fd144611e44c2fe3345d1139a5653ad78addf2e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Jan 2014 17:04:50 -0800 Subject: [PATCH] Cleaning gems properly only removes them from the local dir --- lib/vagrant/bundler.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index ea9639566..444668672 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -64,6 +64,9 @@ module Vagrant ::Bundler::Installer.install(root, definition, opts) end + # Clean out the unused gems, if we have any + clean(plugins) + definition.specs rescue ::Bundler::VersionConflict => e raise Errors::PluginInstallVersionConflict, @@ -76,8 +79,11 @@ module Vagrant lockfile = "#{gemfile.path}.lock" definition = ::Bundler::Definition.build(gemfile, lockfile, nil) root = File.dirname(gemfile.path) - runtime = ::Bundler::Runtime.new(root, definition) - runtime.clean + + with_isolated_gem do + runtime = ::Bundler::Runtime.new(root, definition) + runtime.clean + end end # Builds a valid Gemfile for use with Bundler given the list of