Add :when_xquartz_installed as a keg-only reason
Using :when_xquartz_installed will tell the keg-only machinery to activate if XQuartz is installed. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
f970f9ec60
commit
a054dc5019
@ -63,7 +63,7 @@ module Homebrew extend self
|
|||||||
if f.keg_only?
|
if f.keg_only?
|
||||||
puts
|
puts
|
||||||
puts "This formula is keg-only."
|
puts "This formula is keg-only."
|
||||||
puts f.keg_only?
|
puts f.keg_only_reason
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -174,7 +174,12 @@ class Formula
|
|||||||
# rarely, you don't want your library symlinked into the main prefix
|
# rarely, you don't want your library symlinked into the main prefix
|
||||||
# see gettext.rb for an example
|
# see gettext.rb for an example
|
||||||
def keg_only?
|
def keg_only?
|
||||||
self.class.keg_only_reason || false
|
kor = self.class.keg_only_reason
|
||||||
|
not kor.nil? and kor.valid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def keg_only_reason
|
||||||
|
self.class.keg_only_reason
|
||||||
end
|
end
|
||||||
|
|
||||||
def fails_with? cc
|
def fails_with? cc
|
||||||
|
|||||||
@ -425,7 +425,7 @@ end
|
|||||||
class Formula
|
class Formula
|
||||||
def keg_only_text
|
def keg_only_text
|
||||||
# Add indent into reason so undent won't truncate the beginnings of lines
|
# Add indent into reason so undent won't truncate the beginnings of lines
|
||||||
reason = self.keg_only?.to_s.gsub(/[\n]/, "\n ")
|
reason = self.keg_only_reason.to_s.gsub(/[\n]/, "\n ")
|
||||||
return <<-EOS.undent
|
return <<-EOS.undent
|
||||||
This formula is keg-only, so it was not symlinked into #{HOMEBREW_PREFIX}.
|
This formula is keg-only, so it was not symlinked into #{HOMEBREW_PREFIX}.
|
||||||
|
|
||||||
|
|||||||
@ -136,19 +136,32 @@ class KegOnlyReason
|
|||||||
def initialize reason, explanation=nil
|
def initialize reason, explanation=nil
|
||||||
@reason = reason
|
@reason = reason
|
||||||
@explanation = explanation
|
@explanation = explanation
|
||||||
|
@valid = case @reason
|
||||||
|
when :when_xquartz_installed then MacOS::XQuartz.installed?
|
||||||
|
else true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid?
|
||||||
|
@valid
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
if @reason == :provided_by_osx
|
case @reason
|
||||||
<<-EOS.strip
|
when :provided_by_osx then <<-EOS.undent
|
||||||
Mac OS X already provides this program and installing another version in
|
Mac OS X already provides this software and installing another version in
|
||||||
parallel can cause all kinds of trouble.
|
parallel can cause all kinds of trouble.
|
||||||
|
|
||||||
|
#{@explanation}
|
||||||
|
EOS
|
||||||
|
when :when_xquartz_installed then <<-EOS.undent
|
||||||
|
XQuartz provides this software.
|
||||||
|
|
||||||
#{@explanation}
|
#{@explanation}
|
||||||
EOS
|
EOS
|
||||||
else
|
else
|
||||||
@reason.strip
|
@reason
|
||||||
end
|
end.strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user