mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-16 22:06:43 -06:00
* convert existing Cask:: namespace to Hbc:: * move Homebrew-fork code under Hbc:: * move freestanding classes such as Tty and TopologicalHash under Hbc:: * recast HOMEBREW_CASK_ constants as HBC_ * modify our Homebrew Formula for backward compatibility * devscripts and dev docs
28 lines
549 B
Ruby
28 lines
549 B
Ruby
class Hbc::Source::URI
|
|
def self.me?(query)
|
|
!!(query.to_s =~ 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}"
|
|
begin
|
|
curl(uri, '-o', path.to_s)
|
|
rescue Hbc::ErrorDuringExecution
|
|
raise Hbc::CaskUnavailableError.new uri
|
|
end
|
|
Hbc::Source::PathSlashOptional.new(path).load
|
|
end
|
|
|
|
def to_s
|
|
uri.to_s
|
|
end
|
|
end
|