aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
authorJack Nagel2013-03-13 02:07:01 -0500
committerJack Nagel2013-03-16 13:05:02 -0500
commitaa69b671b347a7b22daa5bbad7d166fdab45e3e1 (patch)
tree664f307cd6f06a5e8e65a928ddf3e6c56c112313 /Library/Homebrew/formula.rb
parentf91df69127967889a5e7ee7ac6decc6842b7b1cc (diff)
downloadhomebrew-aa69b671b347a7b22daa5bbad7d166fdab45e3e1.tar.bz2
Use a priority queue to select compilers
The existing case-statement with nested if-statements is gross and hard to extend. Replacing it with a priority queue simplifies the logic and makes it very easy to add new compilers to the fails_with system, which we will likely want to do in the future.
Diffstat (limited to 'Library/Homebrew/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 7ba0cd01e..77b1fabdb 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -198,9 +198,8 @@ class Formula
end
def fails_with? cc
- return false if self.class.cc_failures.nil?
cc = Compiler.new(cc) unless cc.is_a? Compiler
- self.class.cc_failures.find do |failure|
+ (self.class.cc_failures || []).any? do |failure|
failure.compiler == cc.name && failure.build >= cc.build
end
end