diff options
author | Andre Arko <andre@arko.net> | 2016-10-08 17:03:55 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2016-10-08 17:03:55 -0700 |
commit | 817d279e10682e042d0fc43938cbd6ef91b9effa (patch) | |
tree | 86b58bdbdef58f4d874657524bed60f2df88f59c | |
parent | 3029c9a6eea84a5948fbf140446f649d1db0d462 (diff) | |
download | bundler-aa-debug-etag-mismatch.tar.gz |
clearer objects, fix fetch_url typoaa-debug-etag-mismatch
-rw-r--r-- | lib/bundler/fetcher/compact_index.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/bundler/fetcher/compact_index.rb b/lib/bundler/fetcher/compact_index.rb index d329398624..38105a3f8f 100644 --- a/lib/bundler/fetcher/compact_index.rb +++ b/lib/bundler/fetcher/compact_index.rb @@ -80,8 +80,7 @@ module Bundler def compact_index_client @compact_index_client ||= begin SharedHelpers.filesystem_access(cache_path) do - compact_fetcher = Fetcher.new(downloader, fetch_url, Bundler.ui) - CompactIndexClient.new(cache_path, compact_fetcher) + CompactIndexClient.new(cache_path, client_fetcher) end.tap do |client| client.in_parallel = lambda do |inputs, &blk| func = lambda {|object, _index| blk.call(object) } @@ -107,9 +106,13 @@ module Bundler Bundler.user_cache.join("compact_index", remote.cache_slug) end - Fetcher = Struct.new(:downloader, :fetch_uri, :ui) do + def client_fetcher + ClientFetcher.new(self, Bundler.ui) + end + + ClientFetcher = Struct.new(:fetcher, :ui) do def call(path, headers) - downloader.fetch(fetch_uri + path, headers) + fetcher.downloader.fetch(fetcher.fetch_uri + path, headers) rescue NetworkDownError => e raise unless Bundler.feature_flag.allow_offline_install? && headers["If-None-Match"] ui.warn "Using the cached data for the new index because of a network error: #{e}" |