Module: Homebrew::MissingFormula Private
- Extended by:
- T::Sig
- Defined in:
- Library/Homebrew/missing_formula.rb,
Library/Homebrew/extend/os/mac/missing_formula.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Helper module for checking if there is a reason a formula is missing.
Class Method Summary collapse
- .cask_reason(name, silent: false, show_info: false) ⇒ Object private
- .deleted_reason(name, silent: false) ⇒ Object private
- .disallowed_reason(name) ⇒ Object private
- .generic_disallowed_reason ⇒ Object private
- .reason(name, silent: false, show_info: false) ⇒ Object private
- .suggest_command(name, command) ⇒ Object private
- .tap_migration_reason(name) ⇒ Object private
Class Method Details
.cask_reason(name, silent: false, show_info: false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
180 |
# File 'Library/Homebrew/missing_formula.rb', line 180 def cask_reason(name, silent: false, show_info: false); end |
.deleted_reason(name, silent: false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'Library/Homebrew/missing_formula.rb', line 130 def deleted_reason(name, silent: false) path = Formulary.path name return if File.exist? path tap = Tap.from_path(path) return if tap.nil? || !File.exist?(tap.path) relative_path = path.relative_path_from tap.path tap.path.cd do unless silent ohai "Searching for a previously deleted formula (in the last month)..." if (tap.path/".git/shallow").exist? opoo <<~EOS #{tap} is shallow clone. To get complete history run: git -C "$(brew --repo #{tap})" fetch --unshallow EOS end end log_command = "git log --since='1 month ago' --diff-filter=D " \ "--name-only --max-count=1 " \ "--format=%H\\\\n%h\\\\n%B -- #{relative_path}" hash, short_hash, *, relative_path = Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) if hash.blank? || short_hash.blank? || relative_path.blank? ofail "No previously deleted formula found." unless silent return end = .reject(&:empty?).join("\n ") .sub!(/ \(#(\d+)\)$/, " (#{tap.issues_url}/\\1)") .gsub!(/(Closes|Fixes) #(\d+)/, "\\1 #{tap.issues_url}/\\2") <<~EOS #{name} was deleted from #{tap.name} in commit #{short_hash}: #{} To show the formula before removal run: git -C "$(brew --repo #{tap})" show #{short_hash}^:#{relative_path} If you still use this formula consider creating your own tap: #{Formatter.url("https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap")} EOS end end |
.disallowed_reason(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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 46 47 48 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 |
# File 'Library/Homebrew/missing_formula.rb', line 17 def disallowed_reason(name) case name.downcase when "gem", /^rubygems?$/ then <<~EOS macOS provides gem as part of Ruby. To install a newer version: brew install ruby EOS when "pip" then <<~EOS pip is part of the python formula: brew install python EOS when "pil" then <<~EOS Instead of PIL, consider pillow: pip2 install pillow EOS when "macruby" then <<~EOS MacRuby has been discontinued. Consider RubyMotion: brew cask install rubymotion EOS when /(lib)?lzma/ then <<~EOS lzma is now part of the xz formula: brew install xz EOS when "sshpass" then <<~EOS We won't add sshpass because it makes it too easy for novice SSH users to ruin SSH's security. EOS when "gsutil" then <<~EOS gsutil is available through pip: pip2 install gsutil EOS when "gfortran" then <<~EOS GNU Fortran is part of the GCC formula: brew install gcc EOS when "play" then <<~EOS Play 2.3 replaces the play command with activator: brew install typesafe-activator You can read more about this change at: #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")} #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")} EOS when "haskell-platform" then <<~EOS The components of the Haskell Platform are available separately. Glasgow Haskell Compiler: brew install ghc Cabal build system: brew install cabal-install Haskell Stack tool: brew install haskell-stack EOS when "mysqldump-secure" then <<~EOS The creator of mysqldump-secure tried to game our popularity metrics. EOS when "ngrok" then <<~EOS Upstream sunsetted 1.x in March 2016 and 2.x is not open-source. If you wish to use the 2.x release you can install with Homebrew Cask: brew cask install ngrok EOS when "cargo" then <<~EOS cargo is part of the rust formula: brew install rust EOS when "cargo-completion" then <<~EOS cargo-completion is part of the rust formula: brew install rust EOS when "uconv" then <<~EOS uconv is part of the icu4c formula: brew install icu4c EOS end end |
.generic_disallowed_reason ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'Library/Homebrew/missing_formula.rb', line 94 def disallowed_reason(name) case name.downcase when "gem", /^rubygems?$/ then <<~EOS macOS provides gem as part of Ruby. To install a newer version: brew install ruby EOS when "pip" then <<~EOS pip is part of the python formula: brew install python EOS when "pil" then <<~EOS Instead of PIL, consider pillow: pip2 install pillow EOS when "macruby" then <<~EOS MacRuby has been discontinued. Consider RubyMotion: brew cask install rubymotion EOS when /(lib)?lzma/ then <<~EOS lzma is now part of the xz formula: brew install xz EOS when "sshpass" then <<~EOS We won't add sshpass because it makes it too easy for novice SSH users to ruin SSH's security. EOS when "gsutil" then <<~EOS gsutil is available through pip: pip2 install gsutil EOS when "gfortran" then <<~EOS GNU Fortran is part of the GCC formula: brew install gcc EOS when "play" then <<~EOS Play 2.3 replaces the play command with activator: brew install typesafe-activator You can read more about this change at: #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")} #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")} EOS when "haskell-platform" then <<~EOS The components of the Haskell Platform are available separately. Glasgow Haskell Compiler: brew install ghc Cabal build system: brew install cabal-install Haskell Stack tool: brew install haskell-stack EOS when "mysqldump-secure" then <<~EOS The creator of mysqldump-secure tried to game our popularity metrics. EOS when "ngrok" then <<~EOS Upstream sunsetted 1.x in March 2016 and 2.x is not open-source. If you wish to use the 2.x release you can install with Homebrew Cask: brew cask install ngrok EOS when "cargo" then <<~EOS cargo is part of the rust formula: brew install rust EOS when "cargo-completion" then <<~EOS cargo-completion is part of the rust formula: brew install rust EOS when "uconv" then <<~EOS uconv is part of the icu4c formula: brew install icu4c EOS end end |
.reason(name, silent: false, show_info: false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 |
# File 'Library/Homebrew/missing_formula.rb', line 12 def reason(name, silent: false, show_info: false) cask_reason(name, silent: silent, show_info: show_info) || disallowed_reason(name) || tap_migration_reason(name) || deleted_reason(name, silent: silent) end |
.suggest_command(name, command) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
182 |
# File 'Library/Homebrew/missing_formula.rb', line 182 def suggest_command(name, command); end |
.tap_migration_reason(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'Library/Homebrew/missing_formula.rb', line 96 def tap_migration_reason(name) = nil Tap.each do |old_tap| new_tap = old_tap.tap_migrations[name] next unless new_tap new_tap_user, new_tap_repo, new_tap_new_name = new_tap.split("/") new_tap_name = "#{new_tap_user}/#{new_tap_repo}" = <<~EOS It was migrated from #{old_tap} to #{new_tap}. EOS break if new_tap_name == CoreTap.instance.name install_cmd = if new_tap_name.start_with?("homebrew/cask") "cask install" else "install" end new_tap_new_name ||= name += <<~EOS You can access it again by running: brew tap #{new_tap_name} And then you can install it by running: brew #{install_cmd} #{new_tap_new_name} EOS break end end |