From a171ec18fe0b198613b8cc198118d8573cba0289 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Wed, 28 Nov 2012 10:00:40 -0600 Subject: [PATCH] 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. --- Library/Homebrew/formula.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 3f5f83ced6..cb78221fd6 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