Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BuildEnvironment: use separate sets for procs and symbols

  • Loading branch information...
commit 0baac3bf5faa391d0748dccf6b424bfac05c6801 1 parent fc9a869
@jacknagel jacknagel authored
View
11 Library/Homebrew/build_environment.rb
@@ -3,10 +3,14 @@
class BuildEnvironment
def initialize(*settings)
@settings = Set.new(settings)
+ @procs = Set.new
end
def <<(o)
- @settings << o
+ case o
+ when Proc then @procs << o
+ else @settings << o
+ end
self
end
@@ -19,12 +23,11 @@ def userpaths?
end
def modify_build_environment(context=nil)
- p = @settings.find { |s| Proc === s }
- ENV.instance_exec(context, &p) unless p.nil?
+ @procs.each { |p| ENV.instance_exec(context, &p) }
end
def _dump(*)
- @settings.dup.reject { |s| Proc === s }.join(":")
+ @settings.to_a.join(":")
end
def self._load(s)
View
6 Library/Homebrew/test/test_build_environment.rb
@@ -21,8 +21,10 @@ def test_userpaths?
end
def test_modify_build_environment
- @env << Proc.new { 1 }
- assert_equal 1, @env.modify_build_environment
+ @env << Proc.new { raise StandardError }
+ assert_raises(StandardError) do
+ @env.modify_build_environment
+ end
end
def test_marshal
Please sign in to comment.
Something went wrong with that request. Please try again.