mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-19 22:16:33 -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
22 lines
465 B
Ruby
22 lines
465 B
Ruby
class Cask::Source::URI
|
|
def self.me?(query)
|
|
!!(query =~ URI.regexp)
|
|
end
|
|
|
|
attr_reader :uri
|
|
|
|
def initialize(uri)
|
|
@uri = uri
|
|
end
|
|
|
|
def load
|
|
HOMEBREW_CACHE_CASKS.mkpath
|
|
path = HOMEBREW_CACHE_CASKS.join(File.basename(uri))
|
|
ohai "Downloading #{uri}"
|
|
odebug "Download target -> #{path.to_s}"
|
|
curl(uri, '-o', path.to_s)
|
|
Cask::Source::Path.new(path).load
|
|
rescue ErrorDuringExecution
|
|
raise CaskUnavailableError, uri
|
|
end
|
|
end
|