No longer call ENV.userpaths! in requirements

Instead we use which with a custom PATH.
This commit is contained in:
Jack Nagel 2013-08-19 12:33:00 -05:00
parent e0574b854e
commit a03120868f
2 changed files with 5 additions and 8 deletions

View File

@ -94,6 +94,10 @@ class Requirement
end
end
def which(cmd)
super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))
end
class << self
attr_rw :fatal, :build, :default_formula
@ -118,10 +122,7 @@ class Requirement
if instance_variable_defined?(:@satisfied)
@satisfied
elsif @options[:build_env]
ENV.with_build_environment do
ENV.userpaths!
yield @proc
end
ENV.with_build_environment { yield @proc }
else
yield @proc
end

View File

@ -50,12 +50,10 @@ class RequirementTests < Test::Unit::TestCase
def test_satisfy_sets_up_build_env_by_default
req = Class.new(Requirement) do
env :userpaths
satisfy { true }
end.new
ENV.expects(:with_build_environment).yields.returns(true)
ENV.expects(:userpaths!)
assert req.satisfied?
end
@ -66,7 +64,6 @@ class RequirementTests < Test::Unit::TestCase
end.new
ENV.expects(:with_build_environment).never
ENV.expects(:userpaths!).never
assert req.satisfied?
end
@ -78,7 +75,6 @@ class RequirementTests < Test::Unit::TestCase
end.new
ENV.expects(:with_build_environment).yields.returns(which_path)
ENV.expects(:userpaths!)
ENV.expects(:append).with("PATH", which_path.parent, ":")
req.satisfied?