homebrew-cask-versions/lib/cask/cli/internal_dump.rb
Roland Walker a335d3b06d unify and recast "Cask name" & "title" as "token"
* "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.
2014-12-01 11:00:23 -05:00

32 lines
923 B
Ruby

class Cask::CLI::InternalDump < Cask::CLI::InternalUseBase
def self.run(*arguments)
cask_tokens = cask_tokens_from(arguments)
raise CaskUnspecifiedError if cask_tokens.empty?
retval = dump_casks(*cask_tokens)
# retval is ternary: true/false/nil
if retval.nil?
raise CaskError.new("nothing to dump")
elsif ! retval
raise CaskError.new("dump incomplete")
end
end
def self.dump_casks(*cask_tokens)
Cask.debug = true # Yuck. At the moment this is the only way to make dumps visible
count = 0
cask_tokens.each do |cask_token|
begin
cask = Cask.load(cask_token)
count += 1
cask.dumpcask
rescue StandardError => e
opoo "#{cask_token} was not found or would not load: #{e}"
end
end
count == 0 ? nil : count == cask_tokens.length
end
def self.help
"Dump the given Cask in YAML format"
end
end