Drop support for passing incomplete paths

`brew install ./foo` treats `./foo` like `./foo.rb`. This requires
a confusing special case in the name resolution logic and doesn't make
a whole lot of sense from a UX perspective.

Drop support for this. The argument should be an absolute path,
a relative path, or a formula name, rather than a hybrid.

cf. https://github.com/Homebrew/homebrew/issues/23430#issuecomment-26776962
This commit is contained in:
Jack Nagel 2014-04-05 22:03:34 -05:00
parent 0d90deac27
commit e891bb4272

View File

@ -121,11 +121,8 @@ class Formulary
# Loads formulae from disk using a path
class FromPathLoader < FormulaLoader
def initialize path
# require allows filenames to drop the .rb extension, but everything else
# in our codebase will require an exact and fullpath.
path = "#{path}.rb" unless File.extname(path) == ".rb"
path = Pathname.new(path).expand_path
super path.stem, path
super path.basename(".rb").to_s, path
end
end
@ -191,7 +188,7 @@ class Formulary
return TapLoader.new(ref)
end
if ref.include?("/") || File.extname(ref) == ".rb"
if File.extname(ref) == ".rb"
return FromPathLoader.new(ref)
end