Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 35 lines (30 sloc) 0.694 kb
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
require 'hardware'
require 'extend/ENV/shared'
require 'extend/ENV/std'
require 'extend/ENV/super'

def superenv?
  return false if MacOS::Xcode.without_clt? && MacOS.sdk_path.nil?
  return false unless Superenv.bin && Superenv.bin.directory?
  return false if ARGV.env == "std"
  true
end

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

  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
end

ENV.extend(EnvActivation)
Something went wrong with that request. Please try again.