brew/Library/Homebrew/formula_support.rb

48 lines
1.3 KiB
Ruby
Raw Normal View History

2014-02-22 07:51:33 -08:00
# Used to track formulae that cannot be installed at the same time
FormulaConflict = Struct.new(:name, :reason)
# Used to annotate formulae that duplicate OS X provided software
# or cause conflicts when linked in.
class KegOnlyReason
def initialize(reason, explanation)
@reason = reason
@explanation = explanation
end
def valid?
2014-04-01 21:35:22 -05:00
case @reason
when :provided_pre_mountain_lion
MacOS.version < :mountain_lion
when :provided_until_xcode43
MacOS::Xcode.version < "4.3"
when :provided_until_xcode5
MacOS::Xcode.version < "5.0"
2014-04-01 21:35:22 -05:00
else
true
end
end
def to_s
return @explanation unless @explanation.empty?
case @reason
when :provided_by_osx then <<-EOS
2015-06-16 20:02:10 -04:00
OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
EOS
when :shadowed_by_osx then <<-EOS
2015-06-16 20:02:10 -04:00
OS X provides similar software, and installing this software in
parallel can cause all kinds of trouble.
EOS
when :provided_pre_mountain_lion then <<-EOS
2015-06-16 20:02:10 -04:00
OS X already provides this software in versions before Mountain Lion.
EOS
when :provided_until_xcode43
"Xcode provides this software prior to version 4.3."
when :provided_until_xcode5
"Xcode provides this software prior to version 5."
else
@reason
end.strip
end
end