diff options
| author | Jack Nagel | 2012-08-09 02:00:58 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-08-12 17:28:15 -0500 |
| commit | a054dc50190e9eb0a2a88699221730f0d84f31c5 (patch) | |
| tree | 560e86d4bc865c18f68d64e592b3bf464d153e8a /Library | |
| parent | f970f9ec60743f783c1b3bc4cf64e0dfa1148b53 (diff) | |
| download | brew-a054dc50190e9eb0a2a88699221730f0d84f31c5.tar.bz2 | |
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>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/info.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 7 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formula_support.rb | 31 |
4 files changed, 30 insertions, 12 deletions
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index ee5cc8e88..b9de91dbd 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 710a084c1..b61bb999a 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -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 diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index bb9b7e230..949fbdcc4 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -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}. diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index c0b920b2c..2119fbd11 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -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 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. + def valid? + @valid + end -#{@explanation} -EOS + 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 + when :when_xquartz_installed then <<-EOS.undent + XQuartz provides this software. + + #{@explanation} + EOS else - @reason.strip - end + @reason + end.strip end end |
