[前][次][番号順一覧][スレッド一覧]

ruby-changes:67419

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:06 +0900 (JST)
Subject: [ruby-changes:67419] 7116ec6199 (master): [rubygems/rubygems] Requiring `bundler/setup` shouldn't try to hit the network

https://git.ruby-lang.org/ruby.git/commit/?id=7116ec6199

From 7116ec6199ea55756154167676bb0c8296f8a391 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Sat, 31 Jul 2021 15:05:29 +0200
Subject: [rubygems/rubygems] Requiring `bundler/setup` shouldn't try to hit
 the network

https://github.com/rubygems/rubygems/commit/06f5efce02
---
 lib/bundler/definition.rb                    |  2 +-
 spec/bundler/install/gemfile/sources_spec.rb | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index a0a4867..2bd1290 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -512,7 +512,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/definition.rb#L512
     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?
diff --git a/spec/bundler/install/gemfile/sources_spec.rb b/spec/bundler/install/gemfile/sources_spec.rb
index 72d05aa..9885145 100644
--- a/spec/bundler/install/gemfile/sources_spec.rb
+++ b/spec/bundler/install/gemfile/sources_spec.rb
@@ -1280,7 +1280,7 @@ RSpec.describe "bundle install with gems on multiple sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/sources_spec.rb#L1280
     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"
 
@@ -1296,6 +1296,21 @@ RSpec.describe "bundle install with gems on multiple sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gemfile/sources_spec.rb#L1296
     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
 
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]