Make relative symlinks in Pathname#install_symlink
Closes Homebrew/homebrew#27672.
This commit is contained in:
parent
4353f4fc97
commit
aa7ed10968
@ -79,14 +79,10 @@ class Pathname
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_symlink_p src, new_basename = nil
|
def install_symlink_p src, new_basename=src
|
||||||
if new_basename.nil?
|
dst = join File.basename(new_basename)
|
||||||
dst = self+File.basename(src)
|
|
||||||
else
|
|
||||||
dst = self+File.basename(new_basename)
|
|
||||||
end
|
|
||||||
mkpath
|
mkpath
|
||||||
FileUtils.ln_s src.to_s, dst.to_s
|
FileUtils.ln_s Pathname(src).relative_path_from(dst.parent), dst
|
||||||
end
|
end
|
||||||
protected :install_symlink_p
|
protected :install_symlink_p
|
||||||
|
|
||||||
|
|||||||
@ -194,6 +194,8 @@ class PathnameExtensionTests < Test::Unit::TestCase
|
|||||||
assert((@dst+'bin').directory?)
|
assert((@dst+'bin').directory?)
|
||||||
assert((@dst+'bin/a.txt').exist?)
|
assert((@dst+'bin/a.txt').exist?)
|
||||||
assert((@dst+'bin/b.txt').exist?)
|
assert((@dst+'bin/b.txt').exist?)
|
||||||
|
|
||||||
|
assert((@dst+'bin').readlink.relative?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user