Skip to content

Commit d5c54cf

Browse files
committed
Also load plugins from RUBYLIB
1 parent aecc90b commit d5c54cf

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

bundler/lib/bundler/installer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ def load_plugins
243243
end
244244
end.flatten
245245
Bundler.rubygems.load_plugin_files(path_plugin_files)
246+
Bundler.rubygems.load_env_plugins
246247
end
247248

248249
def ensure_specs_are_compatible!

bundler/lib/bundler/rubygems_integration.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ def load_plugin_files(files)
227227
Gem.load_plugin_files(files) if Gem.respond_to?(:load_plugin_files)
228228
end
229229

230+
def load_env_plugins
231+
Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins)
232+
end
233+
230234
def ui=(obj)
231235
Gem::DefaultUserInteraction.ui = obj
232236
end

bundler/spec/commands/install_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,16 @@
432432
gem 'foo'
433433
G
434434
end
435+
436+
it "loads env plugins" do
437+
plugin_msg = "hello from an env plugin!"
438+
create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'"
439+
install_gemfile <<-G, :env => { "RUBYLIB" => bundled_app("plugins/").to_s }
440+
source "#{file_uri_for(gem_repo1)}"
441+
gem 'foo'
442+
G
443+
expect(last_command.stdboth).to include(plugin_msg)
444+
end
435445
end
436446

437447
describe "Ruby version in Gemfile.lock" do

0 commit comments

Comments
 (0)