From: Antonio Terceiro Date: Sat, 11 Oct 2014 17:58:50 -0300 Subject: Make Bundler also lookup into rubygems-integration paths This applies both when loading plugins, and when installing plugins (so that e.g. vagrant will re-use Debian packages instead of reinstalling stuff that was already via dpkg) --- lib/vagrant/bundler.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -19,13 +19,13 @@ module Vagrant end def initialize - @enabled = true if ENV["VAGRANT_INSTALLER_ENV"] || - ENV["VAGRANT_FORCE_BUNDLER"] + @enabled = true @enabled = !::Bundler::SharedHelpers.in_bundle? if !@enabled @monitor = Monitor.new @gem_home = ENV["GEM_HOME"] @gem_path = ENV["GEM_PATH"] + @default_gem_path = Gem.default_path.join(::File::PATH_SEPARATOR) # Set the Bundler UI to be a silent UI. We have to add the # `silence` method to it because Bundler UI doesn't have it. @@ -75,8 +75,11 @@ module Vagrant env["BUNDLE_CONFIG"] = @configfile.path env["BUNDLE_GEMFILE"] = @gemfile.path env["BUNDLE_RETRY"] = "3" - env["GEM_PATH"] = - "#{bundle_path}#{::File::PATH_SEPARATOR}#{@gem_path}" + ENV["GEM_PATH"] = [ + bundle_path, + @gem_path, + @default_gem_path + ].compact.join(::File::PATH_SEPARATOR) end Gem.clear_paths @@ -259,6 +262,7 @@ module Vagrant # Set the GEM_HOME so gems are installed only to our local gem dir ENV["GEM_HOME"] = Vagrant.user_data_path.join("gems").to_s + ENV["GEM_PATH"] = [@gem_path, @default_gem_path].compact.join(::File::PATH_SEPARATOR) # Clear paths so that it reads the new GEM_HOME setting Gem.paths = ENV