[rubygems/rubygems] Revert RubyGems plugins getting loaded on Bundler.require
These changes were included when adding bundler plugin hooks for `Bundler.require`, but they seem completely unrelated to that feature, and have caused several issues. https://github.com/rubygems/rubygems/commit/8d56551dcf
This commit is contained in:
parent
10e7e92bad
commit
e7de621b5a
@ -212,7 +212,6 @@ module Bundler
|
|||||||
# Bundler.require(:test) # requires second_gem
|
# Bundler.require(:test) # requires second_gem
|
||||||
#
|
#
|
||||||
def require(*groups)
|
def require(*groups)
|
||||||
load_plugins
|
|
||||||
setup(*groups).require(*groups)
|
setup(*groups).require(*groups)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -576,23 +575,6 @@ module Bundler
|
|||||||
@feature_flag ||= FeatureFlag.new(VERSION)
|
@feature_flag ||= FeatureFlag.new(VERSION)
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_plugins(definition = Bundler.definition)
|
|
||||||
return if defined?(@load_plugins_ran)
|
|
||||||
|
|
||||||
Bundler.rubygems.load_plugins
|
|
||||||
|
|
||||||
requested_path_gems = definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
|
||||||
path_plugin_files = requested_path_gems.flat_map do |spec|
|
|
||||||
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
|
||||||
rescue TypeError
|
|
||||||
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
|
||||||
raise Gem::InvalidSpecificationException, error_message
|
|
||||||
end
|
|
||||||
Bundler.rubygems.load_plugin_files(path_plugin_files)
|
|
||||||
Bundler.rubygems.load_env_plugins
|
|
||||||
@load_plugins_ran = true
|
|
||||||
end
|
|
||||||
|
|
||||||
def reset!
|
def reset!
|
||||||
reset_paths!
|
reset_paths!
|
||||||
Plugin.reset!
|
Plugin.reset!
|
||||||
|
@ -79,7 +79,7 @@ module Bundler
|
|||||||
|
|
||||||
if @definition.setup_domain!(options)
|
if @definition.setup_domain!(options)
|
||||||
ensure_specs_are_compatible!
|
ensure_specs_are_compatible!
|
||||||
Bundler.load_plugins(@definition)
|
load_plugins
|
||||||
end
|
end
|
||||||
install(options)
|
install(options)
|
||||||
|
|
||||||
@ -209,6 +209,20 @@ module Bundler
|
|||||||
Bundler.settings.processor_count
|
Bundler.settings.processor_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def load_plugins
|
||||||
|
Gem.load_plugins
|
||||||
|
|
||||||
|
requested_path_gems = @definition.requested_specs.select {|s| s.source.is_a?(Source::Path) }
|
||||||
|
path_plugin_files = requested_path_gems.flat_map do |spec|
|
||||||
|
spec.matches_for_glob("rubygems_plugin#{Bundler.rubygems.suffix_pattern}")
|
||||||
|
rescue TypeError
|
||||||
|
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
||||||
|
raise Gem::InvalidSpecificationException, error_message
|
||||||
|
end
|
||||||
|
Gem.load_plugin_files(path_plugin_files)
|
||||||
|
Gem.load_env_plugins
|
||||||
|
end
|
||||||
|
|
||||||
def ensure_specs_are_compatible!
|
def ensure_specs_are_compatible!
|
||||||
@definition.specs.each do |spec|
|
@definition.specs.each do |spec|
|
||||||
unless spec.matches_current_ruby?
|
unless spec.matches_current_ruby?
|
||||||
|
@ -134,18 +134,6 @@ module Bundler
|
|||||||
loaded_gem_paths.flatten
|
loaded_gem_paths.flatten
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_plugins
|
|
||||||
Gem.load_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_plugin_files(plugin_files)
|
|
||||||
Gem.load_plugin_files(plugin_files)
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_env_plugins
|
|
||||||
Gem.load_env_plugins
|
|
||||||
end
|
|
||||||
|
|
||||||
def ui=(obj)
|
def ui=(obj)
|
||||||
Gem::DefaultUserInteraction.ui = obj
|
Gem::DefaultUserInteraction.ui = obj
|
||||||
end
|
end
|
||||||
|
@ -431,6 +431,22 @@ RSpec.describe "Bundler.require" do
|
|||||||
expect(out).to eq("WIN")
|
expect(out).to eq("WIN")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not load plugins" do
|
||||||
|
install_gemfile <<-G
|
||||||
|
source "https://gem.repo1"
|
||||||
|
gem "myrack"
|
||||||
|
G
|
||||||
|
|
||||||
|
create_file "plugins/rubygems_plugin.rb", "puts 'FAIL'"
|
||||||
|
|
||||||
|
run <<~R, env: { "RUBYLIB" => rubylib.unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR) }
|
||||||
|
Bundler.require
|
||||||
|
puts "WIN"
|
||||||
|
R
|
||||||
|
|
||||||
|
expect(out).to eq("WIN")
|
||||||
|
end
|
||||||
|
|
||||||
it "does not extract gemspecs from application cache packages" do
|
it "does not extract gemspecs from application cache packages" do
|
||||||
gemfile <<-G
|
gemfile <<-G
|
||||||
source "https://gem.repo1"
|
source "https://gem.repo1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user