Class: Hbc::Verify::Checksum

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/cask/lib/hbc/verify/checksum.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cask, downloaded_path) ⇒ Checksum

Returns a new instance of Checksum



14
15
16
17
# File 'Library/Homebrew/cask/lib/hbc/verify/checksum.rb', line 14

def initialize(cask, downloaded_path)
  @cask = cask
  @downloaded_path = downloaded_path
end

Instance Attribute Details

#caskObject (readonly)

Returns the value of attribute cask



12
13
14
# File 'Library/Homebrew/cask/lib/hbc/verify/checksum.rb', line 12

def cask
  @cask
end

#downloaded_pathObject (readonly)

Returns the value of attribute downloaded_path



12
13
14
# File 'Library/Homebrew/cask/lib/hbc/verify/checksum.rb', line 12

def downloaded_path
  @downloaded_path
end

Class Method Details

.me?(cask) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'Library/Homebrew/cask/lib/hbc/verify/checksum.rb', line 6

def self.me?(cask)
  return true unless cask.sha256 == :no_check
  ohai "No checksum defined for Cask #{cask}, skipping verification"
  false
end

Instance Method Details

#verifyObject



19
20
21
22
23
# File 'Library/Homebrew/cask/lib/hbc/verify/checksum.rb', line 19

def verify
  return unless self.class.me?(cask)
  ohai "Verifying checksum for Cask #{cask}"
  verify_checksum
end