Pathname./ because it looks a lot better than +

This commit is contained in:
Max Howell 2010-09-12 21:52:30 +01:00
parent b7afc8d8cf
commit 400507b18a

View File

@ -209,6 +209,8 @@ class Pathname
self.to_s[0, prefix.length] == prefix self.to_s[0, prefix.length] == prefix
end end
# perhaps confusingly, this Pathname object becomes the symlink pointing to
# the src paramter.
def make_relative_symlink src def make_relative_symlink src
self.dirname.mkpath self.dirname.mkpath
Dir.chdir self.dirname do Dir.chdir self.dirname do
@ -216,13 +218,17 @@ class Pathname
# NOTE Ruby functions may work, but I had a lot of problems # NOTE Ruby functions may work, but I had a lot of problems
rv = system 'ln', '-sf', src.relative_path_from(self.dirname) rv = system 'ln', '-sf', src.relative_path_from(self.dirname)
unless rv and $? == 0 unless rv and $? == 0
raise <<-EOS raise <<-EOS.undent
Could not create symlink #{to_s}. Could not create symlink #{to_s}.
Check that you have permssions on #{self.dirname} Check that you have permssions on #{self.dirname}
EOS EOS
end end
end end
end end
def / that
join that.to_s
end
end end
# sets $n and $d so you can observe creation of stuff # sets $n and $d so you can observe creation of stuff