Pass arguments instead of reopening Pathname

This commit is contained in:
Jack Nagel 2014-04-24 18:26:05 -05:00
parent dcb9ae1bcc
commit ccd31a2dd2

View File

@ -61,7 +61,7 @@ module Homebrew extend self
to.make_relative_symlink(from) to.make_relative_symlink(from)
rescue SystemCallError rescue SystemCallError
to = to.realpath if to.exist? to = to.realpath if to.exist?
opoo "Could not tap #{Tty.white}#{from.tap_ref}#{Tty.reset} over #{Tty.white}#{to.tap_ref}#{Tty.reset}" opoo "Could not tap #{Tty.white}#{tap_ref(from)}#{Tty.reset} over #{Tty.white}#{tap_ref(to)}#{Tty.reset}"
else else
ignores << formula.basename.to_s ignores << formula.basename.to_s
tapped += 1 tapped += 1
@ -115,12 +115,9 @@ module Homebrew extend self
rescue GitHub::Error rescue GitHub::Error
false false
end end
end
def tap_ref(path)
class Pathname case path.to_s
def tap_ref
case self.to_s
when %r{^#{HOMEBREW_LIBRARY}/Taps/([\w_-]+)/([\w_-]+)/(.+)} when %r{^#{HOMEBREW_LIBRARY}/Taps/([\w_-]+)/([\w_-]+)/(.+)}
"#$1/#$2/#{File.basename($3, '.rb')}" "#$1/#$2/#{File.basename($3, '.rb')}"
when %r{^#{HOMEBREW_LIBRARY}/Formula/(.+)} when %r{^#{HOMEBREW_LIBRARY}/Formula/(.+)}