env_config: add HOMEBREW_BUNDLE_USER_CACHE.

Used to configure `BUNDLE_USER_CACHE`.
This commit is contained in:
Mike McQuaid 2024-05-18 00:08:42 +09:00
parent e97864a0a8
commit 0c1766510a
No known key found for this signature in database
6 changed files with 16 additions and 7 deletions

View File

@ -91,6 +91,9 @@ module Homebrew
description: "Use this as the browser when opening project homepages.", description: "Use this as the browser when opening project homepages.",
default_text: "`$BROWSER` or the OS's default browser.", 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: { HOMEBREW_CACHE: {
description: "Use this directory as the download cache.", description: "Use this directory as the download cache.",
default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \ default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \

View File

@ -52,6 +52,9 @@ module Homebrew::EnvConfig
sig { returns(T.nilable(::String)) } sig { returns(T.nilable(::String)) }
def browser; end def browser; end
sig { returns(T.nilable(::String)) }
def bundle_user_cache; end
sig { returns(String) } sig { returns(String) }
def cache; end def cache; end

View File

@ -224,7 +224,6 @@ module Homebrew
old_path = ENV.fetch("PATH", nil) old_path = ENV.fetch("PATH", nil)
old_gem_path = ENV.fetch("GEM_PATH", nil) old_gem_path = ENV.fetch("GEM_PATH", nil)
old_gem_home = ENV.fetch("GEM_HOME", 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_gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
old_bundle_with = ENV.fetch("BUNDLE_WITH", nil) old_bundle_with = ENV.fetch("BUNDLE_WITH", nil)
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil) old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
@ -244,12 +243,9 @@ module Homebrew
groups |= (user_gem_groups & valid_gem_groups) groups |= (user_gem_groups & valid_gem_groups)
groups.sort! groups.sort!
homebrew_cache = if defined?(HOMEBREW_CACHE) if (homebrew_bundle_user_cache = ENV.fetch("HOMEBREW_BUNDLE_USER_CACHE", nil))
HOMEBREW_CACHE.to_s ENV["BUNDLE_USER_CACHE"] = homebrew_bundle_user_cache
else
ENV.fetch("HOMEBREW_CACHE")
end end
ENV["BUNDLE_USER_CACHE"] = "#{homebrew_cache}/bundler_cache"
ENV["BUNDLE_GEMFILE"] = gemfile ENV["BUNDLE_GEMFILE"] = gemfile
ENV["BUNDLE_WITH"] = groups.join(" ") ENV["BUNDLE_WITH"] = groups.join(" ")
ENV["BUNDLE_FROZEN"] = "true" ENV["BUNDLE_FROZEN"] = "true"
@ -346,7 +342,6 @@ module Homebrew
ENV["BUNDLE_GEMFILE"] = old_bundle_gemfile ENV["BUNDLE_GEMFILE"] = old_bundle_gemfile
ENV["BUNDLE_WITH"] = old_bundle_with ENV["BUNDLE_WITH"] = old_bundle_with
ENV["BUNDLE_FROZEN"] = old_bundle_frozen ENV["BUNDLE_FROZEN"] = old_bundle_frozen
ENV["BUNDLE_USER_CACHE"] = old_bundle_user_cache
end end
end end
end end

View File

@ -144,6 +144,7 @@ MANPAGE_VARS=(
BAT_CONFIG_PATH BAT_CONFIG_PATH
BAT_THEME BAT_THEME
BROWSER BROWSER
BUNDLE_USER_CACHE
DISPLAY DISPLAY
EDITOR EDITOR
NO_COLOR NO_COLOR

View File

@ -3568,6 +3568,10 @@ command execution e.g. `$(cat file)`.
*Default:* `$BROWSER` or the OS's default browser. *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` `HOMEBREW_CACHE`
: Use this directory as the download cache. : Use this directory as the download cache.

View File

@ -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\. \fIDefault:\fP \fB$BROWSER\fP or the OS\[u2019]s default browser\.
.RE .RE
.TP .TP
\fBHOMEBREW_BUNDLE_USER_CACHE\fP
If set, use this directory as the \fBbundle\fP(1) user cache\.
.TP
\fBHOMEBREW_CACHE\fP \fBHOMEBREW_CACHE\fP
Use this directory as the download cache\. Use this directory as the download cache\.
.RS .RS