Work some things around so that Bundler is not setup with no plugins
This commit is contained in:
parent
76de267d1e
commit
73c71dbcc6
41
bin/vagrant
41
bin/vagrant
|
@ -20,9 +20,27 @@ if argv.include?("-v") || argv.include?("--version")
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# This is kind of hacky, and I'd love to find a better way to do this, but
|
||||||
|
# if we're accessing the plugin interface, we want to NOT load plugins
|
||||||
|
# for this run, because they can actually interfere with the function
|
||||||
|
# of the plugin interface.
|
||||||
|
argv.each do |arg|
|
||||||
|
if !arg.start_with?("-")
|
||||||
|
if arg == "plugin"
|
||||||
|
ENV["VAGRANT_NO_PLUGINS"] = "1"
|
||||||
|
ENV["VAGRANT_VAGRANTFILE"] = "plugin_command_#{Time.now.to_i}"
|
||||||
|
end
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Require some stuff that is NOT dependent on RubyGems
|
||||||
|
require "vagrant/shared_helpers"
|
||||||
|
|
||||||
# First, make sure that we're executing using the proper Bundler context
|
# First, make sure that we're executing using the proper Bundler context
|
||||||
# with our plugins. If we're not, then load that and reload Vagrant.
|
# with our plugins. If we're not, then load that and reload Vagrant.
|
||||||
if !ENV["VAGRANT_INTERNAL_BUNDLERIZED"]
|
if !ENV["VAGRANT_INTERNAL_BUNDLERIZED"] && Vagrant.plugins_enabled?
|
||||||
require "rbconfig"
|
require "rbconfig"
|
||||||
ruby_path = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
|
ruby_path = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
|
||||||
Kernel.exec(
|
Kernel.exec(
|
||||||
|
@ -39,25 +57,12 @@ if argv.include?("--debug")
|
||||||
ENV["VAGRANT_LOG"] = "debug"
|
ENV["VAGRANT_LOG"] = "debug"
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is kind of hacky, and I'd love to find a better way to do this, but
|
# Setup our dependencies by initializing Bundler if we're using plugins
|
||||||
# if we're accessing the plugin interface, we want to NOT load plugins
|
if Vagrant.plugins_enabled?
|
||||||
# for this run, because they can actually interfere with the function
|
require "bundler"
|
||||||
# of the plugin interface.
|
Bundler.setup
|
||||||
argv.each do |arg|
|
|
||||||
if !arg.start_with?("-")
|
|
||||||
if arg == "plugin"
|
|
||||||
ENV["VAGRANT_NO_PLUGINS"] = "1"
|
|
||||||
ENV["VAGRANT_VAGRANTFILE"] = "plugin_command_#{Time.now.to_i}"
|
|
||||||
end
|
|
||||||
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Setup our dependencies by initializing Bundler
|
|
||||||
require "bundler"
|
|
||||||
Bundler.setup
|
|
||||||
|
|
||||||
require 'log4r'
|
require 'log4r'
|
||||||
require 'vagrant'
|
require 'vagrant'
|
||||||
require 'vagrant/cli'
|
require 'vagrant/cli'
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] = "/Applications/Vagrant/embedded"
|
ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"] = "/Applications/Vagrant/embedded"
|
||||||
|
|
||||||
if !defined?(Bundler)
|
require "vagrant/shared_helpers"
|
||||||
|
|
||||||
|
if Vagrant.plugins_enabled? && !defined?(Bundler)
|
||||||
puts "It appears that Vagrant was not properly loaded. Specifically,"
|
puts "It appears that Vagrant was not properly loaded. Specifically,"
|
||||||
puts "the bundler context Vagrant requires was not setup. Please execute"
|
puts "the bundler context Vagrant requires was not setup. Please execute"
|
||||||
puts "vagrant using only the `vagrant` executable."
|
puts "vagrant using only the `vagrant` executable."
|
||||||
|
@ -80,7 +82,6 @@ end
|
||||||
# just require them explicitly here.
|
# just require them explicitly here.
|
||||||
require "vagrant/plugin"
|
require "vagrant/plugin"
|
||||||
require "vagrant/registry"
|
require "vagrant/registry"
|
||||||
require "vagrant/shared_helpers"
|
|
||||||
|
|
||||||
module Vagrant
|
module Vagrant
|
||||||
autoload :Action, 'vagrant/action'
|
autoload :Action, 'vagrant/action'
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
require "pathname"
|
require "pathname"
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
|
|
||||||
|
require "bundler"
|
||||||
|
|
||||||
require_relative "shared_helpers"
|
require_relative "shared_helpers"
|
||||||
require_relative "version"
|
require_relative "version"
|
||||||
|
|
||||||
|
@ -21,8 +23,6 @@ module Vagrant
|
||||||
# Initializes Bundler and the various gem paths so that we can begin
|
# Initializes Bundler and the various gem paths so that we can begin
|
||||||
# loading gems. This must only be called once.
|
# loading gems. This must only be called once.
|
||||||
def init!(plugins)
|
def init!(plugins)
|
||||||
raise "Bundler already initialized" if defined?(::Bundler)
|
|
||||||
|
|
||||||
# Setup the Bundler configuration
|
# Setup the Bundler configuration
|
||||||
@configfile = File.open(Tempfile.new("vagrant").path + "1", "w+")
|
@configfile = File.open(Tempfile.new("vagrant").path + "1", "w+")
|
||||||
@configfile.close
|
@configfile.close
|
||||||
|
@ -39,9 +39,6 @@ module Vagrant
|
||||||
"#{Vagrant.user_data_path.join("gems")}#{::File::PATH_SEPARATOR}#{@gem_path}"
|
"#{Vagrant.user_data_path.join("gems")}#{::File::PATH_SEPARATOR}#{@gem_path}"
|
||||||
Gem.clear_paths
|
Gem.clear_paths
|
||||||
|
|
||||||
# Load Bundler now
|
|
||||||
require "bundler"
|
|
||||||
|
|
||||||
# Do some additional Bundler initialization
|
# Do some additional Bundler initialization
|
||||||
::Bundler.ui = ::Bundler::UI.new
|
::Bundler.ui = ::Bundler::UI.new
|
||||||
if !::Bundler.ui.respond_to?(:silence)
|
if !::Bundler.ui.respond_to?(:silence)
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
# initializes the Bundler context so that Vagrant and its associated plugins
|
# initializes the Bundler context so that Vagrant and its associated plugins
|
||||||
# can load properly, and then execs out into Vagrant again.
|
# can load properly, and then execs out into Vagrant again.
|
||||||
|
|
||||||
require_relative "bundler"
|
|
||||||
require_relative "plugin/manager"
|
|
||||||
require_relative "shared_helpers"
|
|
||||||
|
|
||||||
if defined?(Bundler)
|
if defined?(Bundler)
|
||||||
require "bundler/shared_helpers"
|
require "bundler/shared_helpers"
|
||||||
if Bundler::SharedHelpers.in_bundle?
|
if Bundler::SharedHelpers.in_bundle?
|
||||||
|
@ -16,6 +12,10 @@ if defined?(Bundler)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require_relative "bundler"
|
||||||
|
require_relative "plugin/manager"
|
||||||
|
require_relative "shared_helpers"
|
||||||
|
|
||||||
plugins = []
|
plugins = []
|
||||||
plugins = Vagrant::Plugin::Manager.instance.installed_plugins if Vagrant.plugins_enabled?
|
plugins = Vagrant::Plugin::Manager.instance.installed_plugins if Vagrant.plugins_enabled?
|
||||||
Vagrant::Bundler.instance.init!(plugins)
|
Vagrant::Bundler.instance.init!(plugins)
|
||||||
|
|
Loading…
Reference in New Issue