homebrew-cask-versions/lib/cask/cli/audit.rb
Roland Walker 216444849e Add copious debugging with --debug
- 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
2014-01-28 10:15:43 -05:00

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