mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -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.
86 lines
1.5 KiB
Ruby
86 lines
1.5 KiB
Ruby
class CaskError < RuntimeError; end
|
|
|
|
class CaskNotInstalledError < CaskError
|
|
attr_reader :token
|
|
def initialize(token)
|
|
@token = token
|
|
end
|
|
|
|
def to_s
|
|
"#{token} is not installed"
|
|
end
|
|
end
|
|
|
|
class CaskUnavailableError < CaskError
|
|
attr_reader :token
|
|
def initialize(token)
|
|
@token = token
|
|
end
|
|
|
|
def to_s
|
|
"No available Cask for #{token}"
|
|
end
|
|
end
|
|
|
|
class CaskAlreadyCreatedError < CaskError
|
|
attr_reader :token
|
|
def initialize(token)
|
|
@token = token
|
|
end
|
|
|
|
def to_s
|
|
%Q{A Cask for #{token} already exists. Run "brew cask cat #{token}" to see it.}
|
|
end
|
|
end
|
|
|
|
class CaskAlreadyInstalledError < CaskError
|
|
attr_reader :token
|
|
def initialize(token)
|
|
@token = token
|
|
end
|
|
|
|
def to_s
|
|
%Q{A Cask for #{token} is already installed. Add the "--force" option to force re-install.}
|
|
end
|
|
end
|
|
|
|
class CaskCommandFailedError < CaskError
|
|
def initialize(cmd, output, status)
|
|
@cmd = cmd
|
|
@output = output
|
|
@status = status
|
|
end
|
|
|
|
def to_s;
|
|
<<-EOS
|
|
Command failed to execute!
|
|
|
|
==> Failed command:
|
|
#{@cmd}
|
|
|
|
==> Output of failed command:
|
|
#{@output}
|
|
|
|
==> Exit status of failed command:
|
|
#{@status.inspect}
|
|
EOS
|
|
end
|
|
end
|
|
|
|
class CaskUnspecifiedError < CaskError
|
|
def to_s
|
|
"This command requires a Cask token"
|
|
end
|
|
end
|
|
|
|
class CaskInvalidError < CaskError
|
|
attr_reader :token, :submsg
|
|
def initialize(token, *submsg)
|
|
@token = token
|
|
@submsg = submsg.join(' ')
|
|
end
|
|
|
|
def to_s
|
|
"Cask '#{token}' definition is invalid" + (submsg.length > 0 ? ": #{submsg}" : '')
|
|
end
|
|
end
|