Skip to content

Commit

Permalink
Better conflict warnings when tapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Mar 16, 2012
1 parent f9c87ae commit 0ec3aef
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Library/Homebrew/cmd/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def link_tap_formula formulae
if $?.success?
ignores << formula.basename.to_s
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
Expand All @@ -56,3 +58,17 @@ def tap_args
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

0 comments on commit 0ec3aef

Please sign in to comment.