summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-01-24 16:40:03 +0100
committerHiroshi SHIBATA <[email protected]>2025-01-28 15:31:55 +0900
commit6460777cdedc55e9f40930f3ade3193943fbfab9 (patch)
tree3cd9f99dd2b6b71292ce331f29658e7f2df6ca67 /lib
parent7ae6aa0efccc486da6c7c32f7d06bff6e4770870 (diff)
[rubygems/rubygems] Retry namespaced require using `retry`
It's simpler. https://github.com/rubygems/rubygems/commit/76f1e3bf05
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/runtime.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index e349901df4..bd626ccbd7 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -61,17 +61,13 @@ module Bundler
file = dep.name if file == true
required_file = file
begin
- Kernel.require file
+ Kernel.require required_file
rescue LoadError => e
raise if dep.autorequire || e.path != required_file
- if dep.autorequire.nil? && dep.name.include?("-")
- begin
- namespaced_file = dep.name.tr("-", "/")
- Kernel.require namespaced_file
- rescue LoadError => e
- raise if e.path != namespaced_file
- end
+ if dep.autorequire.nil? && required_file.include?("-")
+ required_file = required_file.tr("-", "/")
+ retry
end
rescue RuntimeError => e
raise Bundler::GemRequireError.new e,