install: handle devel-only correctly

See the discussion in
https://github.com/Homebrew/homebrew-devel-only/pull/6

Closes Homebrew/homebrew#35793.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Dominyk Tiller 2015-01-12 23:03:38 +00:00 committed by Jack Nagel
parent 3613f0349e
commit 3f318b8ed4

View File

@ -40,20 +40,32 @@ module Homebrew
end end
ARGV.formulae.each do |f| ARGV.formulae.each do |f|
# Building head-only without --HEAD is an error # head-only without --HEAD is an error
if not ARGV.build_head? and f.stable.nil? if not ARGV.build_head? and f.stable.nil? and f.devel.nil?
raise <<-EOS.undent raise <<-EOS.undent
#{f.name} is a head-only formula #{f.name} is a head-only formula
Install with `brew install --HEAD #{f.name}` Install with `brew install --HEAD #{f.name}`
EOS EOS
end end
# Building stable-only with --HEAD is an error # devel-only without --devel is an error
if not ARGV.build_devel? and f.stable.nil?
if f.head.nil?
raise <<-EOS.undent
#{f.name} is a devel-only formula
Install with `brew install --devel #{f.name}`
EOS
else
raise "#{f.name} has no stable download, please choose --devel or --HEAD"
end
end
# --HEAD, fail with no head defined
if ARGV.build_head? and f.head.nil? if ARGV.build_head? and f.head.nil?
raise "No head is defined for #{f.name}" raise "No head is defined for #{f.name}"
end end
# Building stable-only with --devel is an error # --devel, fail with no devel defined
if ARGV.build_devel? and f.devel.nil? if ARGV.build_devel? and f.devel.nil?
raise "No devel block is defined for #{f.name}" raise "No devel block is defined for #{f.name}"
end end