1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Requiring bundler/setup shouldn't try to hit the network

https://github.com/rubygems/rubygems/commit/06f5efce02
This commit is contained in:
David Rodríguez 2021-07-31 15:05:29 +02:00 committed by Hiroshi SHIBATA
parent 0b4dbe2e6a
commit 7116ec6199
Notes: git 2021-08-31 19:07:20 +09:00
2 changed files with 17 additions and 2 deletions

View file

@ -512,7 +512,7 @@ module Bundler
end
def precompute_source_requirements_for_indirect_dependencies?
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
@remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
end
def current_ruby_platform_locked?

View file

@ -1280,7 +1280,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
expect(out).to include("Using example 0.1.0")
end
it "fails inmmediately with a helpful error when a non retriable network error happens while resolving sources" do
it "fails inmmediately with a helpful error when a rubygems source does not exist and bundler/setup is required" do
gemfile <<-G
source "https://gem.repo1"
@ -1295,6 +1295,21 @@ RSpec.describe "bundle install with gems on multiple sources" do
R
end
expect(last_command).to be_failure
expect(err).to include("Could not find gem 'example' in locally installed gems.")
end
it "fails inmmediately with a helpful error when a non retriable network error happens while resolving sources" do
gemfile <<-G
source "https://gem.repo1"
source "https://gem.repo4" do
gem "example"
end
G
bundle "install", :artifice => nil, :raise_on_error => false
expect(last_command).to be_failure
expect(err).to include("Could not reach host gem.repo4. Check your network connection and try again.")
end