Class: Hbc::Audit

Inherits:
Object
  • Object
show all
Includes:
Checkable
Defined in:
Library/Homebrew/cask/lib/hbc/audit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Checkable

#add_error, #add_warning, #errors, #errors?, #result, #summary, #warnings, #warnings?

Constructor Details

#initialize(cask, download: false, check_token_conflicts: false, commit_range: nil, command: SystemCommand) ⇒ Audit



12
13
14
15
16
17
18
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 12

def initialize(cask, download: false, check_token_conflicts: false, commit_range: nil, command: SystemCommand)
  @cask = cask
  @download = download
  @commit_range = commit_range
  @check_token_conflicts = check_token_conflicts
  @command = command
end

Instance Attribute Details

#caskObject (readonly)

Returns the value of attribute cask



10
11
12
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 10

def cask
  @cask
end

#commit_rangeObject (readonly)

Returns the value of attribute commit_range



10
11
12
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 10

def commit_range
  @commit_range
end

#downloadObject (readonly)

Returns the value of attribute download



10
11
12
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 10

def download
  @download
end

Instance Method Details

#check_token_conflicts?Boolean



20
21
22
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 20

def check_token_conflicts?
  @check_token_conflicts
end

#run!Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 24

def run!
  check_required_stanzas
  check_version_and_checksum
  check_version
  check_sha256
  check_appcast
  check_url
  check_generic_artifacts
  check_token_conflicts
  check_download
  check_single_pre_postflight
  check_single_uninstall_zap
  self
rescue StandardError => e
  odebug "#{e.message}\n#{e.backtrace.join("\n")}"
  add_error "exception while auditing #{cask}: #{e.message}"
  self
end

#success?Boolean



43
44
45
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 43

def success?
  !(errors? || warnings?)
end

#summary_headerObject



47
48
49
# File 'Library/Homebrew/cask/lib/hbc/audit.rb', line 47

def summary_header
  "audit for #{cask}"
end