summaryrefslogtreecommitdiff
path: root/lib/bundler/runtime.rb
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2020-06-28 19:08:10 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-07-15 16:05:12 +0900
commit40f73b3a0031e7bdbfbace37304602e0efc891fa (patch)
tree852776b2e0e5b5c9aa66e89175fde95fdd3ec47e /lib/bundler/runtime.rb
parent2fafc08aa34ddba39d0bfdb6e7c5de4f7bf7f55e (diff)
[rubygems/rubygems] Avoid calling LoadError#message because of its slowness
Instead we can rely on `LoadError#path` https://github.com/rubygems/rubygems/commit/16d5c3b43c
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3275
Diffstat (limited to 'lib/bundler/runtime.rb')
-rw-r--r--lib/bundler/runtime.rb14
1 files changed, 2 insertions, 12 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb
index 93a801eb6c..a58a8386e9 100644
--- a/lib/bundler/runtime.rb
+++ b/lib/bundler/runtime.rb
@@ -43,14 +43,6 @@ module Bundler
self
end
- REQUIRE_ERRORS = [
- /^no such file to load -- (.+)$/i,
- /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
- /^Missing API definition file in (.+)$/i,
- /^cannot load such file -- (.+)$/i,
- /^dlopen\([^)]*\): Library not loaded: (.+)$/i,
- ].freeze
-
def require(*groups)
groups.map!(&:to_sym)
groups = [:default] if groups.empty?
@@ -79,16 +71,14 @@ module Bundler
end
end
rescue LoadError => e
- REQUIRE_ERRORS.find {|r| r =~ e.message }
- raise if dep.autorequire || $1 != required_file
+ 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
- REQUIRE_ERRORS.find {|r| r =~ e.message }
- raise if $1 != namespaced_file
+ raise if e.path != namespaced_file
end
end
end