Fixed installation info output and imports
This commit is contained in:
commit
ed80b60834
@ -414,7 +414,8 @@ update-preinstall() {
|
||||
[[ -z "$HOMEBREW_AUTO_UPDATE_CHECKED" ]] || return
|
||||
[[ -z "$HOMEBREW_UPDATE_PREINSTALL" ]] || return
|
||||
|
||||
if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" || "$HOMEBREW_COMMAND" = "tap" ||
|
||||
if [[ "$HOMEBREW_COMMAND" = "install" || "$HOMEBREW_COMMAND" = "upgrade" ||
|
||||
"$HOMEBREW_COMMAND" = "tap" && $HOMEBREW_ARG_COUNT -gt 1 ||
|
||||
"$HOMEBREW_CASK_COMMAND" = "install" || "$HOMEBREW_CASK_COMMAND" = "upgrade" ]]
|
||||
then
|
||||
export HOMEBREW_AUTO_UPDATING="1"
|
||||
|
@ -1,4 +1,5 @@
|
||||
require "json"
|
||||
require "cask/installer"
|
||||
|
||||
module Cask
|
||||
class Cmd
|
||||
@ -51,12 +52,17 @@ module Cask
|
||||
end
|
||||
|
||||
def self.installation_info(cask)
|
||||
install_info = ""
|
||||
if cask.installed?
|
||||
cask.versions.each do |version|
|
||||
versioned_staged_path = cask.caskroom_path.join(version)
|
||||
message = versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist")
|
||||
versioned_staged_path.to_s.concat(" (").concat(message).concat(")")
|
||||
install_info << versioned_staged_path.to_s
|
||||
.concat(" (")
|
||||
.concat(versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist"))
|
||||
.concat(")")
|
||||
install_info << "\n"
|
||||
end
|
||||
return install_info.strip
|
||||
else
|
||||
"Not installed"
|
||||
end
|
||||
|
@ -135,6 +135,7 @@ module Homebrew
|
||||
check_constraint_violations
|
||||
Homebrew.args[:remaining] = remaining_args
|
||||
Homebrew.args.freeze
|
||||
cmdline_args.freeze
|
||||
@parser
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,8 @@ module Homebrew
|
||||
end
|
||||
|
||||
def irb
|
||||
irb_args.parse
|
||||
# work around IRB modifying ARGV.
|
||||
irb_args.parse(ARGV.dup)
|
||||
|
||||
if args.examples?
|
||||
puts "'v8'.f # => instance of the v8 formula"
|
||||
|
@ -30,7 +30,8 @@ module HomebrewArgvExtension
|
||||
end
|
||||
|
||||
def named
|
||||
@named ||= self - options_only
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
self - options_only
|
||||
end
|
||||
|
||||
def options_only
|
||||
@ -43,7 +44,8 @@ module HomebrewArgvExtension
|
||||
|
||||
def formulae
|
||||
require "formula"
|
||||
@formulae ||= (downcased_unique_named - casks).map do |name|
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
(downcased_unique_named - casks).map do |name|
|
||||
if name.include?("/") || File.exist?(name)
|
||||
Formulary.factory(name, spec)
|
||||
else
|
||||
@ -54,19 +56,22 @@ module HomebrewArgvExtension
|
||||
|
||||
def resolved_formulae
|
||||
require "formula"
|
||||
@resolved_formulae ||= (downcased_unique_named - casks).map do |name|
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
(downcased_unique_named - casks).map do |name|
|
||||
Formulary.resolve(name, spec: spec(nil))
|
||||
end.uniq(&:name)
|
||||
end
|
||||
|
||||
def casks
|
||||
@casks ||= downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX
|
||||
end
|
||||
|
||||
def kegs
|
||||
require "keg"
|
||||
require "formula"
|
||||
@kegs ||= downcased_unique_named.map do |name|
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
downcased_unique_named.map do |name|
|
||||
raise UsageError if name.empty?
|
||||
|
||||
rack = Formulary.to_rack(name.downcase)
|
||||
@ -109,7 +114,7 @@ module HomebrewArgvExtension
|
||||
end
|
||||
|
||||
def include?(arg)
|
||||
!(@n = index(arg)).nil?
|
||||
!index(arg).nil?
|
||||
end
|
||||
|
||||
def next
|
||||
@ -281,7 +286,8 @@ module HomebrewArgvExtension
|
||||
|
||||
def downcased_unique_named
|
||||
# Only lowercase names, not paths, bottle filenames or URLs
|
||||
@downcased_unique_named ||= named.map do |arg|
|
||||
# TODO: use @instance variable to ||= cache when moving to CLI::Parser
|
||||
named.map do |arg|
|
||||
if arg.include?("/") || arg.end_with?(".tar.gz") || File.exist?(arg)
|
||||
arg
|
||||
else
|
||||
|
@ -1,8 +1,7 @@
|
||||
require "formulary"
|
||||
require "cask/cmd/abstract_command"
|
||||
require "cask/cmd"
|
||||
require "cask/cmd/info"
|
||||
require "cask/cask_loader"
|
||||
require "cask/installer"
|
||||
|
||||
module Homebrew
|
||||
module MissingFormula
|
||||
@ -15,34 +14,35 @@ module Homebrew
|
||||
def blacklisted_reason(name)
|
||||
case name.downcase
|
||||
when "gem", /^rubygems?$/ then <<~EOS
|
||||
Homebrew provides gem via: `brew install ruby`.
|
||||
macOS provides gem as part of Ruby. To install a newer version:
|
||||
brew install ruby
|
||||
EOS
|
||||
when "tex", "tex-live", "texlive", "latex" then <<~EOS
|
||||
Installing TeX from source is weird and gross, requires a lot of patches,
|
||||
and only builds 32-bit (and thus can't use Homebrew dependencies)
|
||||
There are three versions of MacTeX.
|
||||
|
||||
We recommend using a MacTeX distribution: https://www.tug.org/mactex/
|
||||
|
||||
You can install it with Homebrew Cask:
|
||||
Full installation:
|
||||
brew cask install mactex
|
||||
|
||||
Full installation without bundled applications:
|
||||
brew cask install mactex-no-gui
|
||||
|
||||
Minimal installation:
|
||||
brew cask install basictex
|
||||
EOS
|
||||
when "pip" then <<~EOS
|
||||
pip is part of the python formula, and can be installed with:
|
||||
pip is part of the python formula:
|
||||
brew install python
|
||||
However you will then have two Pythons installed on your Mac,
|
||||
so alternatively you can install pip via the instructions at:
|
||||
#{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")}
|
||||
EOS
|
||||
when "pil" then <<~EOS
|
||||
Instead of PIL, consider `pip2 install pillow`.
|
||||
Instead of PIL, consider pillow:
|
||||
pip2 install pillow
|
||||
EOS
|
||||
when "macruby" then <<~EOS
|
||||
MacRuby is not packaged and is on an indefinite development hiatus.
|
||||
You can read more about it at:
|
||||
#{Formatter.url("https://github.com/MacRuby/MacRuby")}
|
||||
MacRuby has been discontinued. Consider RubyMotion:
|
||||
brew cask install rubymotion
|
||||
EOS
|
||||
when /(lib)?lzma/ then <<~EOS
|
||||
lzma is now part of the xz formula, and can be installed with:
|
||||
lzma is now part of the xz formula:
|
||||
brew install xz
|
||||
EOS
|
||||
when "gtest", "googletest", "google-test" then <<~EOS
|
||||
@ -58,10 +58,11 @@ module Homebrew
|
||||
ruin SSH's security.
|
||||
EOS
|
||||
when "gsutil" then <<~EOS
|
||||
Install gsutil with `pip2 install gsutil`
|
||||
gsutil is available through pip:
|
||||
pip2 install gsutil
|
||||
EOS
|
||||
when "gfortran" then <<~EOS
|
||||
GNU Fortran is now part of the GCC formula, and can be installed with:
|
||||
GNU Fortran is part of the GCC formula:
|
||||
brew install gcc
|
||||
EOS
|
||||
when "play" then <<~EOS
|
||||
@ -73,9 +74,16 @@ module Homebrew
|
||||
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")}
|
||||
EOS
|
||||
when "haskell-platform" then <<~EOS
|
||||
We no longer package haskell-platform. Consider installing ghc,
|
||||
cabal-install and stack instead:
|
||||
brew install ghc cabal-install stack
|
||||
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.
|
||||
@ -87,9 +95,13 @@ module Homebrew
|
||||
brew cask install ngrok
|
||||
EOS
|
||||
when "cargo" then <<~EOS
|
||||
cargo is part of the rust formula, and can be installed with:
|
||||
cargo 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
|
||||
alias generic_blacklisted_reason blacklisted_reason
|
||||
|
Loading…
x
Reference in New Issue
Block a user