blob: 323964dad06bfdf32b488487f225e61c08507536 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  | 
#:  * `--env`:
#:    Show a summary of the Homebrew build environment.
require "extend/ENV"
require "build_environment"
require "utils/shell"
module Homebrew
  module_function
  def __env
    ENV.activate_extensions!
    ENV.deps = ARGV.formulae if superenv?
    ENV.setup_build_environment
    ENV.universal_binary if ARGV.build_universal?
    shell_value = ARGV.value("shell")
    if ARGV.include?("--plain")
      shell = nil
    elsif shell_value.nil?
      # legacy behavior
      shell = :bash unless $stdout.tty?
    elsif shell_value == "auto"
      shell = Utils::Shell.parent_shell || Utils::Shell.preferred_shell
    elsif shell_value
      shell = Utils::Shell.path_to_shell(shell_value)
    end
    env_keys = build_env_keys(ENV)
    if shell.nil?
      dump_build_env ENV
    else
      env_keys.each { |key| puts Utils::Shell.export_value(shell, key, ENV[key]) }
    end
  end
end
  |