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.
This commit is contained in:
parent
ff356b6192
commit
a171ec18fe
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user