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?
|
||||
puts
|
||||
puts "This formula is keg-only."
|
||||
puts f.keg_only?
|
||||
puts f.keg_only_reason
|
||||
puts
|
||||
end
|
||||
|
||||
|
||||
@ -174,7 +174,12 @@ class Formula
|
||||
# rarely, you don't want your library symlinked into the main prefix
|
||||
# see gettext.rb for an example
|
||||
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
|
||||
|
||||
def fails_with? cc
|
||||
|
||||
@ -425,7 +425,7 @@ end
|
||||
class Formula
|
||||
def keg_only_text
|
||||
# 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
|
||||
This formula is keg-only, so it was not symlinked into #{HOMEBREW_PREFIX}.
|
||||
|
||||
|
||||
@ -136,19 +136,32 @@ class KegOnlyReason
|
||||
def initialize reason, explanation=nil
|
||||
@reason = reason
|
||||
@explanation = explanation
|
||||
@valid = case @reason
|
||||
when :when_xquartz_installed then MacOS::XQuartz.installed?
|
||||
else true
|
||||
end
|
||||
end
|
||||
|
||||
def valid?
|
||||
@valid
|
||||
end
|
||||
|
||||
def to_s
|
||||
if @reason == :provided_by_osx
|
||||
<<-EOS.strip
|
||||
Mac OS X already provides this program and installing another version in
|
||||
parallel can cause all kinds of trouble.
|
||||
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
|
||||
#{@explanation}
|
||||
EOS
|
||||
when :when_xquartz_installed then <<-EOS.undent
|
||||
XQuartz provides this software.
|
||||
|
||||
#{@explanation}
|
||||
EOS
|
||||
else
|
||||
@reason.strip
|
||||
end
|
||||
@reason
|
||||
end.strip
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user