Allow 'brew link' to work with URL-based formulae
Closes Homebrew/homebrew#7373. Signed-off-by: Max Howell <max@methylblue.com> I added some comments.
This commit is contained in:
parent
34aea5c987
commit
8f3a74993b
@ -18,9 +18,16 @@ module HomebrewArgvExtension
|
|||||||
require 'keg'
|
require 'keg'
|
||||||
require 'formula'
|
require 'formula'
|
||||||
@kegs ||= downcased_unique_named.collect do |name|
|
@kegs ||= downcased_unique_named.collect do |name|
|
||||||
d = HOMEBREW_CELLAR+Formula.canonical_name(name)
|
n = Formula.canonical_name(name)
|
||||||
dirs = d.children.select{ |pn| pn.directory? } rescue []
|
rack = HOMEBREW_CELLAR + if n.include? "/"
|
||||||
raise NoSuchKegError.new(name) if not d.directory? or dirs.length == 0
|
# canonical_name returns a path if it was a formula installed via a
|
||||||
|
# URL. And we only want the name. FIXME that function is insane.
|
||||||
|
Pathname.new(n).stem
|
||||||
|
else
|
||||||
|
n
|
||||||
|
end
|
||||||
|
dirs = rack.children.select{ |pn| pn.directory? } rescue []
|
||||||
|
raise NoSuchKegError.new(name) if not rack.directory? or dirs.length == 0
|
||||||
raise MultipleVersionsInstalledError.new(name) if dirs.length > 1
|
raise MultipleVersionsInstalledError.new(name) if dirs.length > 1
|
||||||
Keg.new dirs.first
|
Keg.new dirs.first
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user