summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-01-29 19:23:08 +0100
committerHiroshi SHIBATA <[email protected]>2025-02-06 13:07:55 +0900
commit68bb6ceeafeae3c06f09f8d120d3194eaa2d131d (patch)
tree16687c1f648758a4f5129f0654173620afb27c37
parent15b77a09a7a72ac308ab478e491f3b90964a069f (diff)
Remove unnecessary SINCE_FAST_PATH constant
If anything, I think this may be causing some false positives.
-rw-r--r--lib/bundled_gems.rb4
-rw-r--r--spec/bundled_gems_spec.rb18
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/bundled_gems.rb b/lib/bundled_gems.rb
index 17fd4b85f6..379cee5136 100644
--- a/lib/bundled_gems.rb
+++ b/lib/bundled_gems.rb
@@ -33,8 +33,6 @@ module Gem::BUNDLED_GEMS # :nodoc:
# "readline" => "3.5.0", # This is wrapper for reline. We don't warn for this.
}.freeze
- SINCE_FAST_PATH = SINCE.transform_keys { |g| g.sub(/\A.*\-/, "") }.freeze
-
EXACT = {
"kconv" => "nkf",
}.freeze
@@ -142,7 +140,7 @@ module Gem::BUNDLED_GEMS # :nodoc:
end
else
name = feature.sub(LIBEXT, "")
- return unless SINCE_FAST_PATH[name]
+ return unless SINCE[name]
end
return if specs.include?(name)
diff --git a/spec/bundled_gems_spec.rb b/spec/bundled_gems_spec.rb
index 91f29cac10..5680f4b2d2 100644
--- a/spec/bundled_gems_spec.rb
+++ b/spec/bundled_gems_spec.rb
@@ -60,12 +60,10 @@ RSpec.describe "bundled_gems.rb" do
Gem::BUNDLED_GEMS.send(:remove_const, :LIBDIR)
Gem::BUNDLED_GEMS.send(:remove_const, :ARCHDIR)
Gem::BUNDLED_GEMS.send(:remove_const, :SINCE)
- Gem::BUNDLED_GEMS.send(:remove_const, :SINCE_FAST_PATH)
Gem::BUNDLED_GEMS.send(:remove_const, :PREFIXED)
Gem::BUNDLED_GEMS.const_set(:LIBDIR, File.expand_path(File.join(__dir__, "../../..", "lib")) + "/")
Gem::BUNDLED_GEMS.const_set(:ARCHDIR, File.expand_path($LOAD_PATH.find{|path| path.include?(".ext/common") }) + "/")
Gem::BUNDLED_GEMS.const_set(:SINCE, { "openssl" => RUBY_VERSION, "fileutils" => RUBY_VERSION, "csv" => "3.4.0", "net-smtp" => "3.1.0" })
- Gem::BUNDLED_GEMS.const_set(:SINCE_FAST_PATH, Gem::BUNDLED_GEMS::SINCE.transform_keys { |g| g.sub(/\A.*\-/, "") } )
Gem::BUNDLED_GEMS.const_set(:PREFIXED, { "openssl" => true })
STUB
}
@@ -95,9 +93,9 @@ RSpec.describe "bundled_gems.rb" do
RUBY
expect(err).to include(/csv was loaded from (.*) from Ruby 3.4.0/)
- expect(err).to include(/-e:19/)
+ expect(err).to include(/-e:17/)
expect(err).to include(/openssl was loaded from (.*) from Ruby #{RUBY_VERSION}/)
- expect(err).to include(/-e:22/)
+ expect(err).to include(/-e:20/)
end
it "Show warning when bundled gems called as dependency" do
@@ -133,7 +131,7 @@ RSpec.describe "bundled_gems.rb" do
RUBY
expect(err).to include(/net\/smtp was loaded from (.*) from Ruby 3.1.0/)
- expect(err).to include(/-e:19/)
+ expect(err).to include(/-e:17/)
expect(err).to include("You can add net-smtp")
end
@@ -149,7 +147,7 @@ RSpec.describe "bundled_gems.rb" do
RUBY
expect(err).to include(/openssl\/bn is found in openssl, (.*) part of the default gems starting from Ruby #{RUBY_VERSION}/)
- expect(err).to include(/-e:18/)
+ expect(err).to include(/-e:16/)
end
it "Show warning when bundle exec with ruby and script" do
@@ -163,7 +161,7 @@ RSpec.describe "bundled_gems.rb" do
bundle "exec ruby script.rb"
expect(err).to include(/openssl was loaded from (.*) from Ruby 3.5.0/)
- expect(err).to include(/script\.rb:12/)
+ expect(err).to include(/script\.rb:10/)
end
it "Show warning when bundle exec with shebang's script" do
@@ -181,7 +179,7 @@ RSpec.describe "bundled_gems.rb" do
bundle "exec ./script.rb"
expect(err).to include(/openssl was loaded from (.*) from Ruby 3.5.0/)
- expect(err).to include(/script\.rb:13/)
+ expect(err).to include(/script\.rb:11/)
end
it "Show warning when bundle exec with -r option" do
@@ -213,7 +211,7 @@ RSpec.describe "bundled_gems.rb" do
RUBY
expect(err).to include(/openssl was loaded from (.*) from Ruby 3.5.0/)
- expect(err).to include(/-e:23/)
+ expect(err).to include(/-e:21/)
end
it "Don't show warning when bundled gems called as dependency" do
@@ -324,7 +322,7 @@ RSpec.describe "bundled_gems.rb" do
bundle "exec ruby script.rb"
expect(err).to include(/openssl was loaded from (.*) from Ruby 3.5.0/)
- expect(err).to include(/script\.rb:17/)
+ expect(err).to include(/script\.rb:15/)
end
it "Don't show warning openssl/bn when openssl on Gemfile" do