From 320356236dfcb5517bd8f8ebd5d2e3a47252b671 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 13 Sep 2013 11:13:12 -0500 Subject: [PATCH] head DSL can accept a block --- Library/Homebrew/formula.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 484ee429b2..7393221919 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -695,10 +695,16 @@ class Formula @devel.instance_eval(&block) end - def head val=nil, specs={} - return @head if val.nil? - @head ||= HeadSoftwareSpec.new - @head.url(val, specs) + def head val=nil, specs={}, &block + if block_given? + @head ||= HeadSoftwareSpec.new + @head.instance_eval(&block) + elsif val + @head ||= HeadSoftwareSpec.new + @head.url(val, specs) + else + @head + end end def version val=nil