Class: Cask::Audit

Inherits:
Object
  • Object
show all
Extended by:
Predicable
Includes:
Checkable
Defined in:
brew/Library/Homebrew/cask/audit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Predicable

attr_predicate

Methods included from Checkable

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

Constructor Details

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

Returns a new instance of Audit



18
19
20
21
22
23
24
25
26
# File 'brew/Library/Homebrew/cask/audit.rb', line 18

def initialize(cask, check_appcast: false, download: false, check_token_conflicts: false,
               commit_range: nil, command: SystemCommand)
  @cask = cask
  @check_appcast = check_appcast
  @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



14
15
16
# File 'brew/Library/Homebrew/cask/audit.rb', line 14

def cask
  @cask
end

#commit_rangeObject (readonly)

Returns the value of attribute commit_range



14
15
16
# File 'brew/Library/Homebrew/cask/audit.rb', line 14

def commit_range
  @commit_range
end

#downloadObject (readonly)

Returns the value of attribute download



14
15
16
# File 'brew/Library/Homebrew/cask/audit.rb', line 14

def download
  @download
end

Instance Method Details

#check_token_conflicts?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'brew/Library/Homebrew/cask/audit.rb', line 28

def check_token_conflicts?
  @check_token_conflicts
end

#run!Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'brew/Library/Homebrew/cask/audit.rb', line 32

def run!
  check_required_stanzas
  check_version
  check_sha256
  check_url
  check_generic_artifacts
  check_token_conflicts
  check_download
  check_https_availability
  check_single_pre_postflight
  check_single_uninstall_zap
  check_untrusted_pkg
  check_hosting_with_appcast
  check_latest_with_appcast
  check_latest_with_auto_updates
  check_stanza_requires_uninstall
  check_appcast_contains_version
  self
rescue => e
  odebug "#{e.message}\n#{e.backtrace.join("\n")}"
  add_error "exception while auditing #{cask}: #{e.message}"
  self
end

#success?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'brew/Library/Homebrew/cask/audit.rb', line 56

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

#summary_headerObject



60
61
62
# File 'brew/Library/Homebrew/cask/audit.rb', line 60

def summary_header
  "audit for #{cask}"
end