Class: Caveats Private
- Extended by:
- Forwardable
- Defined in:
- caveats.rb,
sorbet/rbi/parlour.rbi
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
A formula's caveats.
Instance Attribute Summary collapse
- #formula ⇒ Object readonly private
Instance Method Summary collapse
- #caveats ⇒ Object private
- #empty?(*args, **options, &block) ⇒ Boolean private
-
#initialize(formula) ⇒ Caveats
constructor
private
A new instance of Caveats.
- #keg_only_text(skip_reason: false) ⇒ Object private
Constructor Details
#initialize(formula) ⇒ Caveats
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns a new instance of Caveats.
13 14 15 |
# File 'caveats.rb', line 13 def initialize(formula) @formula = formula end |
Instance Attribute Details
#formula ⇒ Object (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
11 12 13 |
# File 'caveats.rb', line 11 def formula @formula end |
Instance Method Details
#caveats ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'caveats.rb', line 17 def caveats caveats = [] begin build = formula.build formula.build = Tab.for_formula(formula) string = formula.caveats.to_s caveats << "#{string.chomp}\n" unless string.empty? ensure formula.build = build end caveats << keg_only_text valid_shells = [:bash, :zsh, :fish].freeze current_shell = Utils::Shell.preferred || Utils::Shell.parent shells = if current_shell.present? && (shell_sym = current_shell.to_sym) && valid_shells.include?(shell_sym) [shell_sym] else valid_shells end shells.each do |shell| caveats << function_completion_caveats(shell) end caveats << service_caveats caveats << elisp_caveats caveats.compact.join("\n") end |
#empty?(*args, **options, &block) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
9 |
# File 'sorbet/rbi/parlour.rbi', line 9 def empty?(*args, **, &block); end |
#keg_only_text(skip_reason: false) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'caveats.rb', line 49 def keg_only_text(skip_reason: false) return unless formula.keg_only? s = if skip_reason "" else <<~EOS #{formula.name} is keg-only, which means it was not symlinked into #{HOMEBREW_PREFIX}, because #{formula.keg_only_reason.to_s.chomp}. EOS end.dup if formula.bin.directory? || formula.sbin.directory? s << <<~EOS If you need to have #{formula.name} first in your PATH, run: EOS s << " #{Utils::Shell.prepend_path_in_profile(formula.opt_bin.to_s)}\n" if formula.bin.directory? s << " #{Utils::Shell.prepend_path_in_profile(formula.opt_sbin.to_s)}\n" if formula.sbin.directory? end if formula.lib.directory? || formula.include.directory? s << <<~EOS For compilers to find #{formula.name} you may need to set: EOS s << " #{Utils::Shell.export_value("LDFLAGS", "-L#{formula.opt_lib}")}\n" if formula.lib.directory? s << " #{Utils::Shell.export_value("CPPFLAGS", "-I#{formula.opt_include}")}\n" if formula.include.directory? if which("pkg-config", ORIGINAL_PATHS) && ((formula.lib/"pkgconfig").directory? || (formula.share/"pkgconfig").directory?) s << <<~EOS For pkg-config to find #{formula.name} you may need to set: EOS if (formula.lib/"pkgconfig").directory? s << " #{Utils::Shell.export_value("PKG_CONFIG_PATH", "#{formula.opt_lib}/pkgconfig")}\n" end if (formula.share/"pkgconfig").directory? s << " #{Utils::Shell.export_value("PKG_CONFIG_PATH", "#{formula.opt_share}/pkgconfig")}\n" end end end s << "\n" unless s.end_with?("\n") s end |