Skip to content

Commit 6a58089

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Stop allowing calling #gem on random objects
ruby/rubygems@4b8570ae15
1 parent 845e878 commit 6a58089

File tree

6 files changed

+1
-27
lines changed

6 files changed

+1
-27
lines changed

lib/bundler/feature_flag.rb

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

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

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

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

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

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

lib/bundler/settings.rb

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

spec/bundler/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)