Skip to content

Commit 13020ac

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Path helper to build paths in compact index cache
ruby/rubygems@d28f9b8515
1 parent 51958ba commit 13020ac

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

spec/bundler/install/gems/compact_index_spec.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@
183183
gem "myrack"
184184
G
185185

186-
versions = Pathname.new(Bundler.rubygems.user_home).join(
187-
".bundle", "cache", "compact_index",
186+
versions = compact_index_cache_path.join(
188187
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
189188
)
190189
versions.dirname.mkpath
@@ -789,8 +788,7 @@ def start
789788
end
790789

791790
it "performs update with etag not-modified" do
792-
versions_etag = Pathname.new(Bundler.rubygems.user_home).join(
793-
".bundle", "cache", "compact_index",
791+
versions_etag = compact_index_cache_path.join(
794792
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions.etag"
795793
)
796794
expect(versions_etag.file?).to eq(false)
@@ -833,8 +831,7 @@ def start
833831
gem 'myrack', '1.0.0'
834832
G
835833

836-
versions = Pathname.new(Bundler.rubygems.user_home).join(
837-
".bundle", "cache", "compact_index",
834+
versions = compact_index_cache_path.join(
838835
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
839836
)
840837
# Modify the cached file. The ranged request will be based on this but,
@@ -876,8 +873,7 @@ def start
876873
G
877874

878875
# Create a partial cache versions file
879-
versions = Pathname.new(Bundler.rubygems.user_home).join(
880-
".bundle", "cache", "compact_index",
876+
versions = compact_index_cache_path.join(
881877
"localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5", "versions"
882878
)
883879
versions.dirname.mkpath
@@ -941,7 +937,7 @@ def start
941937

942938
bundle :install, artifice: "compact_index"
943939

944-
cache_path = File.join(Bundler.rubygems.user_home, ".bundle", "cache", "compact_index", "localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5")
940+
cache_path = compact_index_cache_path.join("localgemserver.test.80.dd34752a738ee965a2a4298dc16db6c5")
945941

946942
# We must remove the etag so that we don't ignore the range and get a 304 Not Modified.
947943
myrack_info_etag_path = File.join(cache_path, "info-etags", "myrack-92f3313ce5721296f14445c3a6b9c073")

spec/bundler/support/path.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ def default_cache_path(*path)
143143
end
144144
end
145145

146+
def compact_index_cache_path
147+
home(".bundle/cache/compact_index")
148+
end
149+
146150
def bundled_app(*path)
147151
root = tmp("bundled_app")
148152
FileUtils.mkdir_p(root)

0 commit comments

Comments
 (0)