diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/system_command.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/caveats.rb | 6 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 31 | ||||
| -rw-r--r-- | Library/Homebrew/formula_support.rb | 16 |
4 files changed, 45 insertions, 20 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index f1ec34025..c14079bc8 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -92,25 +92,17 @@ module Hbc def each_line_from(sources) loop do - selected_sources = IO.select(sources, [], [], 10) - - break if selected_sources.nil? - - readable_sources = selected_sources[0].delete_if(&:eof?) - - readable_sources.each do |source| + readable_sources = IO.select(sources)[0] + readable_sources.delete_if(&:eof?).first(1).each do |source| type = (source == sources[0] ? :stdout : :stderr) - begin yield(type, source.readline_nonblock || "") rescue IO::WaitReadable, EOFError next end end - break if readable_sources.empty? end - sources.each(&:close_read) end diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index b7c0a60c9..2032e9ff1 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -44,8 +44,10 @@ class Caveats 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}\n" + s = <<-EOS.undent + This formula is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}, + because #{f.keg_only_reason}. + EOS if f.bin.directory? || f.sbin.directory? s << "\nIf you need to have this software first in your PATH run:\n" if f.bin.directory? diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 782405207..be53e1d6f 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -489,6 +489,37 @@ class FormulaAuditor EOS end + def audit_keg_only_style + return unless @strict + return unless formula.keg_only? + + whitelist = %w[ + Apple + macOS + OS + Homebrew + Xcode + GPG + GNOME + BSD + ].freeze + + reason = formula.keg_only_reason.to_s + # Formulae names can legitimately be uppercase/lowercase/both. + name = Regexp.new(formula.name, Regexp::IGNORECASE) + reason.sub!(name, "") + first_word = reason.split[0] + + if reason =~ /^[A-Z]/ && !reason.start_with?(*whitelist) + problem <<-EOS.undent + '#{first_word}' from the keg_only reason should be '#{first_word.downcase}'. + EOS + end + + return unless reason.end_with?(".") + problem "keg_only reason should not end with a period." + end + def audit_options formula.options.each do |o| if o.name == "32-bit" diff --git a/Library/Homebrew/formula_support.rb b/Library/Homebrew/formula_support.rb index b8476f5cc..4d963a55e 100644 --- a/Library/Homebrew/formula_support.rb +++ b/Library/Homebrew/formula_support.rb @@ -32,30 +32,30 @@ class KegOnlyReason return @explanation unless @explanation.empty? case @reason when :versioned_formula then <<-EOS.undent - This is an alternate version of another formula. + this is an alternate version of another formula EOS when :provided_by_macos, :provided_by_osx then <<-EOS.undent macOS already provides this software and installing another version in - parallel can cause all kinds of trouble. + parallel can cause all kinds of trouble EOS when :shadowed_by_macos, :shadowed_by_osx then <<-EOS.undent macOS provides similar software and installing this software in - parallel can cause all kinds of trouble. + parallel can cause all kinds of trouble EOS when :provided_pre_mountain_lion then <<-EOS.undent - macOS already provides this software in versions before Mountain Lion. + macOS already provides this software in versions before Mountain Lion EOS when :provided_pre_mavericks then <<-EOS.undent - macOS already provides this software in versions before Mavericks. + macOS already provides this software in versions before Mavericks EOS when :provided_pre_el_capitan then <<-EOS.undent - macOS already provides this software in versions before El Capitan. + macOS already provides this software in versions before El Capitan EOS when :provided_until_xcode43 then <<-EOS.undent - Xcode provides this software prior to version 4.3. + Xcode provides this software prior to version 4.3 EOS when :provided_until_xcode5 then <<-EOS.undent - Xcode provides this software prior to version 5. + Xcode provides this software prior to version 5 EOS else @reason |
