From fe2ff07f2e9f6a8ab75a34acb34678bebb14490f Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Sat, 22 Feb 2014 17:48:29 -0500 Subject: [PATCH] add optional appcast stanza to DSL Appcasts are a standard way for applications to publish information about available updates via RSS. Sparkle and other update frameworks are built upon appcasts. In a quick test, appcasts were found for 188/360 Casks examined. This PR adds an optional `appcast` stanza, but does not add `appcast` to any Cask or make use of the info in any way. It is intentionally left undocumented. --- lib/cask/dsl.rb | 11 +++++++++++ lib/cask/utils.rb | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/cask/dsl.rb b/lib/cask/dsl.rb index 50901c558f3ec..d9e11cb3feb0f 100644 --- a/lib/cask/dsl.rb +++ b/lib/cask/dsl.rb @@ -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 @@ -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") diff --git a/lib/cask/utils.rb b/lib/cask/utils.rb index 73e0cf485badf..dfdefbdb2f5d2 100644 --- a/lib/cask/utils.rb +++ b/lib/cask/utils.rb @@ -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