ruby-changes:67429
From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:12 +0900 (JST)
Subject: [ruby-changes:67429] 0e01ad881a (master): [rubygems/rubygems] The `--local` flag to `bundle install` shouldn't hit the network
https://git.ruby-lang.org/ruby.git/commit/?id=0e01ad881a From 0e01ad881a94d0195dcea36783f0bb525d054e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sat, 31 Jul 2021 15:39:45 +0200 Subject: [rubygems/rubygems] The `--local` flag to `bundle install` shouldn't hit the network If the cache was missing, `bundler` would try to re-fetch it. With the `--local` flag, it should just look at installed gems. https://github.com/rubygems/rubygems/commit/630d29c69e --- lib/bundler/source/rubygems.rb | 1 + spec/bundler/commands/install_spec.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 6728ffd..2e0ecb1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -50,6 +50,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/source/rubygems.rb#L50 return if @allow_cached @specs = nil + @allow_local = true @allow_cached = true end diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 4120003..babb0c6 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -759,4 +759,22 @@ RSpec.describe "bundle install with gem sources" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/install_spec.rb#L759 ) end end + + context "with --local flag" do + before do + system_gems "rack-1.0.0", :path => default_bundle_path + end + + it "respects installed gems without fetching any remote sources" do + install_gemfile <<-G, :local => true + source "#{file_uri_for(gem_repo1)}" + + source "https://not-existing-source" do + gem "rack" + end + G + + expect(last_command).to be_success + end + end end -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/