Class: Artifactory::GemImport::Gems::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/artifactory/gem_import/gems/verifier.rb

Instance Method Summary collapse

Instance Method Details

#call(cache_path, foreign_representation) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/artifactory/gem_import/gems/verifier.rb', line 7

def call(cache_path, foreign_representation)
  md5, foreign_md5 = calculate_checksums File.open(cache_path, "r"),
                                         foreign_representation

  md5 == foreign_md5 ? [:ok] :
    [:failed, "Checksum comparison for uploaded gem #{File.basename cache_path} failed. Expected #{md5}, got #{foreign_md5}"]
end