Method: Bundler::CompactIndexClient::Updater#checksum_for_file

Defined in:
lib/bundler/compact_index_client/updater.rb

#checksum_for_file(path) ⇒ Object



101
102
103
104
105
106
107
108
109
# File 'lib/bundler/compact_index_client/updater.rb', line 101

def checksum_for_file(path)
  return nil unless path.file?
  # This must use IO.read instead of Digest.file().hexdigest
  # because we need to preserve \n line endings on windows when calculating
  # the checksum
  SharedHelpers.filesystem_access(path, :read) do
    SharedHelpers.digest(:MD5).hexdigest(IO.read(path))
  end
end