Allow "devel-only" formulae

It seems only natural that this should be possible, or at the very
least, it should not result in calling methods on nil.
This commit is contained in:
Jack Nagel 2013-04-13 17:40:13 -05:00
parent 2e26afe556
commit 4bd34c9624
2 changed files with 13 additions and 1 deletions

View File

@ -73,7 +73,8 @@ class Formula
when @head && ARGV.build_head? then @head # --HEAD when @head && ARGV.build_head? then @head # --HEAD
when @devel && ARGV.build_devel? then @devel # --devel when @devel && ARGV.build_devel? then @devel # --devel
when @bottle && install_bottle?(self) then @bottle # bottle available when @bottle && install_bottle?(self) then @bottle # bottle available
when @stable.nil? && @head then @head # head-only when @devel && @stable.nil? then @devel # devel-only
when @head && @stable.nil? then @head # head-only
else @stable else @stable
end end
end end

View File

@ -59,6 +59,17 @@ class FormulaValidationTests < Test::Unit::TestCase
end end
end end
def test_devel_only_valid
assert_nothing_raised do
formula do
devel do
url "foo"
version "1.0"
end
end
end
end
def test_head_only_valid def test_head_only_valid
assert_nothing_raised do assert_nothing_raised do
formula do formula do