diff options
| author | Jack Nagel | 2013-01-12 13:08:29 -0600 |
|---|---|---|
| committer | Jack Nagel | 2013-01-14 14:57:42 -0600 |
| commit | 870f095c69df18d321a568b3d21cef09508ac4fd (patch) | |
| tree | b189f4249894cd34e14021807fd6150301078763 | |
| parent | 2a4a3c3a9550e2f5170d92c37d0847374e877acf (diff) | |
| download | brew-870f095c69df18d321a568b3d21cef09508ac4fd.tar.bz2 | |
Restore keg-only caveats
Fixes Homebrew/homebrew#16989.
| -rw-r--r-- | Library/Homebrew/caveats.rb | 64 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/info.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 9 |
3 files changed, 49 insertions, 27 deletions
diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 411acac84..584904791 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -1,34 +1,51 @@ class Caveats - def self.print f - s = [] + attr_reader :f - unless f.caveats.to_s.strip.empty? - s << f.caveats - end + def initialize(f) + @f = f + end + + def caveats + caveats = [] + caveats << f.caveats + caveats << f.keg_only_text rescue nil if f.keg_only? + caveats << bash_completion_caveats + caveats << zsh_completion_caveats + caveats << plist_caveats + caveats.compact.join("\n") + end + + def empty? + caveats.empty? + end - keg = Keg.new(f.prefix) rescue nil - keg ||= Keg.new(f.opt_prefix.realpath) rescue nil - keg ||= Keg.new(f.linked_keg.realpath) rescue nil + private - if keg and keg.completion_installed? :bash - s << "\n" unless s.empty? - s << <<-EOS.undent - Bash completion has been installed to: - #{HOMEBREW_PREFIX}/etc/bash_completion.d - EOS + def keg + @keg ||= [f.prefix, f.opt_prefix, f.linked_keg].map do |d| + Keg.new(d.realpath) rescue nil + end.compact.first + end + + def bash_completion_caveats + if keg and keg.completion_installed? :bash then <<-EOS.undent + Bash completion has been installed to: + #{HOMEBREW_PREFIX}/etc/bash_completion.d + EOS end + end - if keg and keg.completion_installed? :zsh - s << "\n" unless s.empty? - s << <<-EOS.undent - zsh completion has been installed to: - #{HOMEBREW_PREFIX}/share/zsh/site-functions - EOS + def zsh_completion_caveats + if keg and keg.completion_installed? :zsh then <<-EOS.undent + zsh completion has been installed to: + #{HOMEBREW_PREFIX}/share/zsh/site-functions + EOS end + end + def plist_caveats + s = [] if f.plist or (keg and keg.plist_installed?) - s << "\n" unless s.empty? - destination = f.plist_startup ? '/Library/LaunchDaemons' \ : '~/Library/LaunchAgents' @@ -79,7 +96,6 @@ class Caveats end end end - - ohai 'Caveats', s unless s.empty? + s.join("\n") unless s.empty? end end diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index ffbc93038..7c512fa23 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -120,7 +120,8 @@ module Homebrew extend self Homebrew.dump_options_for_formula f end - Caveats.print f + c = Caveats.new(f) + ohai 'Caveats', c.caveats unless c.empty? rescue FormulaUnavailableError # check for DIY installation diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 221690576..db9ade9ca 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -154,7 +154,12 @@ class FormulaInstaller check_infopages end - Caveats.print f + c = Caveats.new(f) + + unless c.empty? + @show_summary_heading = true + ohai 'Caveats', c.caveats + end end def finish @@ -175,7 +180,7 @@ class FormulaInstaller install_plist fix_install_names - ohai "Summary - #{f.name}" if ARGV.verbose? or show_summary_heading + ohai "Summary" if ARGV.verbose? or show_summary_heading print "🍺 " if MacOS.version >= :lion print "#{f.prefix}: #{f.prefix.abv}" print ", built in #{pretty_duration build_time}" if build_time |
