Skip to content

Commit

Permalink
Add HOMEBREW_UPGRADE_GREEDY="auto-updates" and "latest"
Browse files Browse the repository at this point in the history
  • Loading branch information
jck112 committed Feb 24, 2024
1 parent d0a3f09 commit 821fe73
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Library/Homebrew/cask/upgrade.rb
Expand Up @@ -40,7 +40,13 @@ def self.upgrade_casks(

quarantine = true if quarantine.nil?

greedy = true if Homebrew::EnvConfig.upgrade_greedy?
if Homebrew::EnvConfig.upgrade_greedy
case Homebrew::EnvConfig.upgrade_greedy
when "auto-updates" then greedy_auto_updates = true
when "latest" then greedy_latest = true
else greedy = true
end
end

outdated_casks = if casks.empty?
Caskroom.casks(config: Config.from_args(args)).select do |cask|
Expand Down
5 changes: 3 additions & 2 deletions Library/Homebrew/env_config.rb
Expand Up @@ -341,8 +341,9 @@ module EnvConfig
boolean: true,
},
HOMEBREW_UPGRADE_GREEDY: {
description: "If set, pass `--greedy` to all cask upgrade commands.",
boolean: true,
description: "When set to \"auto-updates\", \"latest\", or any other value (e.g. \"1\"), pass " \
"`--greedy-auto-updates`, `--greedy-latest`, or `--greedy` respectively to all cask " \
"upgrade commands.",
},
HOMEBREW_SIMULATE_MACOS_ON_LINUX: {
description: "If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful " \
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/env_config.rbi
Expand Up @@ -232,8 +232,8 @@ module Homebrew::EnvConfig
sig { returns(T::Boolean) }
def self.update_to_tag?; end

sig { returns(T::Boolean) }
def self.upgrade_greedy?; end
sig { returns(T.nilable(String)) }
def self.upgrade_greedy; end

sig { returns(T::Boolean) }
def self.verbose?; end
Expand Down
2 changes: 1 addition & 1 deletion docs/Manpage.md
Expand Up @@ -2357,7 +2357,7 @@ command execution e.g. `$(cat file)`.
<br>If set, use Pry for the `brew irb` command.

- `HOMEBREW_UPGRADE_GREEDY`
<br>If set, pass `--greedy` to all cask upgrade commands.
<br>When set to "auto-updates", "latest", or any other value (e.g. "1"), pass `--greedy-auto-updates`, `--greedy-latest`, or `--greedy` respectively to all cask upgrade commands.

- `HOMEBREW_SIMULATE_MACOS_ON_LINUX`
<br>If set, running Homebrew on Linux will simulate certain macOS code paths. This is useful when auditing macOS formulae while on Linux.
Expand Down
2 changes: 1 addition & 1 deletion manpages/brew.1
Expand Up @@ -3464,7 +3464,7 @@ If set, use Pry for the \fBbrew irb\fR command\.
\fBHOMEBREW_UPGRADE_GREEDY\fR
.
.br
If set, pass \fB\-\-greedy\fR to all cask upgrade commands\.
When set to "auto\-updates", "latest", or any other value (e\.g\. "1"), pass \fB\-\-greedy\-auto\-updates\fR, \fB\-\-greedy\-latest\fR, or \fB\-\-greedy\fR respectively to all cask upgrade commands\.
.
.TP
\fBHOMEBREW_SIMULATE_MACOS_ON_LINUX\fR
Expand Down

0 comments on commit 821fe73

Please sign in to comment.