mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
Add quiet mode for automatic updates
This commit is contained in:
@@ -39,6 +39,8 @@ class ReporterHub
|
||||
|
||||
sig { params(auto_update: T::Boolean).void }
|
||||
def dump(auto_update: false)
|
||||
return if auto_update && Homebrew::EnvConfig.auto_update_quiet?
|
||||
|
||||
unless Homebrew::EnvConfig.no_update_report_new?
|
||||
dump_new_formula_report
|
||||
dump_new_cask_report
|
||||
|
||||
@@ -96,6 +96,11 @@ module Homebrew
|
||||
replacement: "the default behaviour",
|
||||
odeprecated: true,
|
||||
},
|
||||
HOMEBREW_AUTO_UPDATE_QUIET: {
|
||||
description: "If set, the auto-update run before commands like `brew install`, `brew upgrade` or " \
|
||||
"`brew tap` will not show information about new, outdated or deleted formulae and casks.",
|
||||
boolean: true,
|
||||
},
|
||||
HOMEBREW_AUTO_UPDATE_SECS: {
|
||||
description: "Run `brew update` once every `$HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, " \
|
||||
"e.g. `brew install`, `brew upgrade` or `brew tap`. Alternatively, " \
|
||||
|
||||
@@ -31,6 +31,9 @@ module Homebrew::EnvConfig
|
||||
sig { returns(T::Boolean) }
|
||||
def ask?; end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def auto_update_quiet?; end
|
||||
|
||||
sig { returns(String) }
|
||||
def auto_update_secs; end
|
||||
|
||||
|
||||
@@ -638,6 +638,22 @@ RSpec.describe Homebrew::Cmd::UpdateReport do
|
||||
EOS
|
||||
end
|
||||
|
||||
it "does not dump update details when HOMEBREW_AUTO_UPDATE_QUIET is set during auto-update" do
|
||||
ENV["HOMEBREW_AUTO_UPDATE_QUIET"] = "1"
|
||||
allow(hub).to receive(:select_formula_or_cask).with(:A).and_return(["foo"])
|
||||
allow(hub).to receive(:installed?).and_return(false)
|
||||
|
||||
expect { hub.dump(auto_update: true) }.not_to output.to_stdout
|
||||
end
|
||||
|
||||
it "dumps update details when HOMEBREW_AUTO_UPDATE_QUIET is set during an explicit update" do
|
||||
ENV["HOMEBREW_AUTO_UPDATE_QUIET"] = "1"
|
||||
allow(hub).to receive(:select_formula_or_cask).with(:A).and_return(["foo"])
|
||||
allow(hub).to receive_messages(installed?: false, description: nil)
|
||||
|
||||
expect { hub.dump }.to output("==> New Formulae\nfoo\n").to_stdout
|
||||
end
|
||||
|
||||
it "dumps deleted installed formulae and casks report" do
|
||||
allow(hub).to receive(:select_formula_or_cask).with(:D).and_return(["baz", "foo", "bar"])
|
||||
allow(hub).to receive(:installed?).with("baz").and_return(true)
|
||||
|
||||
@@ -4335,6 +4335,12 @@ command execution (e.g. `$(cat file)`).
|
||||
are both set, if the request to `$HOMEBREW_ARTIFACT_DOMAIN` fails then
|
||||
Homebrew will error rather than trying any other/default URLs.
|
||||
|
||||
`HOMEBREW_AUTO_UPDATE_QUIET`
|
||||
|
||||
: If set, the auto-update run before commands like `brew install`, `brew
|
||||
upgrade` or `brew tap` will not show information about new, outdated or
|
||||
deleted formulae and casks.
|
||||
|
||||
`HOMEBREW_AUTO_UPDATE_SECS`
|
||||
|
||||
: Run `brew update` once every `$HOMEBREW_AUTO_UPDATE_SECS` seconds before some
|
||||
|
||||
@@ -2758,6 +2758,9 @@ Prefix all download URLs, including those for bottles, with this value\. For exa
|
||||
\fBHOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK\fP
|
||||
When \fB$HOMEBREW_ARTIFACT_DOMAIN\fP and \fB$HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK\fP are both set, if the request to \fB$HOMEBREW_ARTIFACT_DOMAIN\fP fails then Homebrew will error rather than trying any other/default URLs\.
|
||||
.TP
|
||||
\fBHOMEBREW_AUTO_UPDATE_QUIET\fP
|
||||
If set, the auto\-update run before commands like \fBbrew install\fP, \fBbrew upgrade\fP or \fBbrew tap\fP will not show information about new, outdated or deleted formulae and casks\.
|
||||
.TP
|
||||
\fBHOMEBREW_AUTO_UPDATE_SECS\fP
|
||||
Run \fBbrew update\fP once every \fB$HOMEBREW_AUTO_UPDATE_SECS\fP seconds before some commands, e\.g\. \fBbrew install\fP, \fBbrew upgrade\fP or \fBbrew tap\fP\&\. Alternatively, disable auto\-update entirely with \fB$HOMEBREW_NO_AUTO_UPDATE\fP\&\.
|
||||
.RS
|
||||
|
||||
Reference in New Issue
Block a user