Module: EnvActivation

Defined in:
brew/Library/Homebrew/extend/ENV.rb

Instance Method Summary collapse

Instance Method Details

#activate_extensions!Object



13
14
15
16
17
18
19
# File 'brew/Library/Homebrew/extend/ENV.rb', line 13

def activate_extensions!
  if superenv?
    extend(Superenv)
  else
    extend(Stdenv)
  end
end

#clear_sensitive_environment!Object



40
41
42
# File 'brew/Library/Homebrew/extend/ENV.rb', line 40

def clear_sensitive_environment!
  each_key { |key| delete key if sensitive?(key) }
end

#sensitive?(key) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'brew/Library/Homebrew/extend/ENV.rb', line 32

def sensitive?(key)
  /(cookie|key|token|password)/i =~ key
end

#sensitive_environmentObject



36
37
38
# File 'brew/Library/Homebrew/extend/ENV.rb', line 36

def sensitive_environment
  select { |key, _| sensitive?(key) }
end

#with_build_environmentObject



21
22
23
24
25
26
27
28
29
30
# File 'brew/Library/Homebrew/extend/ENV.rb', line 21

def with_build_environment
  old_env = to_hash.dup
  tmp_env = to_hash.dup.extend(EnvActivation)
  tmp_env.activate_extensions!
  tmp_env.setup_build_environment
  replace(tmp_env)
  yield
ensure
  replace(old_env)
end