Skip to content

Commit 3de29dc

Browse files
Merge pull request #3534 from djmarcin/fix-env-plugins
Load rubygems plugins from RUBYLIB during `bundle install` and `bundle update` (cherry picked from commit 5bb5583)
1 parent d3068a4 commit 3de29dc

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

bundler/lib/bundler/installer.rb

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

249250
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@
222222
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
223223
end
224224

225+
it "loads env plugins" do
226+
plugin_msg = "hello from an env plugin!"
227+
create_file "plugins/rubygems_plugin.rb", "puts '#{plugin_msg}'"
228+
rubylib = ENV["RUBYLIB"].to_s.split(File::PATH_SEPARATOR).unshift(bundled_app("plugins").to_s).join(File::PATH_SEPARATOR)
229+
install_gemfile <<-G, :env => { "RUBYLIB" => rubylib }
230+
source "#{file_uri_for(gem_repo1)}"
231+
gem "rack"
232+
G
233+
234+
expect(last_command.stdboth).to include(plugin_msg)
235+
end
236+
225237
describe "with a gem that installs multiple platforms" do
226238
it "installs gems for the local platform as first choice" do
227239
skip "version is 1.0, not 1.0.0" if Gem.win_platform?

0 commit comments

Comments
 (0)