diff options
| -rw-r--r-- | Library/Homebrew/cmd/upgrade.rb | 13 | ||||
| -rw-r--r-- | Library/Homebrew/dev-cmd/audit.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 4 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | completions/bash/brew | 174 | ||||
| -rw-r--r-- | docs/Python-for-Formula-Authors.md | 6 |
6 files changed, 199 insertions, 14 deletions
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index cf0bb2759..1c9c89d76 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -89,10 +89,15 @@ module Homebrew formulae_to_install.each do |f| Migrator.migrate_if_needed(f) - upgrade_formula(f) - next unless ARGV.include?("--cleanup") - next unless f.installed? - Homebrew::Cleanup.cleanup_formula f + begin + upgrade_formula(f) + next unless ARGV.include?("--cleanup") + next unless f.installed? + Homebrew::Cleanup.cleanup_formula f + rescue UnsatisfiedRequirements => e + Homebrew.failed = true + onoe "#{f}: #{e}" + end end end diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 16eb03dbc..9d0ed3c59 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -304,7 +304,7 @@ class FormulaAuditor def audit_formula_name return unless @strict # skip for non-official taps - return if formula.tap.nil? || !formula.tap.official? + return unless formula.tap&.official? name = formula.name @@ -718,7 +718,13 @@ class FormulaAuditor return unless @strict - problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/ + if formula.tap&.official? && line.include?("env :std") + problem "`env :std` in official tap formulae is deprecated" + end + + if line.include?("env :userpaths") + problem "`env :userpaths` in formulae is deprecated" + end if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/ bad_system = Regexp.last_match(1) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 6c414b941..feb518057 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -1005,11 +1005,11 @@ class MercurialDownloadStrategy < VCSDownloadStrategy end def source_modified_time - Time.parse Utils.popen_read("hg", "tip", "--template", "{date|isodate}", "-R", cached_location.to_s) + Time.parse Utils.popen_read(hgpath, "tip", "--template", "{date|isodate}", "-R", cached_location.to_s) end def last_commit - Utils.popen_read("hg", "parent", "--template", "{node|short}", "-R", cached_location.to_s) + Utils.popen_read(hgpath, "parent", "--template", "{node|short}", "-R", cached_location.to_s) end private @@ -5,7 +5,7 @@ Features, usage and installation instructions are [summarised on the homepage](h ## What Packages Are Available? 1. Type `brew search` for a list. -2. Or visit [braumeister.org](http://braumeister.org) to browse packages online. +2. Or visit [formulae.brew.sh](http://formulae.brew.sh) to browse packages online. 3. Or use `brew search --desc <keyword>` to browse packages from the command line. ## More Documentation @@ -93,10 +93,10 @@ Our bottles (binary packages) are hosted by [Bintray](https://bintray.com/homebr [](https://www.netlify.com) -Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com) +Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com). [](https://agilebits.com) -Homebrew is a member of the [Software Freedom Conservancy](https://sfconservancy.org) +Homebrew is a member of the [Software Freedom Conservancy](https://sfconservancy.org). [](https://sfconservancy.org) diff --git a/completions/bash/brew b/completions/bash/brew index 60c272f73..3bde8f926 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -1,5 +1,10 @@ # Bash completion script for brew(1) +# Indicates there are no completions +__brewcomp_null() { + COMPREPLY="" +} + __brewcomp_words_include() { local i=1 while [[ "$i" -lt "$COMP_CWORD" ]] @@ -399,6 +404,7 @@ _brew_search() { return ;; esac + __brewcomp_null } _brew_style() { @@ -539,6 +545,173 @@ _brew_uses() { __brew_complete_formulae } +__brew_caskcomp_words_include () +{ + local i=1 + while [[ $i -lt $COMP_CWORD ]]; do + if [[ "${COMP_WORDS[i]}" = "$1" ]]; then + return 0 + fi + i=$((++i)) + done + return 1 +} + +# Find the previous non-switch word +__brew_caskcomp_prev () +{ + local idx=$((COMP_CWORD - 1)) + local prv="${COMP_WORDS[idx]}" + while [[ $prv == -* ]]; do + idx=$((--idx)) + prv="${COMP_WORDS[idx]}" + done + echo "$prv" +} + +__brew_caskcomp () +{ + # break $1 on space, tab, and newline characters, + # and turn it into a newline separated list of words + local list s sep=$'\n' IFS=$' '$'\t'$'\n' + local cur="${COMP_WORDS[COMP_CWORD]}" + + for s in $1; do + __brew_caskcomp_words_include "$s" && continue + list="$list$s$sep" + done + + IFS=$sep + COMPREPLY=($(compgen -W "$list" -- "$cur")) +} + +# Don't use __brew_caskcomp() in any of the __brew_cask_complete_foo functions, as +# it is too slow and is not worth it just for duplicate elimination. +__brew_cask_complete_formulae () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local lib=$(brew --repository)/Library + local taps=${lib}/Taps + local casks=${lib}/Taps/caskroom/homebrew-cask/Casks + local ff=$(\ls ${casks} 2>/dev/null | sed 's/\.rb//g') + + COMPREPLY=($(compgen -W "$ff" -- "$cur")) +} + +__brew_cask_complete_installed () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local inst=$(brew cask list -1) + COMPREPLY=($(compgen -W "$inst" -- "$cur")) +} + +__brew_cask_complete_caskroom () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local caskroom_dir=/opt/homebrew-cask/Caskroom/ + local files=$(\ls ${caskroom_dir} 2>/dev/null) + COMPREPLY=($(compgen -W "$files" -- "$cur")) +} + +_brew_cask_cleanup () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + -*) + __brew_caskcomp "--force" + return + ;; + esac + __brew_cask_complete_installed +} + +_brew_cask_fetch () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + local prv=$(__brew_caskcomp_prev) + case "$cur" in + -*) + __brew_caskcomp "--force" + return + ;; + esac + __brew_cask_complete_formulae +} + +_brew_cask_list () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + + case "$cur" in + -*) + __brew_caskcomp "-1 -l --versions" + return + ;; + esac + + __brew_cask_complete_installed +} + +_brew_cask_uninstall () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + -*) + __brew_caskcomp "--force" + return + ;; + esac + __brew_cask_complete_installed +} + +_brew_cask () +{ + local i=1 cmd + + # find the subcommand + while [[ $i -lt $COMP_CWORD ]]; do + local s="${COMP_WORDS[i]}" + case "$s" in + --*) + cmd="$s" + break + ;; + -*) + ;; + cask) + ;; + *) + cmd="$s" + break + ;; + esac + i=$((++i)) + 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" + return + fi + + # subcommands have their own completion functions + case "$cmd" in + audit) __brew_cask_complete_formulae ;; + cat) __brew_cask_complete_formulae ;; + cleanup) _brew_cask_cleanup ;; + doctor) ;; + 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 ;; + list|ls) _brew_cask_list ;; + search) ;; + uninstall|remove|rm) _brew_cask_uninstall ;; + zap) __brew_cask_complete_caskroom ;; + *) ;; + esac +} + _brew() { local i=1 cmd @@ -578,6 +751,7 @@ _brew() { analytics) _brew_analytics ;; audit) __brew_complete_formulae ;; bottle) _brew_bottle ;; + cask) _brew_cask ;; cat) __brew_complete_formulae ;; cleanup) _brew_cleanup ;; create) _brew_create ;; diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 13b96e563..723601afe 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -51,7 +51,7 @@ poet some_package deactivate ``` -Homebrew provides helper methods for instantiating and populating virtualenvs. You can use them by putting `include Language::Python::Virtualenv` on the `Formula` class definition, above `def install`. +Homebrew provides helper methods for instantiating and populating virtualenvs. You can use them by putting `include Language::Python::Virtualenv` at the top of the `Formula` class definition. For most applications, all you will need to write is: @@ -85,6 +85,8 @@ Installing a formula with dependencies will look like this: ```ruby class Foo < Formula + include Language::Python::Virtualenv + url "..." resource "six" do @@ -97,8 +99,6 @@ class Foo < Formula sha256 "09bfcd8f3c239c75e77b3ff05d782ab2c1aed0892f250ce2adf948d4308fe9dc" end - include Language::Python::Virtualenv - def install virtualenv_install_with_resources end |
