Skip to content

Commit

Permalink
Don't munge tapped formula names in Formula.factory
Browse files Browse the repository at this point in the history
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#15374.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information
jacknagel committed Oct 9, 2012
1 parent a88ad40 commit 943bff1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Library/Homebrew/formula.rb
Expand Up @@ -367,9 +367,14 @@ def self.factory name
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$/
Expand Down

0 comments on commit 943bff1

Please sign in to comment.