diff options
author | The Bundler Bot <bot@bundler.io> | 2017-02-19 09:29:33 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-02-19 09:29:33 +0000 |
commit | 03519085bd3962dabca67038168e67fb7a0fe6b1 (patch) | |
tree | 1294177d981ac786e54935d48063c447db818aa7 | |
parent | 65719a228a70dd1aa2233cbc4efe40a75e2bff12 (diff) | |
parent | 3e2ac90ca0213a0b9025c26052a49f1ffa767dfb (diff) | |
download | bundler-03519085bd3962dabca67038168e67fb7a0fe6b1.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
-rw-r--r-- | lib/bundler/stub_specification.rb | 7 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 28 |
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 f5b74833be..be0c7a1593 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -673,6 +673,34 @@ RSpec.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}" |