Class: Bundler::CompactIndexClient::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/compact_index_client/updater.rb

Defined Under Namespace

Classes: MismatchedChecksumError

Instance Method Summary collapse

Constructor Details

#initialize(fetcher) ⇒ Updater

Returns a new instance of Updater.



12
13
14
# File 'lib/bundler/compact_index_client/updater.rb', line 12

def initialize(fetcher)
  @fetcher = fetcher
end

Instance Method Details

#update(remote_path, local_path, etag_path) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/bundler/compact_index_client/updater.rb', line 16

def update(remote_path, local_path, etag_path)
  append(remote_path, local_path, etag_path) || replace(remote_path, local_path, etag_path)
rescue CacheFile::DigestMismatchError => e
  raise MismatchedChecksumError.new(remote_path, e.message)
rescue Zlib::GzipFile::Error
  raise Bundler::HTTPError
end