Skip to content
Snippets Groups Projects
Commit 8f3a7499 authored by Justin Hileman's avatar Justin Hileman Committed by Max Howell
Browse files

Allow 'brew link' to work with URL-based formulae


Closes Homebrew/homebrew#7373.

Signed-off-by: default avatarMax Howell <max@methylblue.com>

I added some comments.
parent 34aea5c9
No related branches found
No related tags found
No related merge requests found
......@@ -18,9 +18,16 @@ module HomebrewArgvExtension
require 'keg'
require 'formula'
@kegs ||= downcased_unique_named.collect do |name|
d = HOMEBREW_CELLAR+Formula.canonical_name(name)
dirs = d.children.select{ |pn| pn.directory? } rescue []
raise NoSuchKegError.new(name) if not d.directory? or dirs.length == 0
n = Formula.canonical_name(name)
rack = HOMEBREW_CELLAR + if n.include? "/"
# 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
Keg.new dirs.first
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment