system_config: output most HOMEBREW_* variables.

Exclude the boring ones and exclude some that are already printed that
are just using their default values. HOMEBREW_PREFIX is the only one
where we’re always interested in the output to quickly communicate it.
This commit is contained in:
Mike McQuaid 2017-11-04 16:35:24 +00:00
parent 1b69848119
commit 4892465fc4

View File

@ -169,10 +169,47 @@ class SystemConfig
else else
f.puts "Core tap: N/A" f.puts "Core tap: N/A"
end end
defaults_hash = {
HOMEBREW_PREFIX: "/usr/local",
HOMEBREW_REPOSITORY: "/usr/local/Homebrew",
HOMEBREW_CELLAR: "/usr/local/Cellar",
HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew",
}.freeze
boring_keys = %w[
HOMEBREW_BROWSER
HOMEBREW_EDITOR
HOMEBREW_ANALYTICS_ID
HOMEBREW_ANALYTICS_USER_UUID
HOMEBREW_BREW_FILE
HOMEBREW_COMMAND_DEPTH
HOMEBREW_CURL
HOMEBREW_LIBRARY
HOMEBREW_MACOS_VERSION
HOMEBREW_RUBY_PATH
HOMEBREW_SYSTEM
HOMEBREW_OS_VERSION
HOMEBREW_PATH
HOMEBREW_PROCESSOR
HOMEBREW_PRODUCT
HOMEBREW_USER_AGENT
HOMEBREW_USER_AGENT_CURL
HOMEBREW_VERSION
].freeze
f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
if defaults_hash[:HOMEBREW_REPOSITORY] != HOMEBREW_REPOSITORY.to_s
f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}" f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
end
if defaults_hash[:HOMEBREW_CELLAR] != HOMEBREW_CELLAR.to_s
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}" f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
f.puts "HOMEBREW_BOTTLE_DOMAIN: #{BottleSpecification::DEFAULT_DOMAIN}" end
ENV.sort.each do |key, value|
next unless key.start_with?("HOMEBREW_")
next if boring_keys.include?(key)
next if defaults_hash[key.to_sym] == value
value = "set" if key =~ /(cookie|key|token)/i
f.puts "#{key}: #{value}"
end
f.puts hardware if hardware f.puts hardware if hardware
f.puts "Homebrew Ruby: #{describe_homebrew_ruby}" f.puts "Homebrew Ruby: #{describe_homebrew_ruby}"
f.puts "GCC-4.0: build #{gcc_4_0}" unless gcc_4_0.null? f.puts "GCC-4.0: build #{gcc_4_0}" unless gcc_4_0.null?