diff options
author | The Bundler Bot <bot@bundler.io> | 2017-11-30 15:19:20 +0000 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-12-11 20:42:18 +0900 |
commit | 2875b6e0c28ed3e9c1f4986c1f6d70a409c1d31e (patch) | |
tree | 4f9fd83994ca63120edd03d0fdab8563e97a6487 | |
parent | 3a0c85f4d38bea24e9393a98dc951d081361d586 (diff) | |
download | bundler-2875b6e0c28ed3e9c1f4986c1f6d70a409c1d31e.tar.gz |
Auto merge of #6188 - bundler:indirect/fix-6072, r=indirect
Stop overriding specs during double-checks
This fixes my test-case reproduction of #6072. I’m pretty sure it’s because
the double-check was overriding the locally installed index specs with
specs fetched from the RubyGems API, causing Bundler to conclude that the
gems aren’t installed, even though they are.
@deivid-rodriguez @y-yagi can you verify that this patch fixes the issues with `inline` that you were seeing?
-rw-r--r-- | lib/bundler/definition.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 6 | ||||
-rw-r--r-- | spec/realworld/double_check_spec.rb | 40 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 4 | ||||
-rw-r--r-- | spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/request | 7 | ||||
-rw-r--r-- | spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/response | bin | 0 -> 254790 bytes |
6 files changed, 50 insertions, 9 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index f93ed76226..ad16389dae 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -295,7 +295,7 @@ module Bundler end sources.all_sources.each do |source| - source.double_check_for(unmet_dependency_names, :override_dupes) + source.double_check_for(unmet_dependency_names) end break if idxcount == idx.size diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 6f4157364f..3cf22a50f1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -252,10 +252,8 @@ module Bundler end end - def double_check_for(unmet_dependency_names, override_dupes = false, index = specs) + def double_check_for(unmet_dependency_names) return unless @allow_remote - raise ArgumentError, "missing index" unless index - return unless api_fetchers.any? unmet_dependency_names = unmet_dependency_names.call @@ -270,7 +268,7 @@ module Bundler Bundler.ui.debug "Double checking for #{unmet_dependency_names || "all specs (due to the size of the request)"} in #{self}" - fetch_names(api_fetchers, unmet_dependency_names, index, override_dupes) + fetch_names(api_fetchers, unmet_dependency_names, specs, false) end def dependency_names_to_double_check diff --git a/spec/realworld/double_check_spec.rb b/spec/realworld/double_check_spec.rb new file mode 100644 index 0000000000..6fee578a71 --- /dev/null +++ b/spec/realworld/double_check_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +RSpec.describe "double checking sources", :realworld => true do + it "finds already-installed gems" do + create_file("rails.gemspec", <<-RUBY) + Gem::Specification.new do |s| + s.name = "rails" + s.version = "5.1.4" + s.summary = "" + s.description = "" + s.author = "" + s.add_dependency "actionpack", "5.1.4" + end + RUBY + + create_file("actionpack.gemspec", <<-RUBY) + Gem::Specification.new do |s| + s.name = "actionpack" + s.version = "5.1.4" + s.summary = "" + s.description = "" + s.author = "" + s.add_dependency "rack", "~> 2.0.0" + end + RUBY + + cmd = <<-RUBY + require "bundler" + require #{File.expand_path("../../support/artifice/vcr.rb", __FILE__).dump} + require "bundler/inline" + gemfile(true) do + source "https://rubygems.org" + gem "rails", path: "." + end + RUBY + + ruby! cmd + ruby! cmd + end +end diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index dcaba3ab9d..18ca246199 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -43,10 +43,6 @@ RSpec.describe "bundler/inline#gemfile" do build_lib "eight", "1.0.0" do |s| s.write "lib/eight.rb", "puts 'eight'" end - - build_lib "four", "1.0.0" do |s| - s.write "lib/four.rb", "puts 'four'" - end end it "requires the gems" do diff --git a/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/request b/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/request new file mode 100644 index 0000000000..ed63e334fa --- /dev/null +++ b/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/request @@ -0,0 +1,7 @@ +> GET /gems/rack-2.0.1.gem +> accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3 +> accept: */* +> user-agent: Ruby +> connection: keep-alive +> keep-alive: 30 +> host: rubygems.org
\ No newline at end of file diff --git a/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/response b/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/response Binary files differnew file mode 100644 index 0000000000..4e2fc2b8cd --- /dev/null +++ b/spec/support/artifice/vcr_cassettes/realworld/rubygems.org/gems/rack-2.0.1.gem/GET/response |