mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 14:26:45 -06:00
* "Canonical App Name" becomes "Simplified App Name"
* devscript `cask_namer` renamed to `generate_cask_token`
* doc file `CASK_NAMING_REFERENCE.md` renamed to `cask_token_reference.md`
* DSL uses `"#{token}"` for interpolation instead of `"#{title}"`
* documentation text
* backend code (variables, method, class names)
* error message text
* tests
* code comments
* Cask comments
* emphasize `tags :name`
* doc: use "vendor" consistently instead of "developer"
* doc: many man page argument descriptions were incorrect
* incidental clarifications
Many backend variables similar to `cask_name` or `cask` have
been standardized to `cask_token`, `token`, etc, resolving a long-
standing ambiguity in which variables named `cask` might contain
a Cask instance or a string token.
In many places the docs could be shortened from "Cask name" to
simply "token", which is desirable because we use the term "Cask"
in too many contexts.
49 lines
996 B
Ruby
49 lines
996 B
Ruby
class Cask::CLI::Audit < Cask::CLI::Base
|
|
def self.help
|
|
'verifies installability of Casks'
|
|
end
|
|
|
|
def self.run(*args)
|
|
retval = new(args, Cask::Auditor).run
|
|
# retval is ternary: true/false/nil
|
|
if retval.nil?
|
|
raise CaskError.new("audit failed")
|
|
elsif ! retval
|
|
raise CaskError.new("some audits failed")
|
|
end
|
|
end
|
|
|
|
def initialize(args, auditor)
|
|
@args = args
|
|
@auditor = auditor
|
|
end
|
|
|
|
def run
|
|
count = 0
|
|
casks_to_audit.each do |cask|
|
|
count += 1 if audit(cask)
|
|
end
|
|
count == 0 ? nil : count == casks_to_audit.length
|
|
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_tokens.empty?
|
|
Cask.all
|
|
else
|
|
cask_tokens.map { |token| Cask.load(token) }
|
|
end
|
|
end
|
|
|
|
def cask_tokens
|
|
@cask_tokens ||= @args.reject { |a| a == '--download' }
|
|
end
|
|
end
|