Skip to content

Commit

Permalink
Add HOMEBREW_FORCE_API_AUTO_UPDATE
Browse files Browse the repository at this point in the history
If set, this will update the Homebrew API formula or cask data even if
`HOMEBREW_NO_AUTO_UPDATE` is set.

This is useful in cases where you want to update the cached API data but
don't want to update Homebrew itself.
  • Loading branch information
MikeMcQuaid committed Jan 7, 2025
1 parent f514381 commit e637a1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Homebrew/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def self.fetch_json_api_file(endpoint, target: HOMEBREW_CACHE_API/endpoint,
skip_download = target.exist? &&
!target.empty? &&
(!Homebrew.auto_update_command? ||
Homebrew::EnvConfig.no_auto_update? ||
(Homebrew::EnvConfig.no_auto_update? || !Homebrew::EnvConfig.force_api_auto_update?) ||

Check warning on line 63 in Library/Homebrew/api.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/api.rb#L63

Added line #L63 was not covered by tests
((Time.now - stale_seconds) < target.mtime))
skip_download ||= Homebrew.running_as_root_but_not_owned_by_root?

Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ module EnvConfig
"e.g. `brew install ./package.rb`.",
boolean: true,
},
HOMEBREW_FORCE_API_AUTO_UPDATE: {
description: "If set, update the Homebrew API formula or cask data even if `HOMEBREW_NO_AUTO_UPDATE` is set.",
boolean: true,
},
HOMEBREW_FORCE_BREWED_CA_CERTIFICATES: {
description: "If set, always use a Homebrew-installed `ca-certificates` rather than the system version. " \
"Automatically set if the system version is too old.",
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e637a1f

Please sign in to comment.