Don't fall into the no-extension OK trap

`require` is OK without an .rb extension, but the rest of our code will be confused and generate weird errors.

Fixes Homebrew/homebrew#11558.
This commit is contained in:
Max Howell 2012-05-15 02:27:11 -04:00
parent 1a63e93875
commit 4a48a5f7a3

View File

@ -334,6 +334,11 @@ class Formula
# If name was a path or mapped to a cached formula
if name.include? "/"
require name
# require allows filenames to drop the .rb extension, but everything else
# in our codebase will require an exact and fullpath.
name = "#{name}.rb" unless name =~ /\.rb$/
path = Pathname.new(name)
name = path.stem
install_type = :from_path