diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 63445e6dbe..bb185001b3 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -515,7 +515,18 @@ module Homebrew 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 diff --git a/Library/Homebrew/test/github_runner_matrix_spec.rb b/Library/Homebrew/test/github_runner_matrix_spec.rb index 24f6e6221b..d314f3522b 100644 --- a/Library/Homebrew/test/github_runner_matrix_spec.rb +++ b/Library/Homebrew/test/github_runner_matrix_spec.rb @@ -9,6 +9,10 @@ RSpec.describe GitHubRunnerMatrix do 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