Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load rubygems plugins from RUBYLIB during bundle install and bundle update #3534

Merged
merged 1 commit into from Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions bundler/lib/bundler/installer.rb
Expand Up @@ -244,6 +244,7 @@ def load_plugins
end
end.flatten
Bundler.rubygems.load_plugin_files(path_plugin_files)
Bundler.rubygems.load_env_plugins
end

def ensure_specs_are_compatible!
Expand Down
4 changes: 4 additions & 0 deletions bundler/lib/bundler/rubygems_integration.rb
Expand Up @@ -227,6 +227,10 @@ def load_plugin_files(files)
Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files)
end

def load_env_plugins
Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
end

def ui=(obj)
Gem::DefaultUserInteraction.ui = obj
end
Expand Down
12 changes: 12 additions & 0 deletions bundler/spec/commands/install_spec.rb
Expand Up @@ -222,6 +222,18 @@
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end

it "loads env plugins" do
plugin_msg = "hello from an env plugin!"
create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'"
rubylib = ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR).unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR)
install_gemfile <<-G, :env => { "RUBYLIB" => rubylib }
source "#{file_uri_for(gem_repo1)}"
gem "rack"
G

expect(last_command.stdboth).to include(plugin_msg)
end

describe "with a gem that installs multiple platforms" do
it "installs gems for the local platform as first choice" do
skip "version is 1.0, not 1.0.0" if Gem.win_platform?
Expand Down