mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 06:16:47 -06:00
- add new file "cask/utils.rb" analogous to "utils.rb" in Homebrew - define odebug and odumpcask, analogs of ohai and friends, but which only give output when --debug is in effect - move the debug setting from an instance variable in Cask::CLI to a method Cask.debug, defined in "lib/cask/options.rb", which was added in #2276. (Perhaps options.rb should be merged back into Cask::CLI). - sprinkle odebug statements liberally throughout the codebase - update tests
32 lines
775 B
Ruby
32 lines
775 B
Ruby
module Cask::Source; end
|
|
|
|
require 'cask/source/gone'
|
|
require 'cask/source/path'
|
|
require 'cask/source/tapped_qualified'
|
|
require 'cask/source/untapped_qualified'
|
|
require 'cask/source/tapped'
|
|
require 'cask/source/uri'
|
|
|
|
module Cask::Source
|
|
def self.sources
|
|
[
|
|
Cask::Source::URI,
|
|
Cask::Source::Path,
|
|
Cask::Source::TappedQualified,
|
|
Cask::Source::UntappedQualified,
|
|
Cask::Source::Tapped,
|
|
Cask::Source::Gone,
|
|
]
|
|
end
|
|
|
|
def self.for_query(query)
|
|
odebug "Translating '#{query}' into a valid Cask source"
|
|
source = sources.find do |s|
|
|
odebug "Testing source class #{s}"
|
|
s.me?(query)
|
|
end
|
|
raise CaskUnavailableError.new(query) unless source
|
|
odebug "Using source class #{source}"
|
|
source.new(query)
|
|
end
|
|
end
|