diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 1df2e26441..4b1c2fcdd2 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -9,7 +9,7 @@ class Caveats caveats = [] s = f.caveats.to_s caveats << s.chomp + "\n" if s.length > 0 - caveats << f.keg_only_text if f.keg_only? && f.respond_to?(:keg_only_text) + caveats << keg_only_text caveats << bash_completion_caveats caveats << zsh_completion_caveats caveats << fish_completion_caveats @@ -31,6 +31,27 @@ class Caveats end.compact.first end + def keg_only_text + return "" unless f.keg_only? + + s = "This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}." + s << "\n\n#{f.keg_only_reason.to_s}" + if f.lib.directory? or f.include.directory? + s << + <<-EOS.undent_________________________________________________________72 + + + Generally there are no consequences of this for you. If you build your + own software and it requires this formula, you'll need to add to your + build variables: + + EOS + s << " LDFLAGS: -L#{f.opt_lib}\n" if f.lib.directory? + s << " CPPFLAGS: -I#{f.opt_include}\n" if f.include.directory? + end + s << "\n" + end + def bash_completion_caveats if keg and keg.completion_installed? :bash then <<-EOS.undent Bash completion has been installed to: diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 13a0cfc2be..52bf3a0a3b 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -676,25 +676,3 @@ class FormulaInstaller end end end - - -class Formula - def keg_only_text - s = "This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}." - s << "\n\n#{keg_only_reason.to_s}" - if lib.directory? or include.directory? - s << - <<-EOS.undent_________________________________________________________72 - - - Generally there are no consequences of this for you. If you build your - own software and it requires this formula, you'll need to add to your - build variables: - - EOS - s << " LDFLAGS: -L#{opt_lib}\n" if lib.directory? - s << " CPPFLAGS: -I#{opt_include}\n" if include.directory? - end - s << "\n" - end -end