summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-02-19 09:29:33 +0000
committerSamuel Giddins <segiddins@segiddins.me>2017-02-22 11:54:12 +1100
commit240eafd9b060b41f700615ae1a9184b50c5ee58a (patch)
tree67740662ad007ab855a514ba615e40f7fd29a2ef
parentf433481f30f69138a8cf36d42a4442f15f9f03c6 (diff)
downloadbundler-240eafd9b060b41f700615ae1a9184b50c5ee58a.tar.gz
Auto merge of #5450 - bundler:seg-stub-specification-missing-extensions, r=indirect
[StubSpecification] Avoid loading all installed gemspecs Call through to the stub instead of materializing the full remote_spec since all gems added to the local index are asked whether they are missing extensions or not (cherry picked from commit 03519085bd3962dabca67038168e67fb7a0fe6b1)
-rw-r--r--lib/bundler/stub_specification.rb7
-rw-r--r--spec/runtime/setup_spec.rb28
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/bundler/stub_specification.rb b/lib/bundler/stub_specification.rb
index f4ee7d0644..cbcadee269 100644
--- a/lib/bundler/stub_specification.rb
+++ b/lib/bundler/stub_specification.rb
@@ -15,6 +15,13 @@ module Bundler
_remote_specification.to_yaml
end
+ if Bundler.rubygems.provides?(">= 2.3")
+ # This is defined directly to avoid having to load every installed spec
+ def missing_extensions?
+ stub.missing_extensions?
+ end
+ end
+
private
def _remote_specification
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index e2756f7cc3..d8a70ca4be 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -673,6 +673,34 @@ describe "Bundler.setup" do
expect(out).to be_empty
end
+ it "does not load all gemspecs", :rubygems => ">= 2.3" do
+ install_gemfile! <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ run! <<-R
+ File.open(File.join(Gem.dir, "specifications", "broken.gemspec"), "w") do |f|
+ f.write <<-RUBY
+# -*- encoding: utf-8 -*-
+# stub: broken 1.0.0 ruby lib
+
+Gem::Specification.new do |s|
+ s.name = "broken"
+ s.version = "1.0.0"
+ raise "BROKEN GEMSPEC"
+end
+ RUBY
+ end
+ R
+
+ run! <<-R
+ puts "WIN"
+ R
+
+ expect(out).to eq("WIN")
+ end
+
it "ignores empty gem paths" do
install_gemfile <<-G
source "file://#{gem_repo1}"