Module: EnvActivation Private
- Includes:
- EnvMethods, Superenv
- Included in:
- ENV, Sorbet::Private::Static::ENVClass
- Defined in:
- extend/ENV.rb,
extend/ENV.rbi
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Constant Summary
Constants included from CompilerConstants
CompilerConstants::COMPILERS, CompilerConstants::COMPILER_SYMBOL_MAP, CompilerConstants::GNU_GCC_REGEXP, CompilerConstants::GNU_GCC_VERSIONS
Instance Attribute Summary
Attributes included from Superenv
#deps, #keg_only_deps, #run_time_deps
Instance Method Summary collapse
-
#activate_extensions!(env: nil) ⇒ void
private
-
#clear_sensitive_environment! ⇒ void
private
-
#sensitive?(key) ⇒ Boolean
private
-
#sensitive_environment ⇒ Hash{String => String}
private
-
#with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block) ⇒ T.untyped
private
Methods included from Superenv
#O0, #O1, #O3, bin, #cxx11, #deparallelize, #determine_cccfg, #determine_dynamic_linker_path, #determine_rpath_paths, extended, #homebrew_extra_cmake_frameworks_paths, #homebrew_extra_cmake_include_paths, #homebrew_extra_cmake_library_paths, #homebrew_extra_isystem_paths, #homebrew_extra_library_paths, #homebrew_extra_paths, #libcxx, #make_jobs, #no_fixup_chains, #no_weak_imports, #permit_arch_flags, #refurbish_args, #reset, #runtime_cpu_detection, #set_debug_symbols, shims_path
Methods included from SharedEnvExtension
#append, #append_path, #append_to_cccfg, #append_to_cflags, #cc, #cflags, #compiler, #cppflags, #cxx, #cxxflags, #effective_arch, #fc, #fcflags, #fflags, #fortran, #ldflags, #no_fixup_chains_support?, #no_weak_imports_support?, #permit_arch_flags, #prepend, #prepend_create_path, #prepend_path, #remove, #remove_cc_etc, #remove_from_cflags
Methods included from EnvMethods
#[], #[]=, #delete, #each_key, #fetch, #key?, #replace, #select, #to_hash
Methods included from Kernel
#disk_usage_readable, #ensure_executable!, #ensure_formula_installed!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #number_readable, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #paths, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #quiet_system, #redact_secrets, #redirect_stdout, #require?, #safe_system, #tap_and_name_comparison, #truncate_text_to_approximate_size, #which, #which_all, #which_editor, #with_custom_locale, #with_env, #with_homebrew_path
Instance Method Details
#activate_extensions!(env: nil) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
26 27 28 29 30 31 32 |
# File 'extend/ENV.rb', line 26 def activate_extensions!(env: nil) if superenv?(env) extend(Superenv) else extend(Stdenv) end end |
#clear_sensitive_environment! ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
71 72 73 |
# File 'extend/ENV.rb', line 71 def clear_sensitive_environment! each_key { |key| delete key if sensitive?(key) } end |
#sensitive?(key) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
61 62 63 |
# File 'extend/ENV.rb', line 61 def sensitive?(key) key.match?(/(cookie|key|token|password|passphrase)/i) end |
#sensitive_environment ⇒ Hash{String => String}
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
66 67 68 |
# File 'extend/ENV.rb', line 66 def sensitive_environment select { |key, _| sensitive?(key) } end |
#with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block) ⇒ T.untyped
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'extend/ENV.rb', line 44 def with_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil, debug_symbols: false, &_block) old_env = to_hash.dup tmp_env = to_hash.dup.extend(EnvActivation) T.cast(tmp_env, EnvActivation).activate_extensions!(env:) T.cast(tmp_env, T.any(Superenv, Stdenv)) .setup_build_environment(cc:, build_bottle:, bottle_arch:, debug_symbols:) replace(tmp_env) begin yield ensure replace(old_env) end end |