Using existing method to make tap symlinks

This commit is contained in:
Jack Nagel 2014-04-24 18:04:53 -05:00
parent 3f10327c0e
commit dcb9ae1bcc

View File

@ -50,23 +50,21 @@ module Homebrew extend self
ignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] ignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue []
tapped = 0 tapped = 0
cd HOMEBREW_LIBRARY/"Formula" do formulae.each do |formula|
formulae.each do |formula| from = HOMEBREW_LIBRARY.join("Taps/#{formula}")
from = HOMEBREW_LIBRARY.join("Taps/#{formula}") to = HOMEBREW_LIBRARY.join("Formula/#{formula.basename}")
to = HOMEBREW_LIBRARY.join("Formula/#{formula.basename}")
# Unexpected, but possible, lets proceed as if nothing happened # Unexpected, but possible, lets proceed as if nothing happened
to.delete if to.symlink? and to.realpath == from to.delete if to.symlink? and to.realpath == from
# using the system ln is the only way to get relative symlinks begin
system "ln -s ../Taps/#{formula} 2>/dev/null" to.make_relative_symlink(from)
if $?.success? rescue SystemCallError
ignores << formula.basename.to_s to = to.realpath if to.exist?
tapped += 1 opoo "Could not tap #{Tty.white}#{from.tap_ref}#{Tty.reset} over #{Tty.white}#{to.tap_ref}#{Tty.reset}"
else else
to = to.realpath if to.exist? ignores << formula.basename.to_s
opoo "Could not tap #{Tty.white}#{from.tap_ref}#{Tty.reset} over #{Tty.white}#{to.tap_ref}#{Tty.reset}" tapped += 1
end
end end
end end