mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
brew.sh: auto-update 3rd-party taps more often.
When doing an `install`, `outdated` or `upgrade` and referring to a formula or cask in a specific tap: you probably want to get the latest version of that formula/cask more often than the default 1 or 24 hours. Let's check for arguments for these commands that look appropriate and auto-update every 5 minutes in that case.
This commit is contained in:
parent
c076a46c19
commit
ef49b5a537
@ -278,9 +278,30 @@ auto-update() {
|
|||||||
then
|
then
|
||||||
export HOMEBREW_AUTO_UPDATING="1"
|
export HOMEBREW_AUTO_UPDATING="1"
|
||||||
|
|
||||||
|
# Look for commands that may be referring to a formula/cask in a specific
|
||||||
|
# 3rd-party tap so they can be auto-updated more often (as they do not get
|
||||||
|
# their data from the API).
|
||||||
|
AUTO_UPDATE_TAP_COMMANDS=(
|
||||||
|
install
|
||||||
|
outdated
|
||||||
|
upgrade
|
||||||
|
)
|
||||||
|
if check-array-membership "${HOMEBREW_COMMAND}" "${AUTO_UPDATE_TAP_COMMANDS[@]}"
|
||||||
|
then
|
||||||
|
for arg in "$@"
|
||||||
|
do
|
||||||
|
if [[ "${arg}" == */*/* ]] && [[ "${arg}" != Homebrew/* ]] && [[ "${arg}" != homebrew/* ]]
|
||||||
|
then
|
||||||
|
|
||||||
|
HOMEBREW_AUTO_UPDATE_TAP="1"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]]
|
if [[ -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]]
|
||||||
then
|
then
|
||||||
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API}" ]]
|
if [[ -n "${HOMEBREW_NO_INSTALL_FROM_API}" || -n "${HOMEBREW_AUTO_UPDATE_TAP}" ]]
|
||||||
then
|
then
|
||||||
# 5 minutes
|
# 5 minutes
|
||||||
HOMEBREW_AUTO_UPDATE_SECS="300"
|
HOMEBREW_AUTO_UPDATE_SECS="300"
|
||||||
@ -326,6 +347,7 @@ auto-update() {
|
|||||||
brew update --auto-update
|
brew update --auto-update
|
||||||
|
|
||||||
unset HOMEBREW_AUTO_UPDATING
|
unset HOMEBREW_AUTO_UPDATING
|
||||||
|
unset HOMEBREW_AUTO_UPDATE_TAP
|
||||||
|
|
||||||
# Restore user path as it'll be refiltered by HOMEBREW_BREW_FILE (bin/brew)
|
# Restore user path as it'll be refiltered by HOMEBREW_BREW_FILE (bin/brew)
|
||||||
export PATH=${HOMEBREW_PATH}
|
export PATH=${HOMEBREW_PATH}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user