Check CUSTOM_IMPLEMENTATIONS for all variables.
This commit is contained in:
parent
8e13a6e1f4
commit
fcca056f4c
@ -1,6 +1,8 @@
|
|||||||
# typed: true
|
# typed: true
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "set"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
# Helper module for querying Homebrew-specific environment variables.
|
# Helper module for querying Homebrew-specific environment variables.
|
||||||
#
|
#
|
||||||
@ -421,12 +423,15 @@ module Homebrew
|
|||||||
method_name
|
method_name
|
||||||
end
|
end
|
||||||
|
|
||||||
CUSTOM_IMPLEMENTATIONS = %w[
|
CUSTOM_IMPLEMENTATIONS = Set.new([
|
||||||
HOMEBREW_MAKE_JOBS
|
:HOMEBREW_MAKE_JOBS,
|
||||||
HOMEBREW_CASK_OPTS
|
:HOMEBREW_CASK_OPTS,
|
||||||
].freeze
|
]).freeze
|
||||||
|
|
||||||
ENVS.each do |env, hash|
|
ENVS.each do |env, hash|
|
||||||
|
# Needs a custom implementation.
|
||||||
|
next if CUSTOM_IMPLEMENTATIONS.include?(env)
|
||||||
|
|
||||||
method_name = env_method_name(env, hash)
|
method_name = env_method_name(env, hash)
|
||||||
env = env.to_s
|
env = env.to_s
|
||||||
|
|
||||||
@ -435,9 +440,6 @@ module Homebrew
|
|||||||
ENV[env].present?
|
ENV[env].present?
|
||||||
end
|
end
|
||||||
elsif hash[:default].present?
|
elsif hash[:default].present?
|
||||||
# Needs a custom implementation.
|
|
||||||
next if CUSTOM_IMPLEMENTATIONS.include?(env)
|
|
||||||
|
|
||||||
define_method(method_name) do
|
define_method(method_name) do
|
||||||
ENV[env].presence || hash.fetch(:default).to_s
|
ENV[env].presence || hash.fetch(:default).to_s
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user