Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env_config: deprecate setting boolean vars to falsy values #18408

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Library/Homebrew/env_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,18 @@ def env_method_name(env, hash)

if hash[:boolean]
define_method(method_name) do
ENV[env].present?
env_value = ENV.fetch(env, nil)

falsy_values = %w[false no off nil 0]
if falsy_values.include?(env_value&.downcase)
odeprecated "#{env}=#{env_value}", <<~EOS
If you wish to enable #{env}, #{env}=1
If you wish to disable #{env}, #{env}=
EOS
end

# TODO: Uncomment the remaining part of the line below after the deprecation/disable cycle.
env_value.present? # && !falsy_values.include(env_value.downcase)
end
elsif hash[:default].present?
define_method(method_name) do
Expand Down
4 changes: 4 additions & 0 deletions Library/Homebrew/test/github_runner_matrix_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
allow(ENV).to receive(:fetch).with("HOMEBREW_MACOS_LONG_TIMEOUT", "false").and_return("false")
allow(ENV).to receive(:fetch).with("HOMEBREW_MACOS_BUILD_ON_GITHUB_RUNNER", "false").and_return("false")
allow(ENV).to receive(:fetch).with("GITHUB_RUN_ID").and_return("12345")
allow(ENV).to receive(:fetch).with("HOMEBREW_NO_INSTALL_FROM_API", nil).and_call_original
allow(ENV).to receive(:fetch).with("HOMEBREW_EVAL_ALL", nil).and_call_original
allow(ENV).to receive(:fetch).with("HOMEBREW_SIMULATE_MACOS_ON_LINUX", nil).and_call_original
allow(ENV).to receive(:fetch).with("HOMEBREW_FORBID_PACKAGES_FROM_PATHS", nil).and_call_original
end

let(:newest_supported_macos) do
Expand Down
Loading