34 lines
837 B
Ruby
Raw Normal View History

2016-08-18 22:11:42 +03:00
require "hbc/verify/checksum"
require "hbc/verify/gpg"
2016-09-24 13:52:43 +02:00
module Hbc
module Verify
module_function
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def verifications
[
Hbc::Verify::Checksum
# TODO: Hbc::Verify::Gpg
]
end
2016-08-18 22:11:42 +03:00
2016-09-24 13:52:43 +02:00
def all(cask, downloaded_path)
odebug "Verifying download"
verifications = for_cask(cask)
odebug "#{verifications.size} verifications defined", verifications
verifications.each do |verification|
odebug "Running verification of class #{verification}"
verification.new(cask, downloaded_path).verify
end
2016-08-18 22:11:42 +03:00
end
2016-09-24 13:52:43 +02:00
def for_cask(cask)
odebug "Determining which verifications to run for Cask #{cask}"
verifications.select do |verification|
odebug "Checking for verification class #{verification}"
verification.me?(cask)
end
2016-08-18 22:11:42 +03:00
end
end
end