Skip to content

Commit 4b8570a

Browse files
Stop allowing calling #gem on random objects
1 parent 495ba99 commit 4b8570a

File tree

6 files changed

+1
-27
lines changed

6 files changed

+1
-27
lines changed

bundler/lib/bundler/feature_flag.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def self.settings_method(name, key, &default)
3434
settings_flag(:lockfile_checksums) { bundler_4_mode? }
3535
settings_flag(:path_relative_to_cwd) { bundler_4_mode? }
3636
settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
37-
settings_flag(:setup_makes_kernel_gem_public) { !bundler_4_mode? }
3837
settings_flag(:update_requires_all_flag) { bundler_5_mode? }
3938

4039
settings_option(:default_cli_command) { bundler_4_mode? ? :cli_help : :install }

bundler/lib/bundler/man/bundle-config.1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,6 @@ The number of redirects allowed for network requests\. Defaults to \fB5\fR\.
161161
\fBretry\fR (\fBBUNDLE_RETRY\fR)
162162
The number of times to retry failed network requests\. Defaults to \fB3\fR\.
163163
.TP
164-
\fBsetup_makes_kernel_gem_public\fR (\fBBUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC\fR)
165-
Have \fBBundler\.setup\fR make the \fBKernel#gem\fR method public, even though RubyGems declares it as private\.
166-
.TP
167164
\fBshebang\fR (\fBBUNDLE_SHEBANG\fR)
168165
The program name that should be invoked for generated binstubs\. Defaults to the ruby install name used to generate the binstub\.
169166
.TP

bundler/lib/bundler/man/bundle-config.1.ronn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
178178
The number of redirects allowed for network requests. Defaults to `5`.
179179
* `retry` (`BUNDLE_RETRY`):
180180
The number of times to retry failed network requests. Defaults to `3`.
181-
* `setup_makes_kernel_gem_public` (`BUNDLE_SETUP_MAKES_KERNEL_GEM_PUBLIC`):
182-
Have `Bundler.setup` make the `Kernel#gem` method public, even though
183-
RubyGems declares it as private.
184181
* `shebang` (`BUNDLE_SHEBANG`):
185182
The program name that should be invoked for generated binstubs. Defaults to
186183
the ruby install name used to generate the binstub.

bundler/lib/bundler/rubygems_integration.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ def replace_gem(specs_by_name)
214214
e.requirement = dep.requirement
215215
raise e
216216
end
217-
218-
# backwards compatibility shim, see https://github.com/rubygems/bundler/issues/5102
219-
kernel_class.send(:public, :gem) if Bundler.feature_flag.setup_makes_kernel_gem_public?
220217
end
221218
end
222219

bundler/lib/bundler/settings.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class Settings
3838
path.system
3939
plugins
4040
prefer_patch
41-
setup_makes_kernel_gem_public
4241
silence_deprecations
4342
silence_root_warning
4443
update_requires_all_flag

bundler/spec/runtime/setup_spec.rb

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,22 +1524,7 @@ def lock_with(ruby_version = nil)
15241524
end
15251525

15261526
describe "after setup" do
1527-
it "allows calling #gem on random objects" do
1528-
install_gemfile <<-G
1529-
source "https://gem.repo1"
1530-
gem "myrack"
1531-
G
1532-
1533-
ruby <<-RUBY
1534-
require "bundler/setup"
1535-
Object.new.gem "myrack"
1536-
puts Gem.loaded_specs["myrack"].full_name
1537-
RUBY
1538-
1539-
expect(out).to eq("myrack-1.0.0")
1540-
end
1541-
1542-
it "keeps Kernel#gem private", bundler: "4" do
1527+
it "keeps Kernel#gem private" do
15431528
install_gemfile <<-G
15441529
source "https://gem.repo1"
15451530
gem "myrack"

0 commit comments

Comments
 (0)