ruby-changes:72272
From: Burdette <ko1@a...>
Date: Tue, 21 Jun 2022 22:42:52 +0900 (JST)
Subject: [ruby-changes:72272] 1002998c6d (master): [ruby/fileutils] [DOC] Adding 'Related' (https://github.com/ruby/fileutils/pull/92)
https://git.ruby-lang.org/ruby.git/commit/?id=1002998c6d From 1002998c6df5a5cc4b9dd42bee371797a131ee44 Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Tue, 21 Jun 2022 08:42:27 -0500 Subject: [ruby/fileutils] [DOC] Adding 'Related' (https://github.com/ruby/fileutils/pull/92) https://github.com/ruby/fileutils/commit/fc3cc28397 --- lib/fileutils.rb | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/lib/fileutils.rb b/lib/fileutils.rb index 23aef6e146..a965797b39 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -198,6 +198,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L198 # # FileUtils.getwd is an alias for FileUtils.pwd. # + # Related: FileUtils.cd. + # def pwd Dir.pwd end @@ -239,6 +241,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L241 # # FileUtils.chdir is an alias for FileUtils.cd. # + # Related: FileUtils.pwd. + # def cd(dir, verbose: nil, &block) # :yield: dir fu_output_message "cd #{dir}" if verbose result = Dir.chdir(dir, &block) @@ -263,6 +267,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L267 # # A non-existent file is considered to be infinitely old. # + # Related: FileUtils.touch. + # def uptodate?(new, old_list) return false unless File.exist?(new) new_time = File.mtime(new) @@ -313,6 +319,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L319 # Raises an exception if any path points to an existing # file or directory, or if for any reason a directory cannot be created. # + # Related: FileUtils.mkdir_p. + # def mkdir(list, mode: nil, noop: nil, verbose: nil) list = fu_list(list) fu_output_message "mkdir #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose @@ -360,6 +368,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L368 # # FileUtils.mkpath and FileUtils.makedirs are aliases for FileUtils.mkdir_p. # + # Related: FileUtils.mkdir. + # def mkdir_p(list, mode: nil, noop: nil, verbose: nil) list = fu_list(list) fu_output_message "mkdir -p #{mode ? ('-m %03o ' % mode) : ''}#{list.join ' '}" if verbose @@ -509,6 +519,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L519 # # FileUtils#link is an alias for FileUtils#ln. # + # Related: FileUtils.link_entry (has different options). + # def ln(src, dest, force: nil, noop: nil, verbose: nil) fu_output_message "ln#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose return if noop @@ -597,6 +609,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L609 # Raises an exception if +dest+ is the path to an existing file or directory # and keyword argument <tt>remove_destination: true</tt> is not given. # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false) fu_output_message "cp -lr#{remove_destination ? ' --remove-destination' : ''} #{[src,dest].flatten.join ' '}" if verbose @@ -675,6 +689,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L689 # # FileUtils.symlink is an alias for FileUtils.ln_s. # + # Related: FileUtils.ln_sf. + # def ln_s(src, dest, force: nil, noop: nil, verbose: nil) fu_output_message "ln -s#{force ? 'f' : ''} #{[src,dest].flatten.join ' '}" if verbose return if noop @@ -734,6 +750,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L750 # Raises an exception if +dest+ is the path to an existing file or directory # and keyword argument <tt>remove_destination: true</tt> is not given. # + # Related: FileUtils.ln (has different options). + # def link_entry(src, dest, dereference_root = false, remove_destination = false) Entry_.new(src, nil, dereference_root).traverse do |ent| destent = Entry_.new(dest, ent.rel, false) @@ -793,10 +811,10 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L811 # # Raises an exception if +src+ is a directory. # - # Related: FileUtils.cp_r (recursive). - # # FileUtils.copy is an alias for FileUtils.cp. # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def cp(src, dest, preserve: nil, noop: nil, verbose: nil) fu_output_message "cp#{preserve ? ' -p' : ''} #{[src,dest].flatten.join ' '}" if verbose return if noop @@ -906,7 +924,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L924 # Raises an exception of +src+ is the path to a directory # and +dest+ is the path to a file. # - # Related: FileUtils.cp (not recursive). + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. # def cp_r(src, dest, preserve: nil, noop: nil, verbose: nil, dereference_root: true, remove_destination: nil) @@ -961,6 +979,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L979 # - <tt>preserve: true</tt> - preserves file times. # - <tt>remove_destination: true</tt> - removes +dest+ before copying files. # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false) if dereference_root src = File.realpath(src) @@ -995,6 +1015,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1015 # - <tt>preserve: true</tt> - preserves file times. # - <tt>remove_destination: true</tt> - removes +dest+ before copying files. # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def copy_file(src, dest, preserve = false, dereference = true) ent = Entry_.new(src, nil, dereference) ent.copy_file dest @@ -1005,6 +1027,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1027 # Copies \IO stream +src+ to \IO stream +dest+ via # {IO.copy_stream}[https://docs.ruby-lang.org/en/master/IO.html#method-c-copy_stream]. # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def copy_stream(src, dest) IO.copy_stream(src, dest) end @@ -1135,6 +1159,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1159 # # FileUtils.remove is an alias for FileUtils.rm. # + # Related: {methods for deleting}[rdoc-ref:FileUtils@Deleting]. + # def rm(list, force: nil, noop: nil, verbose: nil) list = fu_list(list) fu_output_message "rm#{force ? ' -f' : ''} #{list.join ' '}" if verbose @@ -1160,6 +1186,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1186 # # FileUtils.safe_unlink is an alias for FileUtils.rm_f. # + # Related: {methods for deleting}[rdoc-ref:FileUtils@Deleting]. + # def rm_f(list, noop: nil, verbose: nil) rm list, force: true, noop: noop, verbose: verbose end @@ -1416,6 +1444,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1444 # # FileUtils.identical? and FileUtils.cmp are aliases for FileUtils.compare_file. # + # Related: FileUtils.compare_stream. + # def compare_file(a, b) return false unless File.size(a) == File.size(b) File.open(a, 'rb') {|fa| @@ -1437,6 +1467,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1467 # Arguments +a+ and +b+ # should be {interpretable as a path}[rdoc-ref:FileUtils@Path+Arguments]. # + # Related: FileUtils.compare_file. + # def compare_stream(a, b) bsize = fu_stream_blksize(a, b) @@ -1514,6 +1546,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1546 # install -c src1.txt dest1.txt # install -c src2.txt dest2 # + # Related: {methods for copying}[rdoc-ref:FileUtils@Copying]. + # def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil, noop: nil, verbose: nil) if verbose @@ -1700,6 +1734,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1734 # chmod u=wrx,go=rx src1.txt # chmod u=wrx,go=rx /usr/bin/ruby # + # Related: FileUtils.chmod_R. + # def chmod(mode, list, noop: nil, verbose: nil) list = fu_list(list) fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose @@ -1791,6 +1827,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1827 # chown user2:group1 src0.txt # chown user2:group1 . # + # Related: FileUtils.chown_R. + # def chown(user, group, list, noop: nil, verbose: nil) list = fu_list(list) fu_output_message sprintf('chown %s %s', @@ -1899,6 +1937,8 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/lib/fileutils.rb#L1937 # touch src0.txt src0.dat # touch src0.txt # + # Related: FileUtils.uptodate?. + # def touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil) list = fu_list(list) t = mtime -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/