homebrew-cask-versions/lib/hbc/source/untapped_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

17 lines
634 B
Ruby

require 'hbc/source/tapped_qualified'
class Hbc::Source::UntappedQualified < Hbc::Source::TappedQualified
def self.path_for_query(query)
user, repo, token = Hbc::QualifiedToken::parse(query)
token.sub!(/\.rb$/i,'')
tap = "#{user}/homebrew-#{repo}"
unless Hbc.homebrew_tapspath.join(tap).exist?
ohai "Adding new tap '#{tap}'"
result = Hbc::SystemCommand.run!(Hbc.homebrew_executable,
:args => ['tap', "#{user}/#{repo}"])
puts result.stdout
$stderr.puts result.stderr
end
Hbc.homebrew_tapspath.join(tap, 'Casks', "#{token}.rb")
end
end