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:
parent
1a63e93875
commit
4a48a5f7a3
@ -334,6 +334,11 @@ class Formula
|
|||||||
# If name was a path or mapped to a cached formula
|
# If name was a path or mapped to a cached formula
|
||||||
if name.include? "/"
|
if name.include? "/"
|
||||||
require name
|
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)
|
path = Pathname.new(name)
|
||||||
name = path.stem
|
name = path.stem
|
||||||
install_type = :from_path
|
install_type = :from_path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user