aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/verify.rb
blob: d3c2713e7da73adcd122717e571f066b855076bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Hbc::Verify; end

require "hbc/verify/checksum"
require "hbc/verify/gpg"

module Hbc::Verify
  module_function

  def verifications
    [
      Hbc::Verify::Checksum
      # TODO: Hbc::Verify::Gpg
    ]
  end

  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
  end

  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
  end
end