Class: Hbc::CLI::Audit

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/lib/hbc/cli/audit.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, command_name, #initialize, run, visible

Methods included from Options

included, #process_arguments

Constructor Details

This class inherits a constructor from Hbc::CLI::AbstractCommand

Class Method Details

.helpObject



7
8
9
# File 'Library/Homebrew/cask/lib/hbc/cli/audit.rb', line 7

def self.help
  "verifies installability of Casks"
end

.needs_init?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'Library/Homebrew/cask/lib/hbc/cli/audit.rb', line 24

def self.needs_init?
  true
end

Instance Method Details

#audit(cask) ⇒ Object



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

def audit(cask)
  odebug "Auditing Cask #{cask}"
  Auditor.audit(cask, audit_download: download?, check_token_conflicts: token_conflicts?)
end

#runObject

Raises:



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

def run
  failed_casks = casks(alternative: -> { Hbc.all })
                 .reject { |cask| audit(cask) }

  return if failed_casks.empty?
  raise CaskError, "audit failed for casks: #{failed_casks.join(" ")}"
end