Better conflict warnings when tapping

This commit is contained in:
Max Howell 2012-03-16 12:49:09 +00:00
parent 598f7b69d9
commit 2ace9422bc

View File

@ -36,7 +36,9 @@ module Homebrew extend self
if $?.success? if $?.success?
ignores << formula.basename.to_s ignores << formula.basename.to_s
else else
opoo "#{formula.basename('.rb')} conflicts" from = Pathname.new("../Taps").join(formula).tap_ref
to = HOMEBREW_LIBRARY.join("Formula/#{formula.basename}").tap_ref
opoo "Could not tap #{Tty.white}#{from}#{Tty.reset} over #{Tty.white}#{to}#{Tty.reset}"
end end
end end
end end
@ -56,3 +58,17 @@ module Homebrew extend self
end end
end end
class Pathname
def tap_ref
case self.realpath.to_s
when %r{^#{HOMEBREW_LIBRARY}/Taps/(\w+)-(\w+)/(.+)}
"#$1/#$2/#{File.basename($3, '.rb')}"
when %r{^#{HOMEBREW_LIBRARY}/Formula/(.+)}
"mxcl/master/#{File.basename($1, '.rb')}"
else
self.basenname('.rb').to_s
end
end
end