mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-19 14:26:46 -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.
40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
class Cask::Source::Tapped
|
|
def self.me?(query)
|
|
path_for_query(query).exist?
|
|
end
|
|
|
|
def self.path_for_query(query)
|
|
# Repeating Cask.all_tokens is very slow for operations such as
|
|
# brew cask list, but memoizing the value might cause breakage
|
|
# elsewhere, given that installation and tap status is permitted
|
|
# to change during the course of an invocation.
|
|
token_with_tap = Cask.all_tokens.find { |t| t.split('/').last == query.sub(/\.rb$/i,'') }
|
|
if token_with_tap
|
|
user, repo, token = token_with_tap.split('/')
|
|
Cask.tapspath.join(user, repo, 'Casks', "#{token}.rb")
|
|
else
|
|
Cask.tapspath.join(Cask.default_tap, 'Casks', "#{query.sub(/\.rb$/i,'')}.rb")
|
|
end
|
|
end
|
|
|
|
attr_reader :token
|
|
|
|
def initialize(token)
|
|
@token = token
|
|
end
|
|
|
|
# todo removeme transitional backward-compatibility
|
|
def title
|
|
@token
|
|
end
|
|
|
|
def load
|
|
path = self.class.path_for_query(token)
|
|
Cask::Source::PathSlashOptional.new(path).load
|
|
end
|
|
|
|
def to_s
|
|
# stringify to fully-resolved location
|
|
self.class.path_for_query(token).expand_path.to_s
|
|
end
|
|
end
|