Move method back to Pathname.

This commit is contained in:
Adam Vandenberg 2010-08-15 17:17:26 -07:00
parent 85b9c7eca1
commit 157425cc10

View File

@ -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,16 +243,10 @@ 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
super
puts "ln #{to_s}" if ARGV.verbose?
$n+=1
end
end
end
$n=0