summaryrefslogtreecommitdiff
path: root/lib/bundler/stub_specification.rb
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-04-06 19:25:25 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-04-07 12:02:55 -0500
commit1b333a6768ce8708c7d01bffc27a46952e5b6011 (patch)
tree5043ac91c9d988d1a9e31a70801da12240c14203 /lib/bundler/stub_specification.rb
parent8b95a4858e15cf667c70db8c4d9c0333a28b55e8 (diff)
downloadbundler-1b333a6768ce8708c7d01bffc27a46952e5b6011.tar.gz
[Git] Avoid loading full gemspecs in -rbundler/setup when stubs are available
Diffstat (limited to 'lib/bundler/stub_specification.rb')
-rw-r--r--lib/bundler/stub_specification.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
index 9e43f06364..2e8938e12d 100644
--- a/lib/bundler/stub_specification.rb
+++ b/lib/bundler/stub_specification.rb
@@ -36,8 +36,17 @@ module Bundler
stub.default_gem
end
+ # This is what we do in bundler/rubygems_ext
def full_gem_path
- stub.full_gem_path
+ # this cannot check source.is_a?(Bundler::Plugin::API::Source)
+ # because that _could_ trip the autoload, and if there are unresolved
+ # gems at that time, this method could be called inside another require,
+ # thus raising with that constant being undefined. Better to check a method
+ if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?)
+ Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.untaint
+ else
+ rg_full_gem_path
+ end
end
def full_require_paths