From 35c47f81f28da1e6ca64014d3ddf09528b506763 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 9 Oct 2012 14:45:53 -0500 Subject: [PATCH] Don't munge tapped formula names in Formula.factory This started happening as a result of bbc167b, which avoids reloading previously defined formulae. The exception alters its message if the name parameter appears to be a tapped formula, but this is lost if we only pass in the "stem" of the pathname. Long-term this probably needs some restructuring, perhaps with a separate exception for tapped formula, but for now this should re-enable the more useful error message. Fixes Homebrew/homebrew#15374. Signed-off-by: Jack Nagel --- Library/Homebrew/formula.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 5ba20b473a..d23aeea714 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -367,9 +367,14 @@ class Formula install_type = :from_url else name = Formula.canonical_name(name) - # If name was a path or mapped to a cached formula - if name.include? "/" + if name =~ %r{^(\w+)/(\w+)/([^/])+$} + # name appears to be a tapped formula, so we don't munge it + # in order to provide a useful error message when require fails. + path = Pathname.new(name) + elsif name.include? "/" + # If name was a path or mapped to a cached formula + # 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$/