From 157425cc10e51c845c6a952a6b25ad261e0c0587 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 15 Aug 2010 17:17:26 -0700 Subject: [PATCH] Move method back to Pathname. --- Library/Homebrew/extend/pathname.rb | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index cb06688d7b..8a940af0a7 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -208,6 +208,21 @@ class Pathname prefix = prefix.to_s self.to_s[0, prefix.length] == prefix end + + def make_relative_symlink src + self.dirname.mkpath + Dir.chdir self.dirname do + # TODO use Ruby function so we get exceptions + # NOTE Ruby functions may work, but I had a lot of problems + rv=system 'ln', '-sf', src.relative_path_from(self.dirname) + unless rv and $? == 0 + raise <<-EOS +Could not create symlink #{to_s}. +Check that you have permssions on #{self.dirname} + EOS + end + end + end end # sets $n and $d so you can observe creation of stuff @@ -228,15 +243,9 @@ module ObserverPathnameExtension $d+=1 end def make_relative_symlink src - dirname.mkpath - Dir.chdir dirname do - # TODO use Ruby function so we get exceptions - # NOTE Ruby functions may work, but I had a lot of problems - rv=system 'ln', '-sf', src.relative_path_from(dirname) - raise "Could not create symlink #{to_s}" unless rv and $? == 0 - puts "ln #{to_s}" if ARGV.verbose? - $n+=1 - end + super + puts "ln #{to_s}" if ARGV.verbose? + $n+=1 end end