aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMisty De Meo2012-11-28 10:00:40 -0600
committerMisty De Meo2012-11-28 10:01:00 -0600
commita171ec18fe0b198613b8cc198118d8573cba0289 (patch)
treea6a59d6a39d2bc9c7713ae30bb4b9bbd2866fa7f /Library/Homebrew
parentff356b6192d323afb6493c906896f69183ba3ffe (diff)
downloadbrew-a171ec18fe0b198613b8cc198118d8573cba0289.tar.bz2
Formula.factory: raise on encountering non-Formula
Formula.factory naively assumed that any already-loaded constant fed into it was a formula, with confusing results when trying to `brew install` a name from the ruby stdlib. Fixes Homebrew/homebrew#16284.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/formula.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 3f5f83ced..cb78221fd 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -395,6 +395,8 @@ class Formula
raise LoadError
end
+ raise NameError if klass.superclass != Formula
+
return klass.new(name) if install_type == :from_name
return klass.new(name, path.to_s)
rescue NoMethodError