homebrew-cask-versions/lib/cask/source/tapped_qualified.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

14 lines
411 B
Ruby

require 'cask/source/tapped'
class Cask::Source::TappedQualified < Cask::Source::Tapped
def self.me?(query)
!!Cask::QualifiedToken::parse(query) and path_for_query(query).exist?
end
def self.path_for_query(query)
user, repo, token = Cask::QualifiedToken::parse(query)
token.sub!(/\.rb$/i,'')
tap = "#{user}/homebrew-#{repo}"
Cask.tapspath.join(tap, 'Casks', "#{token}.rb")
end
end