2013-06-09 13:44:59 -05:00
|
|
|
FormulaConflict = Struct.new(:name, :reason)
|
|
|
|
|
2012-02-04 18:45:08 -08:00
|
|
|
# Used to annotate formulae that duplicate OS X provided software
|
|
|
|
# or cause conflicts when linked in.
|
|
|
|
class KegOnlyReason
|
|
|
|
attr_reader :reason, :explanation
|
|
|
|
|
|
|
|
def initialize reason, explanation=nil
|
|
|
|
@reason = reason
|
|
|
|
@explanation = explanation
|
|
|
|
end
|
|
|
|
|
2012-08-09 02:00:58 -05:00
|
|
|
def valid?
|
2014-04-01 21:35:22 -05:00
|
|
|
case @reason
|
|
|
|
when :provided_pre_mountain_lion
|
|
|
|
MacOS.version < :mountain_lion
|
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
2012-08-09 02:00:58 -05:00
|
|
|
end
|
2012-02-04 18:45:08 -08:00
|
|
|
|
2012-08-09 02:00:58 -05:00
|
|
|
def to_s
|
|
|
|
case @reason
|
|
|
|
when :provided_by_osx then <<-EOS.undent
|
|
|
|
Mac OS X already provides this software and installing another version in
|
|
|
|
parallel can cause all kinds of trouble.
|
|
|
|
|
|
|
|
#{@explanation}
|
|
|
|
EOS
|
2012-08-23 09:49:08 -07:00
|
|
|
when :provided_pre_mountain_lion then <<-EOS.undent
|
|
|
|
Mac OS X already provides this software in versions before Mountain Lion.
|
2012-08-09 02:00:58 -05:00
|
|
|
|
|
|
|
#{@explanation}
|
|
|
|
EOS
|
2012-02-04 18:45:08 -08:00
|
|
|
else
|
2012-08-09 02:00:58 -05:00
|
|
|
@reason
|
|
|
|
end.strip
|
2012-02-04 18:45:08 -08:00
|
|
|
end
|
|
|
|
end
|