summaryrefslogtreecommitdiff
path: root/lib/fileutils.rb
diff options
context:
space:
mode:
authorBurdette Lamar <[email protected]>2022-05-24 10:38:02 -0500
committergit <[email protected]>2022-05-25 00:38:14 +0900
commitae09fffbff4320455f7a2a260814416be4b0999a ()
treedbe8bd86357e72290f72bb3ba5296abe8a3c9e15 /lib/fileutils.rb
parent633608ebd4cbdeea562dc4c608495134965a19a9 (diff)
[ruby/fileutils] [DOC] Enhanced RDoc for ::cp_r (https://.com/ruby/fileutils/pull/75)
https://.com/ruby/fileutils/commit/a4da433443
-rw-r--r--lib/fileutils.rb85
1 files changed, 68 insertions, 17 deletions
@@ -677,6 +677,8 @@ module FileUtils
#
# Raises an exception if +src+ is a directory.
#
# FileUtils.copy is an alias for FileUtils.cp.
#
def cp(src, dest, preserve: nil, noop: nil, verbose: nil)
@@ -691,30 +693,79 @@ module FileUtils
alias copy cp
module_function :copy
#
- # Copies +src+ to +dest+. If +src+ is a directory, this method copies
- # all its contents recursively. If +dest+ is a directory, copies
- # +src+ to +dest/src+.
#
- # +src+ can be a list of files.
#
- # If +dereference_root+ is true, this method dereference tree root.
#
- # If +remove_destination+ is true, this method removes each destination file before copy.
#
- # # Installing Ruby library "mylib" under the site_ruby
- # FileUtils.rm_r site_ruby + '/mylib', force: true
- # FileUtils.cp_r 'lib/', site_ruby + '/mylib'
#
- # # Examples of copying several files to target directory.
- # FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail'
- # FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', noop: true, verbose: true
#
- # # If you want to copy all contents of a directory instead of the
- # # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
- # # use following code.
- # FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest') makes dest/src,
- # # but this doesn't.
#
def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil,
dereference_root: true, remove_destination: nil)