168168# - FileUtils.rm_rf with keyword argument <tt>secure: true</tt>.
169169#
170170# Finally, this method for moving entries calls \FileUtils.remove_entry_secure
171- # if the source and destination are on different devices
171+ # if the source and destination are on different file systems
172172# (which means that the "move" is really a copy and remove):
173173#
174174# - FileUtils.mv with keyword argument <tt>secure: true</tt>.
@@ -555,21 +555,6 @@ def ln(src, dest, force: nil, noop: nil, verbose: nil)
555555 # "tmp1/tmp3/t2.txt",
556556 # "tmp1/tmp3/t3.txt"]
557557 #
558- # If +src+ is an array of paths to files and +dest+ is the path to a directory,
559- # for each path +filepath+ in +src+, creates a link at <tt>dest/filepath</tt>
560- # pointing to that path:
561- #
562- # FileUtils.rm_r('tmp1')
563- # Dir.mkdir('tmp1')
564- # FileUtils.cp_lr(['tmp0/tmp3/t2.txt', 'tmp0/tmp3/t3.txt'], 'tmp1')
565- # Dir.glob('**/*.txt')
566- # # => ["tmp0/tmp2/t0.txt",
567- # "tmp0/tmp2/t1.txt",
568- # "tmp0/tmp3/t2.txt",
569- # "tmp0/tmp3/t3.txt",
570- # "tmp1/t2.txt",
571- # "tmp1/t3.txt"]
572- #
573558 # If +src+ and +dest+ are both paths to directories,
574559 # creates links <tt>dest/src</tt> and descendents
575560 # pointing to +src+ and its descendents:
@@ -586,6 +571,21 @@ def ln(src, dest, force: nil, noop: nil, verbose: nil)
586571 # "tmp1/tmp0/tmp3/t2.txt",
587572 # "tmp1/tmp0/tmp3/t3.txt"]
588573 #
574+ # If +src+ is an array of paths to files and +dest+ is the path to a directory,
575+ # for each path +filepath+ in +src+, creates a link at <tt>dest/filepath</tt>
576+ # pointing to that path:
577+ #
578+ # FileUtils.rm_r('tmp1')
579+ # Dir.mkdir('tmp1')
580+ # FileUtils.cp_lr(['tmp0/tmp3/t2.txt', 'tmp0/tmp3/t3.txt'], 'tmp1')
581+ # Dir.glob('**/*.txt')
582+ # # => ["tmp0/tmp2/t0.txt",
583+ # "tmp0/tmp2/t1.txt",
584+ # "tmp0/tmp3/t2.txt",
585+ # "tmp0/tmp3/t3.txt",
586+ # "tmp1/t2.txt",
587+ # "tmp1/t3.txt"]
588+ #
589589 # Keyword arguments:
590590 #
591591 # - <tt>dereference_root: false</tt> - if +src+ is a symbolic link,
@@ -621,7 +621,7 @@ def cp_lr(src, dest, noop: nil, verbose: nil,
621621 # and +dest+ (a single path)
622622 # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
623623 #
624- # When +src+ is the path to an existing file:
624+ # If +src+ is the path to an existing file:
625625 #
626626 # - When +dest+ is the path to a non-existent file,
627627 # creates a symbolic link at +dest+ pointing to +src+:
@@ -643,15 +643,15 @@ def cp_lr(src, dest, noop: nil, verbose: nil,
643643 #
644644 # FileUtils.ln_s('src1.txt', 'dest1.txt') # Raises Errno::EEXIST.
645645 #
646- # When +dest+ is the path to a directory,
646+ # If +dest+ is the path to a directory,
647647 # creates a symbolic link at <tt>dest/src</tt> pointing to +src+:
648648 #
649649 # FileUtils.touch('src2.txt')
650650 # FileUtils.mkdir('destdir2')
651651 # FileUtils.ln_s('src2.txt', 'destdir2')
652652 # File.symlink?('destdir2/src2.txt') # => true
653653 #
654- # When +src+ is an array of paths to existing files and +dest+ is a directory,
654+ # If +src+ is an array of paths to existing files and +dest+ is a directory,
655655 # for each child +child+ in +src+ creates a symbolic link <tt>dest/child</tt>
656656 # pointing to +child+:
657657 #
@@ -751,7 +751,7 @@ def link_entry(src, dest, dereference_root = false, remove_destination = false)
751751 end
752752 module_function :link_entry
753753
754- # Copies files from +src+ to +dest+ .
754+ # Copies files.
755755 #
756756 # Arguments +src+ (a single path or an array of paths)
757757 # and +dest+ (a single path)
@@ -1018,14 +1018,15 @@ def copy_stream(src, dest)
10181018 end
10191019 module_function :copy_stream
10201020
1021- # Moves files from +src+ (a single path or an array of paths)
1022- # to +dest+ (a single path).
1023- # If +src+ and +dest+ are on different devices,
1024- # first copies, then removes +src+.
1021+ # Moves entries.
10251022 #
1026- # Arguments +src+ and +dest+
1023+ # Arguments +src+ (a single path or an array of paths)
1024+ # and +dest+ (a single path)
10271025 # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
10281026 #
1027+ # If +src+ and +dest+ are on different file systems,
1028+ # first copies, then removes +src+.
1029+ #
10291030 # May cause a local vulnerability if not called with keyword argument
10301031 # <tt>secure: true</tt>;
10311032 # see {Avoiding the TOCTTOU Vulnerability}[rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability].
@@ -1066,7 +1067,7 @@ def copy_stream(src, dest)
10661067 # Keyword arguments:
10671068 #
10681069 # - <tt>force: true</tt> - if the move includes removing +src+
1069- # (that is, if +src+ and +dest+ are on different devices ),
1070+ # (that is, if +src+ and +dest+ are on different file systems ),
10701071 # ignores raised exceptions of StandardError and its descendants.
10711072 # - <tt>noop: true</tt> - does not move files.
10721073 # - <tt>secure: true</tt> - removes +src+ securely;
@@ -1457,11 +1458,12 @@ def compare_stream(a, b)
14571458 end
14581459 module_function :compare_stream
14591460
1460- # Copies the file entry at path +src+ to the entry at path +dest+ ;
1461+ # Copies a file entry;
14611462 # see {install(1)}[https://man7.org/linux/man-pages/man1/install.1.html].
14621463 #
1463- # Arguments +src+ and +dest+
1464- # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
1464+ # Arguments +src+ (a single path or an array of paths)
1465+ # and +dest+ (a single path)
1466+ # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments];
14651467 #
14661468 # If the entry at +dest+ does not exist, copies from +src+ to +dest+:
14671469 #
@@ -1485,6 +1487,16 @@ def compare_stream(a, b)
14851487 # FileUtils.install('src2.txt', 'dest2')
14861488 # File.read('dest2/src2.txt') # => "aaa\n"
14871489 #
1490+ # If +src+ is an array of paths and +dest+ points to a directory,
1491+ # copies each path +path+ in +src+ to <tt>dest/path</tt>:
1492+ #
1493+ # File.file?('src3.txt') # => true
1494+ # File.file?('src3.dat') # => true
1495+ # FileUtils.mkdir('dest3')
1496+ # FileUtils.install(['src3.txt', 'src3.dat'], 'dest3')
1497+ # File.file?('dest3/src3.txt') # => true
1498+ # File.file?('dest3/src3.dat') # => true
1499+ #
14881500 # Keyword arguments:
14891501 #
14901502 # - <tt>group: <i>group</i></tt> - changes the group if not +nil+,
0 commit comments