diff options
| author | Jack Nagel | 2014-04-24 18:04:53 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-04-24 18:06:11 -0500 |
| commit | dcb9ae1bcc8adaad088013aecb17c0fb4d120b1e (patch) | |
| tree | 2e967f6308ac53a43c888ff6c98d7b29df111f6c /Library | |
| parent | 3f10327c0e9327501e3fd0cdff21b79e9658f4e5 (diff) | |
| download | brew-dcb9ae1bcc8adaad088013aecb17c0fb4d120b1e.tar.bz2 | |
Using existing method to make tap symlinks
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index f2815a960..860b4a0a1 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -50,23 +50,21 @@ module Homebrew extend self ignores = (HOMEBREW_LIBRARY/"Formula/.gitignore").read.split rescue [] tapped = 0 - cd HOMEBREW_LIBRARY/"Formula" do - formulae.each do |formula| - from = HOMEBREW_LIBRARY.join("Taps/#{formula}") - to = HOMEBREW_LIBRARY.join("Formula/#{formula.basename}") - - # Unexpected, but possible, lets proceed as if nothing happened - to.delete if to.symlink? and to.realpath == from - - # using the system ln is the only way to get relative symlinks - system "ln -s ../Taps/#{formula} 2>/dev/null" - if $?.success? - ignores << formula.basename.to_s - tapped += 1 - else - 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}" - end + formulae.each do |formula| + from = HOMEBREW_LIBRARY.join("Taps/#{formula}") + to = HOMEBREW_LIBRARY.join("Formula/#{formula.basename}") + + # Unexpected, but possible, lets proceed as if nothing happened + to.delete if to.symlink? and to.realpath == from + + begin + to.make_relative_symlink(from) + rescue SystemCallError + 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}" + else + ignores << formula.basename.to_s + tapped += 1 end end |
