diff options
author | Andre Arko <andre@arko.net> | 2015-12-30 12:37:28 +0800 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-01-25 10:49:51 -0600 |
commit | 0a805ca68570a26626ed4f38e945947b36b56c41 (patch) | |
tree | 00866dad4ec9052e9b79f5fdad04507d5b81d15b /lib/bundler/fetcher | |
parent | 9a79a7a06bc2e5ce0ecd48bbcd46c7faece42336 (diff) | |
download | bundler-0a805ca68570a26626ed4f38e945947b36b56c41.tar.gz |
update digest to include host+port as well as path
also shortening to the first 6 hex chars to reduce path length
Diffstat (limited to 'lib/bundler/fetcher')
-rw-r--r-- | lib/bundler/fetcher/compact_index.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index fa5594159d..767a3c565d 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -63,19 +63,23 @@ module Bundler def compact_index_client @compact_index_client ||= begin - path_digest = Digest::MD5.hexdigest(display_uri.path) - uri_part = [display_uri.host, display_uri.port, path_digest].compact.join(".") - index_path = Bundler.user_cache + "compact_index" + uri_part - compact_fetcher = lambda do |path, headers| downloader.fetch(fetch_uri + path, headers) end - SharedHelpers.filesystem_access(index_path) do - CompactIndexClient.new(index_path, compact_fetcher) + SharedHelpers.filesystem_access(cache_path) do + CompactIndexClient.new(cache_path, compact_fetcher) end end end + + def cache_path + uri_parts = [display_uri.host, display_uri.port, display_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(".") + Bundler.user_cache.join("compact_index", cache_path) + end end end end |