diff --git a/bin/vagrant b/bin/vagrant index 55c563c13..c019f30ff 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -84,20 +84,26 @@ $stderr.sync = true # Before we start activate all our dependencies # so we can provide correct resolutions later +builtin_specs = [] + vagrant_spec = Gem::Specification.find_all_by_name("vagrant").detect do |spec| spec.version == Gem::Version.new(Vagrant::VERSION) end dep_activator = proc do |spec| spec.runtime_dependencies.each do |dep| - if gem(dep.name, *dep.requirement.as_list) || true - dep_spec = Gem::Specification.find_all_by_name(dep.name).detect(&:activated?) - dep_activator.call(dep_spec) if dep_spec + gem(dep.name, *dep.requirement.as_list) + dep_spec = Gem::Specification.find_all_by_name(dep.name).detect(&:activated?) + if dep_spec + builtin_specs << dep_spec + dep_activator.call(dep_spec) end end end -dep_activator.call(vagrant_spec) if vagrant_spec +if vagrant_spec + dep_activator.call(vagrant_spec) +end env = nil begin @@ -108,6 +114,9 @@ begin require 'vagrant/util/platform' require 'vagrant/util/experimental' + # Set our list of builtin specs + Vagrant::Bundler.instance.builtin_specs = builtin_specs + # Schedule the cleanup of things at_exit(&Vagrant::Bundler.instance.method(:deinit)) diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb index 85f9feb57..f2010fed6 100644 --- a/lib/vagrant/bundler.rb +++ b/lib/vagrant/bundler.rb @@ -189,6 +189,8 @@ module Vagrant attr_reader :env_plugin_gem_path # @return [Pathname] Vagrant environment data path attr_reader :environment_data_path + # @return [Array, nil] List of builtin specs + attr_accessor :builtin_specs def initialize @plugin_gem_path = Vagrant.user_data_path.join("gems", RUBY_VERSION).freeze @@ -646,7 +648,6 @@ module Vagrant self_spec.activate @logger.info("Activated vagrant specification version - #{self_spec.version}") end - self_spec.runtime_dependencies.each { |d| gem d.name, *d.requirement.as_list } # discover all the gems we have available list = {} if Gem.respond_to?(:default_specifications_dir) @@ -660,7 +661,7 @@ module Vagrant list[spec.full_name] = spec end else - Gem::Specification.find_all(&:activated?).each do |spec| + builtin_specs.each do |spec| list[spec.full_name] = spec end end