diff options
author | Bundlerbot <bot@bundler.io> | 2019-12-19 17:07:48 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-12-19 17:07:48 +0000 |
commit | eada59b3d37d6f2f1a05b2d8052a499dfb8fd222 (patch) | |
tree | 750484afaaade3f4bce4711068589b6bbef1a5bd | |
parent | 0bc7f5c71e31f6dbb1207324165ee2b95f628bd3 (diff) | |
parent | 4df7b22f53ed5113bd988a4831135b9a617f9a5f (diff) | |
download | bundler-eada59b3d37d6f2f1a05b2d8052a499dfb8fd222.tar.gz |
Merge #7505
7505: Make sure to `require "rubygems"` explicitly r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was some setups have `--disable=gem` in `RUBYOPT`, and sometimes use `bundler` without modifying that env.
### What was your diagnosis of the problem?
My diagnosis was that we shouldn't break those setups just to save a `require`.
### What is your fix for the problem, implemented in this PR?
My fix is to add a `require "rubygems"` on top of the file that needs it.
Fixes #7487.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 2 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 17f2d7d9fa..f06e8d68a9 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "rubygems" + module Bundler class RubygemsIntegration if defined?(Gem::Ext::Builder::CHDIR_MONITOR) diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index befc5f9d09..39240b7404 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -1344,5 +1344,11 @@ end expect(last_command.stdboth).not_to include "FAIL" expect(err).to include "private method `require'" end + + it "takes care of requiring rubygems" do + sys_exec("#{Gem.ruby} -I#{lib_dir} -e \"puts require('bundler/setup')\"", "RUBYOPT" => "--disable=gems") + + expect(last_command.stdboth).to eq("true") + end end end |