зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Load "bundler/setup" in lib/rubygems.rb
Ruby interpreter loads some special gems at startup: did_you_mean, error_highlight, and syntax_suggest. These gems are loaded before `bundler/setup` is loaded by `RUBYOPT=-rbundler/setup`. So, the versions of the gems are not controllable by Gemfile. This change will `require "bundler/setup"` in rubygems.rb (i.e., before the special gems are loaded). Now `bundle exec` sets an environment variable `BUNDLER_SETUP`, and rubygems requires the variable if defined. See also: https://bugs.ruby-lang.org/issues/19089 https://github.com/rubygems/rubygems/commit/963cb65a2d
This commit is contained in:
Родитель
06e17d7659
Коммит
b5f809c496
|
@ -7,6 +7,7 @@ module Bundler
|
|||
BUNDLE_BIN_PATH
|
||||
BUNDLE_GEMFILE
|
||||
BUNDLER_VERSION
|
||||
BUNDLER_SETUP
|
||||
GEM_HOME
|
||||
GEM_PATH
|
||||
MANPATH
|
||||
|
|
|
@ -284,6 +284,7 @@ module Bundler
|
|||
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
||||
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
|
||||
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
||||
Bundler::SharedHelpers.set_env "BUNDLER_SETUP", File.expand_path("setup", __dir__)
|
||||
end
|
||||
|
||||
def set_path
|
||||
|
|
|
@ -1348,3 +1348,5 @@ Gem::Specification.load_defaults
|
|||
require_relative "rubygems/core_ext/kernel_gem"
|
||||
require_relative "rubygems/core_ext/kernel_require"
|
||||
require_relative "rubygems/core_ext/kernel_warn"
|
||||
|
||||
require ENV["BUNDLER_SETUP"] if ENV["BUNDLER_SETUP"]
|
||||
|
|
|
@ -246,6 +246,13 @@ RSpec.describe Bundler::SharedHelpers do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for "ENV['BUNDLER_SETUP'] gets set correctly" do
|
||||
it "ensures bundler/setup is set in ENV['BUNDLE_SETUP']" do
|
||||
subject.set_bundle_environment
|
||||
expect(ENV["BUNDLER_SETUP"]).to eq("#{source_lib_dir}/bundler/setup")
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for "ENV['RUBYLIB'] gets set correctly" do
|
||||
let(:ruby_lib_path) { "stubbed_ruby_lib_dir" }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче