Skip to content

Commit

Permalink
Merge pull request #3105 from rolandwalker/appcast_dsl
Browse files Browse the repository at this point in the history
add optional appcast stanza to DSL
  • Loading branch information
rolandwalker committed Feb 25, 2014
2 parents abe1f17 + fe2ff07 commit f3bbecb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def homepage; self.class.homepage; end

def url; self.class.url; end

def appcast; self.class.appcast; end

def version; self.class.version; end

def depends_on_formula; self.class.depends_on_formula; end
Expand Down Expand Up @@ -37,6 +39,15 @@ def url(*args)
end
end

def appcast(*args)
if @appcast and !args.empty?
raise CaskInvalidError.new(self.title, "'appcast' stanza may only appear once")
end
@appcast ||= begin
Cask::UnderscoreSupportingURI.parse(*args) unless args.empty?
end
end

def version(version=nil)
if @version and !version.nil?
raise CaskInvalidError.new(self.title, "'version' stanza may only appear once")
Expand Down
11 changes: 10 additions & 1 deletion lib/cask/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ def odumpcask cask
if Cask.respond_to?(:debug) and Cask.debug
odebug "Cask instance dumps in YAML:"
odebug "Cask instance toplevel:", cask.to_yaml
[:homepage, :url, :version, :sums, :artifacts, :caveats, :depends_on_formula].each do |method|
[
:homepage,
:url,
:appcast,
:version,
:sums,
:artifacts,
:caveats,
:depends_on_formula,
].each do |method|
odebug "Cask instance method '#{method}':", cask.send(method).to_yaml
end
end
Expand Down

0 comments on commit f3bbecb

Please sign in to comment.