diff options
| author | Bryan Woods <bryan@sayrhino.com> | 2026-06-05 13:54:48 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-06-08 07:24:32 +0000 |
| commit | 91023dbc74479c2f92f4f1bff21900f31e30e02c (patch) | |
| tree | 949005c00e50d95a60baf3c52c87ada8ede7d073 | |
| parent | 86cf1e8c06258d2207572d67eb3b020f36ae3cab (diff) | |
https://github.com/ruby/rubygems/commit/66dd16f025
| -rw-r--r-- | lib/bundler/source/rubygems.rb | 2 | ||||
| -rw-r--r-- | lib/bundler/source_list.rb | 4 | ||||
| -rw-r--r-- | spec/bundler/install/cooldown_spec.rb | 58 |
3 files changed, 63 insertions, 1 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index ed864604fe..9109f399a7 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -11,7 +11,7 @@ module Bundler API_REQUEST_SIZE = 100 REQUIRE_MUTEX = Mutex.new - attr_accessor :remotes + attr_accessor :remotes, :remote_cooldowns def initialize(options = {}) @options = options diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb index ab7002d6e5..954efbb65f 100644 --- a/lib/bundler/source_list.rb +++ b/lib/bundler/source_list.rb @@ -169,6 +169,10 @@ module Bundler # locked sources never include credentials so always prefer remotes from the gemfile replacement_source.remotes = gemfile_source.remotes + # cooldowns are only ever declared in the Gemfile, so carry them over + # along with the remotes they apply to + replacement_source.remote_cooldowns = gemfile_source.remote_cooldowns + yield replacement_source if block_given? replacement_source diff --git a/spec/bundler/install/cooldown_spec.rb b/spec/bundler/install/cooldown_spec.rb index bad7b7cf34..5cdfe72284 100644 --- a/spec/bundler/install/cooldown_spec.rb +++ b/spec/bundler/install/cooldown_spec.rb @@ -143,6 +143,64 @@ RSpec.describe "bundle install with the cooldown setting" do expect(the_bundle).to include_gems("ripe_gem 1.0.0") end + it "applies per-source Gemfile cooldown on bundle update when a lockfile exists" do + # Converging the Gemfile sources with the lockfile sources used to drop + # the per-source cooldown, so it only ever worked on a first resolve + # without a lockfile. + gemfile <<-G + source "https://gem.repo3", cooldown: 7 + gem "ripe_gem" + G + + lockfile <<-L + GEM + remote: https://gem.repo3/ + specs: + ripe_gem (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ripe_gem + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "update ripe_gem", artifice: "compact_index_cooldown" + + expect(the_bundle).to include_gems("ripe_gem 1.0.0") + end + + it "applies per-source Gemfile cooldown to gems added after the lockfile was written" do + gemfile <<-G + source "https://gem.repo3", cooldown: 7 + gem "ripe_gem" + gem "child" + G + + lockfile <<-L + GEM + remote: https://gem.repo3/ + specs: + ripe_gem (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ripe_gem + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "install", artifice: "compact_index_cooldown" + + expect(the_bundle).to include_gems("ripe_gem 1.0.0", "child 1.0.0") + end + it "is overridden by CLI --cooldown when Gemfile sets a different per-source value" do gemfile <<-G source "https://gem.repo3", cooldown: 0 |
