mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-18 14:17:07 -06:00
- add new file "cask/utils.rb" analogous to "utils.rb" in Homebrew - define odebug and odumpcask, analogs of ohai and friends, but which only give output when --debug is in effect - move the debug setting from an instance variable in Cask::CLI to a method Cask.debug, defined in "lib/cask/options.rb", which was added in #2276. (Perhaps options.rb should be merged back into Cask::CLI). - sprinkle odebug statements liberally throughout the codebase - update tests
39 lines
686 B
Ruby
39 lines
686 B
Ruby
class Cask::CLI::Audit
|
|
def self.help
|
|
'verifies installability of casks'
|
|
end
|
|
|
|
def self.run(*args)
|
|
new(args, Cask::Auditor).run
|
|
end
|
|
|
|
def initialize(args, auditor)
|
|
@args = args
|
|
@auditor = auditor
|
|
end
|
|
|
|
def run
|
|
casks_to_audit.each { |cask| audit(cask) }
|
|
end
|
|
|
|
def audit(cask)
|
|
odebug "Auditing Cask #{cask}"
|
|
@auditor.audit(cask, :audit_download => audit_download?)
|
|
end
|
|
|
|
def audit_download?
|
|
@args.include?('--download')
|
|
end
|
|
|
|
def casks_to_audit
|
|
if cask_list.empty?
|
|
Cask.all
|
|
else
|
|
cask_list.map { |arg| Cask.load(arg) }
|
|
end
|
|
end
|
|
|
|
def cask_list
|
|
@cask_list ||= @args.reject { |a| a == '--download' }
|
|
end
|
|
end
|