formula_support: don't fail without CLT/Xcode

`Formula#keg_only?` could fail if it was invoked on a formula with a
`:provided_until_xcode43` or `:provided_until_xcode5` reason given to
`keg_only`, if neither the Command Line Tools nor Xcode was installed.
Check whether Xcode is installed before querying the Xcode version.

Closes #317.
This commit is contained in:
Martin Afanasjew 2016-06-05 12:46:43 +02:00
parent d363ae53c0
commit 25baaa61ac

View File

@ -18,9 +18,9 @@ class KegOnlyReason
when :provided_pre_el_capitan
MacOS.version < :el_capitan
when :provided_until_xcode43
MacOS::Xcode.version < "4.3"
MacOS::Xcode.installed? && MacOS::Xcode.version < "4.3"
when :provided_until_xcode5
MacOS::Xcode.version < "5.0"
MacOS::Xcode.installed? && MacOS::Xcode.version < "5.0"
else
true
end