aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-05-15 02:27:11 -0400
committerMax Howell2012-05-15 02:27:11 -0400
commited6b352c2b559ed73836a997bf5fecfa78fee10f (patch)
tree7034d412a710cd4ad2fa0dd309d751dfe94a9063 /Library
parent76bab9095949cbae4fa547fdb9b71bf767420c24 (diff)
downloadhomebrew-ed6b352c2b559ed73836a997bf5fecfa78fee10f.tar.bz2
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 #11558.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index ed2cec904..af12bc185 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -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