Extend Superenv onto ENV instead of defining it on the singleton class

This commit is contained in:
Jack Nagel 2013-08-19 12:32:55 -05:00
parent 3128931238
commit 21d3402f8e

View File

@ -22,8 +22,7 @@ def superenv?
true true
end end
# Note that this block is guarded with `if superenv?` module Superenv
class << ENV
attr_accessor :keg_only_deps, :deps, :x11 attr_accessor :keg_only_deps, :deps, :x11
alias_method :x11?, :x11 alias_method :x11?, :x11
@ -288,7 +287,6 @@ class << ENV
# This should be a safe hack to prevent that exception cropping up. # This should be a safe hack to prevent that exception cropping up.
# Main consqeuence of this is that ENV['CFLAGS'] is never nil even when it # Main consqeuence of this is that ENV['CFLAGS'] is never nil even when it
# is which can break if checks, but we don't do such a check in our code. # is which can break if checks, but we don't do such a check in our code.
alias_method :"old_[]", :[]
def [] key def [] key
if has_key? key if has_key? key
fetch(key) fetch(key)
@ -304,8 +302,7 @@ class << ENV
a a
end end
end end
end
end if superenv?
if not superenv? if not superenv?
@ -313,6 +310,7 @@ if not superenv?
# we must do this or tools like pkg-config won't get found by configure scripts etc. # we must do this or tools like pkg-config won't get found by configure scripts etc.
ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin' ENV.prepend 'PATH', "#{HOMEBREW_PREFIX}/bin", ':' unless ORIGINAL_PATHS.include? HOMEBREW_PREFIX/'bin'
else else
ENV.extend(Superenv)
ENV.keg_only_deps = [] ENV.keg_only_deps = []
ENV.deps = [] ENV.deps = []
end end