Skip to content

Commit

Permalink
Merge pull request #17327 from Homebrew/bundle_user_cache_again
Browse files Browse the repository at this point in the history
env_config: add `HOMEBREW_BUNDLE_USER_CACHE`.
  • Loading branch information
MikeMcQuaid authored May 17, 2024
2 parents e97864a + 0c17665 commit b8d844c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ module EnvConfig
description: "Use this as the browser when opening project homepages.",
default_text: "`$BROWSER` or the OS's default browser.",
},
HOMEBREW_BUNDLE_USER_CACHE: {
description: "If set, use this directory as the `bundle`(1) user cache.",
},
HOMEBREW_CACHE: {
description: "Use this directory as the download cache.",
default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \
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.

9 changes: 2 additions & 7 deletions Library/Homebrew/utils/gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def install_bundler_gems!(only_warn_on_failure: false, setup_path: true, groups:
old_path = ENV.fetch("PATH", nil)
old_gem_path = ENV.fetch("GEM_PATH", nil)
old_gem_home = ENV.fetch("GEM_HOME", nil)
old_bundle_user_cache = ENV.fetch("BUNDLE_USER_CACHE", nil)
old_bundle_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
old_bundle_with = ENV.fetch("BUNDLE_WITH", nil)
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
Expand All @@ -244,12 +243,9 @@ def install_bundler_gems!(only_warn_on_failure: false, setup_path: true, groups:
groups |= (user_gem_groups & valid_gem_groups)
groups.sort!

homebrew_cache = if defined?(HOMEBREW_CACHE)
HOMEBREW_CACHE.to_s
else
ENV.fetch("HOMEBREW_CACHE")
if (homebrew_bundle_user_cache = ENV.fetch("HOMEBREW_BUNDLE_USER_CACHE", nil))
ENV["BUNDLE_USER_CACHE"] = homebrew_bundle_user_cache
end
ENV["BUNDLE_USER_CACHE"] = "#{homebrew_cache}/bundler_cache"
ENV["BUNDLE_GEMFILE"] = gemfile
ENV["BUNDLE_WITH"] = groups.join(" ")
ENV["BUNDLE_FROZEN"] = "true"
Expand Down Expand Up @@ -346,7 +342,6 @@ def install_bundler_gems!(only_warn_on_failure: false, setup_path: true, groups:
ENV["BUNDLE_GEMFILE"] = old_bundle_gemfile
ENV["BUNDLE_WITH"] = old_bundle_with
ENV["BUNDLE_FROZEN"] = old_bundle_frozen
ENV["BUNDLE_USER_CACHE"] = old_bundle_user_cache
end
end
end
1 change: 1 addition & 0 deletions bin/brew
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ MANPAGE_VARS=(
BAT_CONFIG_PATH
BAT_THEME
BROWSER
BUNDLE_USER_CACHE
DISPLAY
EDITOR
NO_COLOR
Expand Down
4 changes: 4 additions & 0 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,10 @@ command execution e.g. `$(cat file)`.

*Default:* `$BROWSER` or the OS's default browser.

`HOMEBREW_BUNDLE_USER_CACHE`

: If set, use this directory as the `bundle`(1) user cache.

`HOMEBREW_CACHE`

: Use this directory as the download cache.
Expand Down
3 changes: 3 additions & 0 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,9 @@ Use this as the browser when opening project homepages\.
\fIDefault:\fP \fB$BROWSER\fP or the OS\[u2019]s default browser\.
.RE
.TP
\fBHOMEBREW_BUNDLE_USER_CACHE\fP
If set, use this directory as the \fBbundle\fP(1) user cache\.
.TP
\fBHOMEBREW_CACHE\fP
Use this directory as the download cache\.
.RS
Expand Down

0 comments on commit b8d844c

Please sign in to comment.