Browse files

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 #15374.

Signed-off-by: Jack Nagel <>
  • Loading branch information...
1 parent a88ad40 commit 943bff10d4bd251a98c1c9ee0c2e939a5c37c27b @jacknagel jacknagel committed Oct 9, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 Library/Homebrew/formula.rb
@@ -367,9 +367,14 @@ def self.factory name
install_type = :from_url
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 =
+ 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$/

0 comments on commit 943bff1

Please sign in to comment.