diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-01-03 00:42:47 -0600 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-01-25 10:49:51 -0600 |
commit | 5b39d8d4af10ea8f30e88305c350a2b78a69e52a (patch) | |
tree | ab58861721d56397b20b311e9c4e16f341151c1d | |
parent | bfeccc1f9714f5d290b8ac2ddc2a8aca5e23c939 (diff) | |
download | bundler-5b39d8d4af10ea8f30e88305c350a2b78a69e52a.tar.gz |
[CompactIndex] Use the cache_uri for the cache path
-rw-r--r-- | lib/bundler/fetcher/compact_index.rb | 5 | ||||
-rw-r--r-- | spec/bundler/fetcher_spec.rb | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index 767a3c565d..d4be8931b4 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -74,10 +74,11 @@ module Bundler end def cache_path - uri_parts = [display_uri.host, display_uri.port, display_uri.path].compact.join(".") + cache_uri = remote.cache_uri + uri_parts = [cache_uri.host, cache_uri.port, cache_uri.path].compact.join(".") uri_digest = Digest::MD5.hexdigest(uri_parts) - cache_path = [display_uri.host, display_uri.port, uri_digest[0..5]].compact.join(".") + cache_path = [cache_uri.host, cache_uri.port, uri_digest[0..5]].compact.join(".") Bundler.user_cache.join("compact_index", cache_path) end end diff --git a/spec/bundler/fetcher_spec.rb b/spec/bundler/fetcher_spec.rb index 0b10371f25..0bb6cb934a 100644 --- a/spec/bundler/fetcher_spec.rb +++ b/spec/bundler/fetcher_spec.rb @@ -50,6 +50,13 @@ describe Bundler::Fetcher do fetcher.send(:connection).override_headers["X-Gemfile-Source"] ).to eq("http://zombo.com") end + + it "caches things based upon the original source" do + compact_index_fetcher = fetcher.fetchers.first + expect(compact_index_fetcher).to be_a(described_class::CompactIndex) + expect(compact_index_fetcher.send(:compact_index_client).directory). + to eq(home + ".bundle/cache/compact_index/cache_zombo.com.80.fc7f36") + end end context "when there is no rubygems source mirror set" do |