diff options
| author | Adam Vandenberg | 2010-08-15 17:17:26 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2010-08-15 17:17:26 -0700 |
| commit | 760c1182c9499c19af6cef1f583547f7fde2a2eb (patch) | |
| tree | 8d95da63221444be1cc4e2a5c125b1654a153385 /Library | |
| parent | 1b4cd4c4b61cfb6d09956d882e8db5c06896b78e (diff) | |
| download | homebrew-760c1182c9499c19af6cef1f583547f7fde2a2eb.tar.bz2 | |
Move method back to Pathname.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index cb06688d7..8a940af0a 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 |
