homebrew-cask-versions/lib/hbc/dsl/appcast.rb
Roland Walker 202d6019f8 Move all code under an Hbc:: namespace
* 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
2015-01-02 07:27:03 -05:00

33 lines
935 B
Ruby

class Hbc::DSL::Appcast
# todo :latest_version is considered experimental
# and may be removed
APPCAST_FORMATS = Set.new [
:sparkle, # first one is the default
:plaintext,
:unknown,
]
attr_reader :parameters, :sha256, :format, :latest_version
def initialize(uri, parameters={})
@parameters = parameters
@uri = Hbc::UnderscoreSupportingURI.parse(uri)
@sha256 = @parameters[:sha256]
@latest_version = @parameters[:latest_version] # experimental
@format = @parameters[:format]
@format = APPCAST_FORMATS.first if @format.nil?
unless APPCAST_FORMATS.include?(@format)
raise "invalid appcast format: '#{@format.inspect}'"
end
end
def to_yaml
[@uri, @parameters].to_yaml
end
def to_s
@uri.to_s
end
end