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:
parent
0d90deac27
commit
e891bb4272
@ -121,11 +121,8 @@ class Formulary
|
|||||||
# Loads formulae from disk using a path
|
# Loads formulae from disk using a path
|
||||||
class FromPathLoader < FormulaLoader
|
class FromPathLoader < FormulaLoader
|
||||||
def initialize path
|
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
|
path = Pathname.new(path).expand_path
|
||||||
super path.stem, path
|
super path.basename(".rb").to_s, path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -191,7 +188,7 @@ class Formulary
|
|||||||
return TapLoader.new(ref)
|
return TapLoader.new(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ref.include?("/") || File.extname(ref) == ".rb"
|
if File.extname(ref) == ".rb"
|
||||||
return FromPathLoader.new(ref)
|
return FromPathLoader.new(ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user