Skip to content

Commit db5d069

Browse files
hsbtclaude
andcommitted
Refresh vendored compact_index when COMPACT_INDEX_REF is set
Previously the install_vendored_compact_index short-circuit only checked whether `tmp/compact_index/lib/compact_index.rb` existed, so once any ref was vendored a subsequent `COMPACT_INDEX_REF=<sha> bin/rspec ...` kept serving the stale copy. Drop the vendor tree first when the env var is explicitly set so an override always re-fetches against the requested ref. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d8536e1 commit db5d069

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

spec/support/rubygems_ext.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,19 @@ def install_test_deps
7979

8080
# Vendor `rubygems/rubygems.org#lib/compact_index/` under `tmp/compact_index/`
8181
# so the artifice can serve compact-index responses without a runtime gem
82-
# dependency. Pinned to a reviewed commit; override with COMPACT_INDEX_REF.
82+
# dependency. Pinned to a reviewed commit; override with COMPACT_INDEX_REF
83+
# to refresh against another ref (the existing vendor copy is discarded).
8384
def install_vendored_compact_index
8485
target_root = Path.tmp_root.join("compact_index")
85-
return if File.exist?(target_root.join("lib/compact_index.rb"))
86-
87-
require "open-uri"
8886
require "fileutils"
8987

88+
if ENV["COMPACT_INDEX_REF"]
89+
FileUtils.rm_rf(target_root)
90+
elsif File.exist?(target_root.join("lib/compact_index.rb"))
91+
return
92+
end
93+
94+
require "open-uri"
9095
ref = ENV["COMPACT_INDEX_REF"] || "7c68a7b39761c61a66f9299f85b889ec39afc02c"
9196
%w[
9297
lib/compact_index.rb

0 commit comments

Comments
 (0)