homebrew-cask-versions/lib/hbc/source/tapped_qualified.rb
Roland Walker b40b0c99e1 strip constants from homebrew-fork global.rb
and corresponding testing_env.rb.
* recast HOMEBREW_BREW_FILE as Hbc.homebrew_executable,
  defined in Hbc::Locations
* recast HOMEBREW_REPOSITORY as Hbc.homebrew_repository
* recast HOMEBREW_PREFIX as Hbc.homebrew_prefix
* remove HOMEBREW_LIBRARY
* recast existing Hbc.tapspath as Hbc.homebrew_tapspath
  to match new methods

fixes #8705
2015-01-07 09:09:53 -05:00

14 lines
414 B
Ruby

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