core: Within a Bundler env, don't manage Bundler
This commit is contained in:
parent
2f4944903e
commit
83245e6b2a
|
@ -18,6 +18,8 @@ module Vagrant
|
|||
end
|
||||
|
||||
def initialize
|
||||
@enabled = !::Bundler::SharedHelpers.in_bundle?
|
||||
@enabled = true if ENV["VAGRANT_FORCE_BUNDLER"]
|
||||
@monitor = Monitor.new
|
||||
|
||||
@gem_home = ENV["GEM_HOME"]
|
||||
|
@ -37,6 +39,9 @@ module Vagrant
|
|||
# Initializes Bundler and the various gem paths so that we can begin
|
||||
# loading gems. This must only be called once.
|
||||
def init!(plugins)
|
||||
# If we're not enabled, then we don't do anything.
|
||||
return if !@enabled
|
||||
|
||||
# Setup the Bundler configuration
|
||||
@configfile = File.open(Tempfile.new("vagrant").path + "1", "w+")
|
||||
@configfile.close
|
||||
|
@ -202,6 +207,8 @@ module Vagrant
|
|||
end
|
||||
|
||||
def with_isolated_gem
|
||||
raise Errors::BundlerDisabled if !@enabled
|
||||
|
||||
# Remove bundler settings so that Bundler isn't loaded when building
|
||||
# native extensions because it causes all sorts of problems.
|
||||
old_rubyopt = ENV["RUBYOPT"]
|
||||
|
|
|
@ -164,6 +164,10 @@ module Vagrant
|
|||
error_key(:failed, "vagrant.actions.box.verify")
|
||||
end
|
||||
|
||||
class BundlerDisabled < VagrantError
|
||||
error_key(:bundler_disabled)
|
||||
end
|
||||
|
||||
class BundlerError < VagrantError
|
||||
error_key(:bundler_error)
|
||||
end
|
||||
|
|
|
@ -5,17 +5,11 @@
|
|||
if defined?(Bundler)
|
||||
require "bundler/shared_helpers"
|
||||
if Bundler::SharedHelpers.in_bundle?
|
||||
if ENV["VAGRANT_FORCE_PLUGINS"]
|
||||
puts "Vagrant appears to be running in a Bundler environment. Normally,"
|
||||
puts "plugins would not be loaded, but VAGRANT_FORCE_PLUGINS is enabled,"
|
||||
puts "so they will be."
|
||||
puts
|
||||
else
|
||||
puts "Vagrant appears to be running in a Bundler environment. Plugins"
|
||||
puts "will not be loaded and plugin commands are disabled."
|
||||
puts
|
||||
ENV["VAGRANT_NO_PLUGINS"] = "1"
|
||||
end
|
||||
puts "Vagrant appears to be running in a Bundler environment. Your "
|
||||
puts "existing Gemfile will be used. Vagrant will not auto-load any plugins."
|
||||
puts "You must load any plugins you want manually in a Vagrantfile. You can"
|
||||
puts "force Vagrant to take over with VAGRANT_FORCE_BUNDLER."
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -269,6 +269,13 @@ en:
|
|||
The box '%{name}' is still stored on disk in the Vagrant 1.0.x
|
||||
format. This box must be upgraded in order to work properly with
|
||||
this version of Vagrant.
|
||||
bundler_disabled: |-
|
||||
Vagrant's built-in bundler management mechanism is disabled because
|
||||
Vagrant is running in an external bundler environment. In these
|
||||
cases, plugin management does not work with Vagrant. To install
|
||||
plugins, use your own Gemfile. To load plugins, either put the
|
||||
plugins in the `plugins` group in your Gemfile or manually require
|
||||
them in a Vagrantfile.
|
||||
bundler_error: |-
|
||||
Bundler, the underlying system Vagrant uses to install plugins,
|
||||
reported an error. The error is shown below. These errors are usually
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
ENV["VAGRANT_FORCE_PLUGINS"] = "1"
|
||||
|
||||
require_relative "test/acceptance/base"
|
||||
|
||||
Vagrant::Spec::Acceptance.configure do |c|
|
||||
|
|
Loading…
Reference in New Issue