From 28c8395f3de97bba70c20fc8fd0443ceed9f5453 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 22 Sep 2013 16:04:25 -0500 Subject: [PATCH] Group DSL methods that delegate to the stable spec --- Library/Homebrew/formula.rb | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 90ab6e66e7..f45725822d 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -647,15 +647,6 @@ class Formula attr_rw :homepage, :keg_only_reason, :cc_failures attr_rw :plist_startup, :plist_manual - Checksum::TYPES.each do |cksum| - class_eval <<-EOS, __FILE__, __LINE__ + 1 - def #{cksum}(val) - @stable ||= create_spec(SoftwareSpec) - @stable.#{cksum}(val) - end - EOS - end - def specs @specs ||= [] end @@ -666,16 +657,35 @@ class Formula spec end - def build - @stable ||= create_spec(SoftwareSpec) - @stable.build - end - def url val, specs={} @stable ||= create_spec(SoftwareSpec) @stable.url(val, specs) end + def version val=nil + @stable ||= create_spec(SoftwareSpec) + @stable.version(val) + end + + def mirror val + @stable ||= create_spec(SoftwareSpec) + @stable.mirror(val) + end + + Checksum::TYPES.each do |cksum| + class_eval <<-EOS, __FILE__, __LINE__ + 1 + def #{cksum}(val) + @stable ||= create_spec(SoftwareSpec) + @stable.#{cksum}(val) + end + EOS + end + + def build + @stable ||= create_spec(SoftwareSpec) + @stable.build + end + def stable &block return @stable unless block_given? @stable ||= create_spec(SoftwareSpec) @@ -706,16 +716,6 @@ class Formula end end - def version val=nil - @stable ||= create_spec(SoftwareSpec) - @stable.version(val) - end - - def mirror val - @stable ||= create_spec(SoftwareSpec) - @stable.mirror(val) - end - # Define a named resource using a SoftwareSpec style block def resource name, &block specs.each do |spec|