aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2012-05-15 02:27:11 -0400
committerMax Howell2012-05-15 02:27:11 -0400
commit4a48a5f7a39a97c3290313a9dbd3043bbf1b7f83 (patch)
treef2f655765d0838b5f9283e2d12880f9018a7bd64 /Library/Homebrew
parent1a63e9387539449bcd10e77eeb5b7a890213b8c7 (diff)
downloadbrew-4a48a5f7a39a97c3290313a9dbd3043bbf1b7f83.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 Homebrew/homebrew#11558.
Diffstat (limited to 'Library/Homebrew')
-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