diff options
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/vendor-install.sh | 31 | ||||
| -rw-r--r-- | completions/bash/brew | 64 | ||||
| -rw-r--r-- | completions/zsh/_brew | 4 | ||||
| -rw-r--r-- | completions/zsh/_brew_cask | 8 |
5 files changed, 100 insertions, 17 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index d7bcf1537..5aef2c420 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -12,6 +12,7 @@ module Hbc def run ohai "Homebrew-Cask Version", Hbc.full_version ohai "macOS", MacOS.full_version + ohai "SIP", self.class.check_sip ohai "Java", SystemConfig.describe_java ohai "Homebrew-Cask Install Location", self.class.render_install_location ohai "Homebrew-Cask Staging Location", self.class.render_staging_location(Hbc.caskroom) @@ -37,6 +38,15 @@ module Hbc (self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var)) end + def self.check_sip + csrutil = "/usr/bin/csrutil" + return "N/A" unless File.executable?(csrutil) + Open3.capture2(csrutil, "status")[0] + .gsub("This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.", "") + .gsub("System Integrity Protection status: ", "") + .delete("\t\.").capitalize.strip + end + def self.locale_variables ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort end diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index bf6fe0c59..3b91dae5c 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -8,26 +8,26 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh" VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor" -# Built from https://github.com/Homebrew/homebrew-portable. +# Built from https://github.com/Homebrew/homebrew-portable-ruby. if [[ -n "$HOMEBREW_MACOS" ]] then if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]] then - ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz" + ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz" ruby_SHA="34ce9e4c9c1be28db564d744165aa29291426f8a3d2ef806ba4f0b9175aedb2b" - else - ruby_URL="" - ruby_SHA="" fi elif [[ -n "$HOMEBREW_LINUX" ]] then case "$HOMEBREW_PROCESSOR" in armv7l) - ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" + ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" ruby_SHA="d26affe6f6ac299557a9044b311b4066b554874fc828ebc323d2705d3f4a8249" ;; x86_64) - ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" + ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" + ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1" ;; esac @@ -90,7 +90,20 @@ fetch() { if [[ ! -f "$temporary_path" ]] then - odie "Download failed: $VENDOR_URL" + [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL2" >&2 + "$HOMEBREW_CURL" "${curl_args[@]}" "$VENDOR_URL2" -o "$temporary_path" + fi + + if [[ ! -f "$temporary_path" ]] + then + odie <<EOS +Failed to download $VENDOR_URL and $VENDOR_URL2! + +Do not file an issue on GitHub about this: you will need to figure out for +yourself what issue with your internet connection restricts your access to +both Bintray (used for Homebrew bottles/binary packages) and GitHub +(used for Homebrew updates). +EOS fi trap '' SIGINT @@ -211,8 +224,10 @@ homebrew-vendor-install() { [[ -n "$HOMEBREW_DEBUG" ]] && set -x url_var="${VENDOR_NAME}_URL" + url2_var="${VENDOR_NAME}_URL2" sha_var="${VENDOR_NAME}_SHA" VENDOR_URL="${!url_var}" + VENDOR_URL2="${!url2_var}" VENDOR_SHA="${!sha_var}" if [[ -z "$VENDOR_URL" || -z "$VENDOR_SHA" ]] diff --git a/completions/bash/brew b/completions/bash/brew index 521aea68d..f885b808d 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -638,17 +638,53 @@ _brew_cask_fetch () __brew_cask_complete_formulae } +_brew_cask_install () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local prv=$(__brew_caskcomp_prev) + case "$cur" in + -*) + __brew_caskcomp "--force --skip-cask-deps --require-sha --language" + return + ;; + esac + __brew_cask_complete_formulae +} + _brew_cask_list () { local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + -*) + __brew_caskcomp "-1 --versions" + return + ;; + esac + __brew_cask_complete_installed +} + +_brew_cask_outdated () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in -*) - __brew_caskcomp "-1 -l --versions" + __brew_caskcomp "--greedy --verbose --quiet" return ;; esac + __brew_cask_complete_installed +} +_brew_cask_style () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + -*) + __brew_caskcomp "--fix" + return + ;; + esac __brew_cask_complete_installed } @@ -664,6 +700,18 @@ _brew_cask_uninstall () __brew_cask_complete_installed } +_brew_cask_upgrade () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + -*) + __brew_caskcomp "--force --greedy" + return + ;; + esac + __brew_cask_complete_installed +} + _brew_cask () { local i=1 cmd @@ -689,24 +737,30 @@ _brew_cask () done if [[ $i -eq $COMP_CWORD ]]; then - __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls remove rm search uninstall zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --binarydir --debug" + __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls outdated reinstall remove rm search style uninstall upgrade zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --debug --version" return fi # subcommands have their own completion functions case "$cmd" in + --version) __brewcomp_null ;; audit) __brew_cask_complete_formulae ;; cat) __brew_cask_complete_formulae ;; cleanup) _brew_cask_cleanup ;; - doctor) ;; + create) ;; + doctor) __brewcomp_null ;; edit) __brew_cask_complete_formulae ;; fetch) _brew_cask_fetch ;; home) __brew_cask_complete_formulae ;; info|abv) __brew_cask_complete_formulae ;; - install|instal) __brew_cask_complete_formulae ;; + install|instal) _brew_cask_install ;; list|ls) _brew_cask_list ;; - search) ;; + outdated) _brew_cask_outdated ;; + reinstall) __brew_cask_complete_installed ;; + search) __brewcomp_null ;; + style) _brew_cask_style ;; uninstall|remove|rm) _brew_cask_uninstall ;; + upgrade) _brew_cask_upgrade ;; zap) __brew_cask_complete_caskroom ;; *) ;; esac diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 22792860d..e4f874bfb 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -711,7 +711,7 @@ _brew_uninstall() { # brew unlink [--dry-run] formula: _brew_unlink() { _arguments \ - '(--dry-run =n)'{--dry-run,=n}'[don''t unlink or delete any files]' \ + '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ ':formula:__brew_installed_formulae' } @@ -719,7 +719,7 @@ _brew_unlink() { _brew_unlinkapps() { _arguments \ '(--local)--local[remove symlinks from ~/Applications instead of the system directory]' \ - '(--dry-run =n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ + '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ ':formula:__brew_installed_formulae' } diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask index ff277ea60..d702ea093 100644 --- a/completions/zsh/_brew_cask +++ b/completions/zsh/_brew_cask @@ -12,17 +12,21 @@ zstyle -T ':completion:*:*:*:brew-cask:*' tag-order && \ zstyle ':completion:*:*:*:brew-cask:*' tag-order 'commands' +__brew_cask() { + [ -d "$(brew --repo caskroom/cask)" ] && brew cask $@ +} + __brew_all_casks() { local -a list local expl - list=( $(brew cask search) ) + list=( $(__brew_cask search) ) _wanted list expl 'all casks' compadd -a list } __brew_installed_casks() { local -a list local expl - list=( $(brew cask list|sed 's/(!)//') ) + list=( $(__brew_cask list|sed 's/(!)//') ) _wanted list expl 'installed casks' compadd -a list } |
