rbs 4.0.0.dev.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +14 -14
- data/.github/workflows/bundle-update.yml +60 -0
- data/.github/workflows/c-check.yml +18 -11
- data/.github/workflows/comments.yml +5 -3
- data/.github/workflows/dependabot.yml +2 -2
- data/.github/workflows/ruby.yml +27 -34
- data/.github/workflows/rust.yml +95 -0
- data/.github/workflows/typecheck.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +323 -0
- data/README.md +1 -1
- data/Rakefile +43 -33
- data/Steepfile +1 -0
- data/config.yml +426 -24
- data/core/array.rbs +307 -227
- data/core/basic_object.rbs +9 -8
- data/core/binding.rbs +0 -2
- data/core/builtin.rbs +2 -2
- data/core/class.rbs +6 -5
- data/core/comparable.rbs +55 -34
- data/core/complex.rbs +104 -78
- data/core/dir.rbs +61 -49
- data/core/encoding.rbs +12 -15
- data/core/enumerable.rbs +179 -87
- data/core/enumerator/arithmetic_sequence.rbs +70 -0
- data/core/enumerator.rbs +65 -2
- data/core/errno.rbs +11 -2
- data/core/errors.rbs +58 -29
- data/core/exception.rbs +13 -13
- data/core/fiber.rbs +74 -54
- data/core/file.rbs +280 -177
- data/core/file_test.rbs +3 -3
- data/core/float.rbs +257 -92
- data/core/gc.rbs +425 -281
- data/core/hash.rbs +1045 -739
- data/core/integer.rbs +135 -137
- data/core/io/buffer.rbs +53 -42
- data/core/io/wait.rbs +13 -35
- data/core/io.rbs +192 -144
- data/core/kernel.rbs +216 -155
- data/core/marshal.rbs +4 -4
- data/core/match_data.rbs +15 -13
- data/core/math.rbs +107 -66
- data/core/method.rbs +69 -33
- data/core/module.rbs +244 -106
- data/core/nil_class.rbs +7 -6
- data/core/numeric.rbs +74 -63
- data/core/object.rbs +9 -11
- data/core/object_space.rbs +30 -23
- data/core/pathname.rbs +1322 -0
- data/core/proc.rbs +95 -58
- data/core/process.rbs +222 -202
- data/core/ractor.rbs +371 -515
- data/core/random.rbs +21 -3
- data/core/range.rbs +159 -57
- data/core/rational.rbs +60 -89
- data/core/rbs/unnamed/argf.rbs +60 -53
- data/core/rbs/unnamed/env_class.rbs +19 -14
- data/core/rbs/unnamed/main_class.rbs +123 -0
- data/core/rbs/unnamed/random.rbs +11 -118
- data/core/regexp.rbs +258 -214
- data/core/ruby.rbs +53 -0
- data/core/ruby_vm.rbs +38 -34
- data/core/rubygems/config_file.rbs +5 -5
- data/core/rubygems/errors.rbs +4 -71
- data/core/rubygems/requirement.rbs +5 -5
- data/core/rubygems/rubygems.rbs +16 -82
- data/core/rubygems/version.rbs +2 -3
- data/core/set.rbs +490 -360
- data/core/signal.rbs +26 -16
- data/core/string.rbs +3234 -1285
- data/core/struct.rbs +27 -26
- data/core/symbol.rbs +41 -34
- data/core/thread.rbs +135 -67
- data/core/time.rbs +81 -50
- data/core/trace_point.rbs +41 -35
- data/core/true_class.rbs +2 -2
- data/core/unbound_method.rbs +24 -16
- data/core/warning.rbs +7 -7
- data/docs/aliases.md +79 -0
- data/docs/collection.md +3 -3
- data/docs/config.md +171 -0
- data/docs/encoding.md +56 -0
- data/docs/gem.md +0 -1
- data/docs/inline.md +576 -0
- data/docs/sigs.md +3 -3
- data/docs/syntax.md +46 -16
- data/docs/type_fingerprint.md +21 -0
- data/exe/rbs +1 -1
- data/ext/rbs_extension/ast_translation.c +544 -116
- data/ext/rbs_extension/ast_translation.h +3 -0
- data/ext/rbs_extension/class_constants.c +16 -2
- data/ext/rbs_extension/class_constants.h +8 -0
- data/ext/rbs_extension/extconf.rb +5 -1
- data/ext/rbs_extension/legacy_location.c +33 -56
- data/ext/rbs_extension/legacy_location.h +37 -0
- data/ext/rbs_extension/main.c +44 -35
- data/include/rbs/ast.h +448 -173
- data/include/rbs/defines.h +27 -0
- data/include/rbs/lexer.h +30 -11
- data/include/rbs/location.h +25 -44
- data/include/rbs/parser.h +6 -6
- data/include/rbs/string.h +0 -2
- data/include/rbs/util/rbs_allocator.h +34 -13
- data/include/rbs/util/rbs_assert.h +12 -1
- data/include/rbs/util/rbs_constant_pool.h +0 -3
- data/include/rbs/util/rbs_encoding.h +2 -0
- data/include/rbs/util/rbs_unescape.h +2 -1
- data/include/rbs.h +8 -0
- data/lib/rbs/ast/annotation.rb +1 -1
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/ast/declarations.rb +10 -10
- data/lib/rbs/ast/members.rb +14 -14
- data/lib/rbs/ast/ruby/annotations.rb +293 -3
- data/lib/rbs/ast/ruby/comment_block.rb +24 -0
- data/lib/rbs/ast/ruby/declarations.rb +198 -3
- data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
- data/lib/rbs/ast/ruby/members.rb +532 -22
- data/lib/rbs/ast/type_param.rb +24 -4
- data/lib/rbs/buffer.rb +20 -15
- data/lib/rbs/cli/diff.rb +16 -15
- data/lib/rbs/cli/validate.rb +38 -106
- data/lib/rbs/cli.rb +52 -19
- data/lib/rbs/collection/config/lockfile_generator.rb +14 -2
- data/lib/rbs/collection/sources/git.rb +1 -0
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
- data/lib/rbs/definition_builder/method_builder.rb +20 -0
- data/lib/rbs/definition_builder.rb +147 -25
- data/lib/rbs/diff.rb +7 -1
- data/lib/rbs/environment.rb +227 -74
- data/lib/rbs/environment_loader.rb +0 -6
- data/lib/rbs/errors.rb +27 -18
- data/lib/rbs/inline_parser.rb +342 -6
- data/lib/rbs/location_aux.rb +1 -1
- data/lib/rbs/locator.rb +5 -1
- data/lib/rbs/method_type.rb +5 -3
- data/lib/rbs/parser_aux.rb +20 -7
- data/lib/rbs/prototype/helpers.rb +57 -0
- data/lib/rbs/prototype/rb.rb +3 -28
- data/lib/rbs/prototype/rbi.rb +3 -20
- data/lib/rbs/prototype/runtime.rb +8 -0
- data/lib/rbs/resolver/constant_resolver.rb +2 -2
- data/lib/rbs/resolver/type_name_resolver.rb +116 -38
- data/lib/rbs/subtractor.rb +3 -1
- data/lib/rbs/test/type_check.rb +19 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +88 -78
- data/lib/rbs/unit_test/type_assertions.rb +35 -8
- data/lib/rbs/validator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +1 -2
- data/lib/rdoc/discover.rb +1 -1
- data/lib/rdoc_plugin/parser.rb +1 -1
- data/rbs.gemspec +4 -3
- data/rust/.gitignore +1 -0
- data/rust/Cargo.lock +378 -0
- data/rust/Cargo.toml +7 -0
- data/rust/ruby-rbs/Cargo.toml +22 -0
- data/rust/ruby-rbs/build.rs +764 -0
- data/rust/ruby-rbs/examples/locations.rs +60 -0
- data/rust/ruby-rbs/src/lib.rs +1 -0
- data/rust/ruby-rbs/src/node/mod.rs +742 -0
- data/rust/ruby-rbs/tests/sanity.rs +47 -0
- data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
- data/rust/ruby-rbs-sys/Cargo.toml +23 -0
- data/rust/ruby-rbs-sys/build.rs +204 -0
- data/rust/ruby-rbs-sys/src/lib.rs +50 -0
- data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
- data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
- data/rust/ruby-rbs-sys/wrapper.h +1 -0
- data/schema/typeParam.json +17 -1
- data/sig/ast/ruby/annotations.rbs +315 -4
- data/sig/ast/ruby/comment_block.rbs +8 -0
- data/sig/ast/ruby/declarations.rbs +102 -4
- data/sig/ast/ruby/members.rbs +108 -2
- data/sig/cli/diff.rbs +5 -11
- data/sig/cli/validate.rbs +12 -8
- data/sig/cli.rbs +18 -18
- data/sig/definition.rbs +6 -1
- data/sig/definition_builder.rbs +2 -0
- data/sig/environment.rbs +70 -12
- data/sig/errors.rbs +13 -14
- data/sig/inline_parser.rbs +39 -2
- data/sig/locator.rbs +0 -2
- data/sig/manifest.yaml +0 -1
- data/sig/method_builder.rbs +3 -1
- data/sig/parser.rbs +31 -13
- data/sig/prototype/helpers.rbs +2 -0
- data/sig/resolver/type_name_resolver.rbs +35 -7
- data/sig/source.rbs +3 -3
- data/sig/type_param.rbs +13 -8
- data/sig/types.rbs +6 -7
- data/sig/unit_test/spy.rbs +0 -8
- data/sig/unit_test/type_assertions.rbs +11 -0
- data/src/ast.c +410 -153
- data/src/lexer.c +1392 -1313
- data/src/lexer.re +3 -0
- data/src/lexstate.c +58 -37
- data/src/location.c +8 -48
- data/src/parser.c +977 -516
- data/src/string.c +0 -48
- data/src/util/rbs_allocator.c +89 -71
- data/src/util/rbs_assert.c +1 -1
- data/src/util/rbs_buffer.c +2 -2
- data/src/util/rbs_constant_pool.c +10 -14
- data/src/util/rbs_encoding.c +4 -8
- data/src/util/rbs_unescape.c +56 -20
- data/stdlib/bigdecimal/0/big_decimal.rbs +116 -98
- data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
- data/stdlib/cgi/0/core.rbs +9 -393
- data/stdlib/cgi/0/manifest.yaml +1 -0
- data/stdlib/cgi-escape/0/escape.rbs +171 -0
- data/stdlib/coverage/0/coverage.rbs +7 -4
- data/stdlib/date/0/date.rbs +92 -79
- data/stdlib/date/0/date_time.rbs +25 -24
- data/stdlib/delegate/0/delegator.rbs +10 -7
- data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
- data/stdlib/digest/0/digest.rbs +110 -0
- data/stdlib/erb/0/erb.rbs +748 -347
- data/stdlib/etc/0/etc.rbs +55 -50
- data/stdlib/fileutils/0/fileutils.rbs +158 -139
- data/stdlib/forwardable/0/forwardable.rbs +13 -10
- data/stdlib/io-console/0/io-console.rbs +2 -2
- data/stdlib/json/0/json.rbs +217 -136
- data/stdlib/monitor/0/monitor.rbs +3 -3
- data/stdlib/net-http/0/net-http.rbs +162 -134
- data/stdlib/objspace/0/objspace.rbs +17 -34
- data/stdlib/open-uri/0/open-uri.rbs +48 -8
- data/stdlib/open3/0/open3.rbs +469 -10
- data/stdlib/openssl/0/openssl.rbs +475 -357
- data/stdlib/optparse/0/optparse.rbs +26 -17
- data/stdlib/pathname/0/pathname.rbs +11 -1381
- data/stdlib/pp/0/pp.rbs +9 -8
- data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
- data/stdlib/pstore/0/pstore.rbs +35 -30
- data/stdlib/psych/0/psych.rbs +65 -12
- data/stdlib/psych/0/store.rbs +2 -4
- data/stdlib/pty/0/pty.rbs +9 -6
- data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
- data/stdlib/rdoc/0/code_object.rbs +2 -1
- data/stdlib/rdoc/0/parser.rbs +1 -1
- data/stdlib/rdoc/0/rdoc.rbs +1 -1
- data/stdlib/rdoc/0/store.rbs +1 -1
- data/stdlib/resolv/0/resolv.rbs +25 -68
- data/stdlib/ripper/0/ripper.rbs +22 -19
- data/stdlib/securerandom/0/manifest.yaml +2 -0
- data/stdlib/securerandom/0/securerandom.rbs +7 -20
- data/stdlib/shellwords/0/shellwords.rbs +2 -2
- data/stdlib/singleton/0/singleton.rbs +3 -0
- data/stdlib/socket/0/addrinfo.rbs +7 -7
- data/stdlib/socket/0/basic_socket.rbs +3 -3
- data/stdlib/socket/0/ip_socket.rbs +10 -8
- data/stdlib/socket/0/socket.rbs +23 -10
- data/stdlib/socket/0/tcp_server.rbs +1 -1
- data/stdlib/socket/0/tcp_socket.rbs +11 -3
- data/stdlib/socket/0/udp_socket.rbs +1 -1
- data/stdlib/socket/0/unix_server.rbs +1 -1
- data/stdlib/stringio/0/stringio.rbs +1177 -85
- data/stdlib/strscan/0/string_scanner.rbs +27 -25
- data/stdlib/tempfile/0/tempfile.rbs +25 -21
- data/stdlib/time/0/time.rbs +8 -6
- data/stdlib/timeout/0/timeout.rbs +63 -7
- data/stdlib/tsort/0/cyclic.rbs +3 -0
- data/stdlib/tsort/0/tsort.rbs +7 -6
- data/stdlib/uri/0/common.rbs +42 -20
- data/stdlib/uri/0/file.rbs +3 -3
- data/stdlib/uri/0/generic.rbs +26 -18
- data/stdlib/uri/0/http.rbs +2 -2
- data/stdlib/uri/0/ldap.rbs +2 -2
- data/stdlib/uri/0/mailto.rbs +3 -3
- data/stdlib/uri/0/rfc2396_parser.rbs +12 -12
- data/stdlib/zlib/0/deflate.rbs +4 -3
- data/stdlib/zlib/0/gzip_reader.rbs +6 -6
- data/stdlib/zlib/0/gzip_writer.rbs +14 -12
- data/stdlib/zlib/0/inflate.rbs +1 -1
- data/stdlib/zlib/0/need_dict.rbs +1 -1
- data/stdlib/zlib/0/zstream.rbs +1 -0
- metadata +50 -6
|
@@ -95,8 +95,10 @@
|
|
|
95
95
|
# paths to filesystem entries:
|
|
96
96
|
#
|
|
97
97
|
# * If the argument is a string, that value is the path.
|
|
98
|
-
# * If the argument has method
|
|
99
|
-
#
|
|
98
|
+
# * If the argument has method <code>:to_path</code>, it is converted via that
|
|
99
|
+
# method.
|
|
100
|
+
# * If the argument has method <code>:to_str</code>, it is converted via that
|
|
101
|
+
# method.
|
|
100
102
|
#
|
|
101
103
|
# ## About the Examples
|
|
102
104
|
#
|
|
@@ -132,7 +134,7 @@
|
|
|
132
134
|
# TOCTTOU, vulnerability that can exist when:
|
|
133
135
|
#
|
|
134
136
|
# * An ancestor directory of the entry at the target path is world writable;
|
|
135
|
-
# such directories include
|
|
137
|
+
# such directories include <code>/tmp</code>.
|
|
136
138
|
# * The directory tree at the target path includes:
|
|
137
139
|
#
|
|
138
140
|
# * A world-writable descendant directory.
|
|
@@ -146,14 +148,14 @@
|
|
|
146
148
|
# Also available are these methods, each of which calls
|
|
147
149
|
# FileUtils.remove_entry_secure:
|
|
148
150
|
#
|
|
149
|
-
# * FileUtils.rm_r with keyword argument
|
|
150
|
-
# * FileUtils.rm_rf with keyword argument
|
|
151
|
+
# * FileUtils.rm_r with keyword argument <code>secure: true</code>.
|
|
152
|
+
# * FileUtils.rm_rf with keyword argument <code>secure: true</code>.
|
|
151
153
|
#
|
|
152
154
|
# Finally, this method for moving entries calls FileUtils.remove_entry_secure if
|
|
153
155
|
# the source and destination are on different file systems (which means that the
|
|
154
156
|
# "move" is really a copy and remove):
|
|
155
157
|
#
|
|
156
|
-
# * FileUtils.mv with keyword argument
|
|
158
|
+
# * FileUtils.mv with keyword argument <code>secure: true</code>.
|
|
157
159
|
#
|
|
158
160
|
# Method FileUtils.remove_entry_secure removes securely by applying a special
|
|
159
161
|
# pre-process:
|
|
@@ -184,7 +186,8 @@ module FileUtils
|
|
|
184
186
|
|
|
185
187
|
type mode = Integer | String
|
|
186
188
|
|
|
187
|
-
|
|
189
|
+
%a{deprecated: Use top-level `path` instead}
|
|
190
|
+
type path = ::path
|
|
188
191
|
|
|
189
192
|
type pathlist = path | Array[path]
|
|
190
193
|
|
|
@@ -213,7 +216,7 @@ module FileUtils
|
|
|
213
216
|
#
|
|
214
217
|
# Keyword arguments:
|
|
215
218
|
#
|
|
216
|
-
# *
|
|
219
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
217
220
|
#
|
|
218
221
|
# FileUtils.cd('..')
|
|
219
222
|
# FileUtils.cd('fileutils')
|
|
@@ -248,7 +251,7 @@ module FileUtils
|
|
|
248
251
|
# -->
|
|
249
252
|
# Changes permissions on the entries at the paths given in `list` (a single path
|
|
250
253
|
# or an array of paths) to the permissions given by `mode`; returns `list` if it
|
|
251
|
-
# is an array,
|
|
254
|
+
# is an array, <code>[list]</code> otherwise:
|
|
252
255
|
#
|
|
253
256
|
# * Modifies each entry that is a regular file using
|
|
254
257
|
# [File.chmod](rdoc-ref:File.chmod).
|
|
@@ -267,30 +270,33 @@ module FileUtils
|
|
|
267
270
|
#
|
|
268
271
|
# * String `mode`: represents the permissions to be set:
|
|
269
272
|
#
|
|
270
|
-
# The string is of the form
|
|
273
|
+
# The string is of the form
|
|
274
|
+
# <code>[targets][[operator][perms[,perms]]</code>, where:
|
|
271
275
|
#
|
|
272
276
|
# * `targets` may be any combination of these letters:
|
|
273
277
|
#
|
|
274
|
-
# *
|
|
275
|
-
# *
|
|
276
|
-
# *
|
|
277
|
-
#
|
|
278
|
+
# * <code>'u'</code>: permissions apply to the file's owner.
|
|
279
|
+
# * <code>'g'</code>: permissions apply to users in the file's group.
|
|
280
|
+
# * <code>'o'</code>: permissions apply to other users not in the
|
|
281
|
+
# file's group.
|
|
282
|
+
# * <code>'a'</code> (the default): permissions apply to all users.
|
|
278
283
|
#
|
|
279
284
|
# * `operator` may be one of these letters:
|
|
280
285
|
#
|
|
281
|
-
# *
|
|
282
|
-
# *
|
|
283
|
-
# *
|
|
286
|
+
# * <code>'+'</code>: adds permissions.
|
|
287
|
+
# * <code>'-'</code>: removes permissions.
|
|
288
|
+
# * <code>'='</code>: sets (replaces) permissions.
|
|
284
289
|
#
|
|
285
290
|
# * `perms` (may be repeated, with separating commas) may be any
|
|
286
291
|
# combination of these letters:
|
|
287
292
|
#
|
|
288
|
-
# *
|
|
289
|
-
# *
|
|
290
|
-
# *
|
|
291
|
-
# *
|
|
292
|
-
#
|
|
293
|
-
# *
|
|
293
|
+
# * <code>'r'</code>: Read.
|
|
294
|
+
# * <code>'w'</code>: Write.
|
|
295
|
+
# * <code>'x'</code>: Execute (search, for a directory).
|
|
296
|
+
# * <code>'X'</code>: Search (for a directories only; must be used
|
|
297
|
+
# with <code>'+'</code>)
|
|
298
|
+
# * <code>'s'</code>: Uid or gid.
|
|
299
|
+
# * <code>'t'</code>: Sticky bit.
|
|
294
300
|
#
|
|
295
301
|
# Examples:
|
|
296
302
|
#
|
|
@@ -299,8 +305,8 @@ module FileUtils
|
|
|
299
305
|
#
|
|
300
306
|
# Keyword arguments:
|
|
301
307
|
#
|
|
302
|
-
# *
|
|
303
|
-
# *
|
|
308
|
+
# * <code>noop: true</code> - does not change permissions; returns `nil`.
|
|
309
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
304
310
|
#
|
|
305
311
|
# FileUtils.chmod(0755, 'src0.txt', noop: true, verbose: true)
|
|
306
312
|
# FileUtils.chmod(0644, ['src0.txt', 'src0.dat'], noop: true, verbose: true)
|
|
@@ -332,7 +338,7 @@ module FileUtils
|
|
|
332
338
|
# -->
|
|
333
339
|
# Changes the owner and group on the entries at the paths given in `list` (a
|
|
334
340
|
# single path or an array of paths) to the given `user` and `group`; returns
|
|
335
|
-
# `list` if it is an array,
|
|
341
|
+
# `list` if it is an array, <code>[list]</code> otherwise:
|
|
336
342
|
#
|
|
337
343
|
# * Modifies each entry that is a regular file using
|
|
338
344
|
# [File.chown](rdoc-ref:File.chown).
|
|
@@ -344,10 +350,10 @@ module FileUtils
|
|
|
344
350
|
#
|
|
345
351
|
# User and group:
|
|
346
352
|
#
|
|
347
|
-
# * Argument `user` may be a user name or a user id; if `nil` or
|
|
348
|
-
# user is not changed.
|
|
349
|
-
# * Argument `group` may be a group name or a group id; if `nil` or
|
|
350
|
-
# group is not changed.
|
|
353
|
+
# * Argument `user` may be a user name or a user id; if `nil` or
|
|
354
|
+
# <code>-1</code>, the user is not changed.
|
|
355
|
+
# * Argument `group` may be a group name or a group id; if `nil` or
|
|
356
|
+
# <code>-1</code>, the group is not changed.
|
|
351
357
|
# * The user must be a member of the group.
|
|
352
358
|
#
|
|
353
359
|
# Examples:
|
|
@@ -373,8 +379,8 @@ module FileUtils
|
|
|
373
379
|
#
|
|
374
380
|
# Keyword arguments:
|
|
375
381
|
#
|
|
376
|
-
# *
|
|
377
|
-
# *
|
|
382
|
+
# * <code>noop: true</code> - does not change permissions; returns `nil`.
|
|
383
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
378
384
|
#
|
|
379
385
|
# FileUtils.chown('user2', 'group1', 'src0.txt', noop: true, verbose: true)
|
|
380
386
|
# FileUtils.chown(1004, 1004, 'src0.txt', noop: true, verbose: true)
|
|
@@ -522,11 +528,13 @@ module FileUtils
|
|
|
522
528
|
# symbolic links; other file types (FIFO streams, device files, etc.) are not
|
|
523
529
|
# supported.
|
|
524
530
|
#
|
|
525
|
-
#
|
|
531
|
+
# Optional arguments:
|
|
526
532
|
#
|
|
527
|
-
# * `dereference_root
|
|
528
|
-
#
|
|
529
|
-
# * `
|
|
533
|
+
# * `dereference_root` - if `src` is a symbolic link, follows the link
|
|
534
|
+
# (`false` by default).
|
|
535
|
+
# * `preserve` - preserves file times (`false` by default).
|
|
536
|
+
# * `remove_destination` - removes `dest` before copying files (`false` by
|
|
537
|
+
# default).
|
|
530
538
|
#
|
|
531
539
|
# Related: [methods for copying](rdoc-ref:FileUtils@Copying).
|
|
532
540
|
#
|
|
@@ -547,12 +555,13 @@ module FileUtils
|
|
|
547
555
|
# FileUtils.copy_file('src0.txt', 'dest0.txt')
|
|
548
556
|
# File.file?('dest0.txt') # => true
|
|
549
557
|
#
|
|
550
|
-
#
|
|
558
|
+
# Optional arguments:
|
|
551
559
|
#
|
|
552
|
-
# * `dereference
|
|
553
|
-
#
|
|
554
|
-
# * `preserve
|
|
555
|
-
# * `remove_destination
|
|
560
|
+
# * `dereference` - if `src` is a symbolic link, follows the link (`true` by
|
|
561
|
+
# default).
|
|
562
|
+
# * `preserve` - preserves file times (`false` by default).
|
|
563
|
+
# * `remove_destination` - removes `dest` before copying files (`false` by
|
|
564
|
+
# default).
|
|
556
565
|
#
|
|
557
566
|
# Related: [methods for copying](rdoc-ref:FileUtils@Copying).
|
|
558
567
|
#
|
|
@@ -587,7 +596,7 @@ module FileUtils
|
|
|
587
596
|
# File.file?('dest0.txt') # => true
|
|
588
597
|
#
|
|
589
598
|
# If `src` is the path to a file and `dest` is the path to a directory, copies
|
|
590
|
-
# `src` to
|
|
599
|
+
# `src` to <code>dest/src</code>:
|
|
591
600
|
#
|
|
592
601
|
# FileUtils.touch('src1.txt')
|
|
593
602
|
# FileUtils.mkdir('dest1')
|
|
@@ -606,9 +615,9 @@ module FileUtils
|
|
|
606
615
|
#
|
|
607
616
|
# Keyword arguments:
|
|
608
617
|
#
|
|
609
|
-
# *
|
|
610
|
-
# *
|
|
611
|
-
# *
|
|
618
|
+
# * <code>preserve: true</code> - preserves file times.
|
|
619
|
+
# * <code>noop: true</code> - does not copy files.
|
|
620
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
612
621
|
#
|
|
613
622
|
# FileUtils.cp('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
614
623
|
# FileUtils.cp('src1.txt', 'dest1', noop: true, verbose: true)
|
|
@@ -671,8 +680,8 @@ module FileUtils
|
|
|
671
680
|
# # |-- src2.txt
|
|
672
681
|
# # `-- src3.txt
|
|
673
682
|
#
|
|
674
|
-
# If `src` and `dest` are both paths to directories, creates links
|
|
675
|
-
# and descendents pointing to `src` and its descendents:
|
|
683
|
+
# If `src` and `dest` are both paths to directories, creates links
|
|
684
|
+
# <code>dest/src</code> and descendents pointing to `src` and its descendents:
|
|
676
685
|
#
|
|
677
686
|
# tree('src1')
|
|
678
687
|
# # => src1
|
|
@@ -696,7 +705,7 @@ module FileUtils
|
|
|
696
705
|
#
|
|
697
706
|
# If `src` is an array of paths to entries and `dest` is the path to a
|
|
698
707
|
# directory, for each path `filepath` in `src`, creates a link at
|
|
699
|
-
#
|
|
708
|
+
# <code>dest/filepath</code> pointing to that path:
|
|
700
709
|
#
|
|
701
710
|
# tree('src2')
|
|
702
711
|
# # => src2
|
|
@@ -719,11 +728,12 @@ module FileUtils
|
|
|
719
728
|
#
|
|
720
729
|
# Keyword arguments:
|
|
721
730
|
#
|
|
722
|
-
# *
|
|
723
|
-
# dereference it.
|
|
724
|
-
# *
|
|
725
|
-
# *
|
|
726
|
-
#
|
|
731
|
+
# * <code>dereference_root: false</code> - if `src` is a symbolic link, does
|
|
732
|
+
# not dereference it.
|
|
733
|
+
# * <code>noop: true</code> - does not create links.
|
|
734
|
+
# * <code>remove_destination: true</code> - removes `dest` before creating
|
|
735
|
+
# links.
|
|
736
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
727
737
|
#
|
|
728
738
|
# FileUtils.cp_lr('src0', 'dest0', noop: true, verbose: true)
|
|
729
739
|
# FileUtils.cp_lr('src1', 'dest1', noop: true, verbose: true)
|
|
@@ -736,7 +746,7 @@ module FileUtils
|
|
|
736
746
|
# cp -lr src2/sub0 src2/sub1 dest2
|
|
737
747
|
#
|
|
738
748
|
# Raises an exception if `dest` is the path to an existing file or directory and
|
|
739
|
-
# keyword argument
|
|
749
|
+
# keyword argument <code>remove_destination: true</code> is not given.
|
|
740
750
|
#
|
|
741
751
|
# Related: [methods for copying](rdoc-ref:FileUtils@Copying).
|
|
742
752
|
#
|
|
@@ -763,7 +773,7 @@ module FileUtils
|
|
|
763
773
|
# File.file?('dest0.txt') # => true
|
|
764
774
|
#
|
|
765
775
|
# If `src` is the path to a file and `dest` is the path to a directory, copies
|
|
766
|
-
# `src` to
|
|
776
|
+
# `src` to <code>dest/src</code>:
|
|
767
777
|
#
|
|
768
778
|
# FileUtils.touch('src1.txt')
|
|
769
779
|
# FileUtils.mkdir('dest1')
|
|
@@ -793,7 +803,7 @@ module FileUtils
|
|
|
793
803
|
# # `-- src3.txt
|
|
794
804
|
#
|
|
795
805
|
# If `src` and `dest` are paths to directories, recursively copies `src` to
|
|
796
|
-
#
|
|
806
|
+
# <code>dest/src</code>:
|
|
797
807
|
#
|
|
798
808
|
# tree('src3')
|
|
799
809
|
# # => src3
|
|
@@ -821,12 +831,13 @@ module FileUtils
|
|
|
821
831
|
#
|
|
822
832
|
# Keyword arguments:
|
|
823
833
|
#
|
|
824
|
-
# *
|
|
825
|
-
# dereference it.
|
|
826
|
-
# *
|
|
827
|
-
# *
|
|
828
|
-
# *
|
|
829
|
-
#
|
|
834
|
+
# * <code>dereference_root: false</code> - if `src` is a symbolic link, does
|
|
835
|
+
# not dereference it.
|
|
836
|
+
# * <code>noop: true</code> - does not copy files.
|
|
837
|
+
# * <code>preserve: true</code> - preserves file times.
|
|
838
|
+
# * <code>remove_destination: true</code> - removes `dest` before copying
|
|
839
|
+
# files.
|
|
840
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
830
841
|
#
|
|
831
842
|
# FileUtils.cp_r('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
832
843
|
# FileUtils.cp_r('src1.txt', 'dest1', noop: true, verbose: true)
|
|
@@ -883,8 +894,8 @@ module FileUtils
|
|
|
883
894
|
# FileUtils.install('src1.txt', 'dest1.txt')
|
|
884
895
|
# File.read('dest1.txt') # => "aaa\n"
|
|
885
896
|
#
|
|
886
|
-
# If `dest` is a directory entry, copies from `src` to
|
|
887
|
-
# if necessary:
|
|
897
|
+
# If `dest` is a directory entry, copies from `src` to <code>dest/src</code>,
|
|
898
|
+
# overwriting if necessary:
|
|
888
899
|
#
|
|
889
900
|
# File.read('src2.txt') # => "aaa\n"
|
|
890
901
|
# File.read('dest2/src2.txt') # => "bbb\n"
|
|
@@ -892,7 +903,7 @@ module FileUtils
|
|
|
892
903
|
# File.read('dest2/src2.txt') # => "aaa\n"
|
|
893
904
|
#
|
|
894
905
|
# If `src` is an array of paths and `dest` points to a directory, copies each
|
|
895
|
-
# path `path` in `src` to
|
|
906
|
+
# path `path` in `src` to <code>dest/path</code>:
|
|
896
907
|
#
|
|
897
908
|
# File.file?('src3.txt') # => true
|
|
898
909
|
# File.file?('src3.dat') # => true
|
|
@@ -903,16 +914,16 @@ module FileUtils
|
|
|
903
914
|
#
|
|
904
915
|
# Keyword arguments:
|
|
905
916
|
#
|
|
906
|
-
# *
|
|
917
|
+
# * <code>group: <i>group</i></code> - changes the group if not `nil`, using
|
|
907
918
|
# [File.chown](rdoc-ref:File.chown).
|
|
908
|
-
# *
|
|
919
|
+
# * <code>mode: <i>permissions</i></code> - changes the permissions. using
|
|
909
920
|
# [File.chmod](rdoc-ref:File.chmod).
|
|
910
|
-
# *
|
|
911
|
-
# *
|
|
921
|
+
# * <code>noop: true</code> - does not copy entries; returns `nil`.
|
|
922
|
+
# * <code>owner: <i>owner</i></code> - changes the owner if not `nil`, using
|
|
912
923
|
# [File.chown](rdoc-ref:File.chown).
|
|
913
|
-
# *
|
|
924
|
+
# * <code>preserve: true</code> - preserve timestamps using
|
|
914
925
|
# [File.utime](rdoc-ref:File.utime).
|
|
915
|
-
# *
|
|
926
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
916
927
|
#
|
|
917
928
|
# FileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
918
929
|
# FileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true)
|
|
@@ -963,13 +974,15 @@ module FileUtils
|
|
|
963
974
|
# File.file?('dest1/dir1/t2.txt') # => true
|
|
964
975
|
# File.file?('dest1/dir1/t3.txt') # => true
|
|
965
976
|
#
|
|
966
|
-
#
|
|
977
|
+
# Optional arguments:
|
|
967
978
|
#
|
|
968
|
-
# * `dereference_root
|
|
969
|
-
#
|
|
979
|
+
# * `dereference_root` - dereferences `src` if it is a symbolic link (`false`
|
|
980
|
+
# by default).
|
|
981
|
+
# * `remove_destination` - removes `dest` before creating links (`false` by
|
|
982
|
+
# default).
|
|
970
983
|
#
|
|
971
984
|
# Raises an exception if `dest` is the path to an existing file or directory and
|
|
972
|
-
#
|
|
985
|
+
# optional argument `remove_destination` is not given.
|
|
973
986
|
#
|
|
974
987
|
# Related: FileUtils.ln (has different options).
|
|
975
988
|
#
|
|
@@ -994,8 +1007,8 @@ module FileUtils
|
|
|
994
1007
|
# Dir.children('tmp1/') # => ["t.lnk"]
|
|
995
1008
|
#
|
|
996
1009
|
# When `src` is the path to an existing file and `dest` is the path to an
|
|
997
|
-
# existing directory, creates a hard link at
|
|
998
|
-
# returns zero:
|
|
1010
|
+
# existing directory, creates a hard link at <code>dest/src</code> pointing to
|
|
1011
|
+
# `src`; returns zero:
|
|
999
1012
|
#
|
|
1000
1013
|
# Dir.children('tmp2') # => ["t.dat"]
|
|
1001
1014
|
# Dir.children('tmp3') # => []
|
|
@@ -1004,7 +1017,7 @@ module FileUtils
|
|
|
1004
1017
|
#
|
|
1005
1018
|
# When `src` is an array of paths to existing files and `dest` is the path to an
|
|
1006
1019
|
# existing directory, then for each path `target` in `src`, creates a hard link
|
|
1007
|
-
# at
|
|
1020
|
+
# at <code>dest/target</code> pointing to `target`; returns `src`:
|
|
1008
1021
|
#
|
|
1009
1022
|
# Dir.children('tmp4/') # => []
|
|
1010
1023
|
# FileUtils.ln(['tmp0/t.txt', 'tmp2/t.dat'], 'tmp4/') # => ["tmp0/t.txt", "tmp2/t.dat"]
|
|
@@ -1012,9 +1025,9 @@ module FileUtils
|
|
|
1012
1025
|
#
|
|
1013
1026
|
# Keyword arguments:
|
|
1014
1027
|
#
|
|
1015
|
-
# *
|
|
1016
|
-
# *
|
|
1017
|
-
# *
|
|
1028
|
+
# * <code>force: true</code> - overwrites `dest` if it exists.
|
|
1029
|
+
# * <code>noop: true</code> - does not create links.
|
|
1030
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1018
1031
|
#
|
|
1019
1032
|
# FileUtils.ln('tmp0/t.txt', 'tmp1/t.lnk', verbose: true)
|
|
1020
1033
|
# FileUtils.ln('tmp2/t.dat', 'tmp3', verbose: true)
|
|
@@ -1067,8 +1080,8 @@ module FileUtils
|
|
|
1067
1080
|
# File.symlink?('dest0.txt') # => true
|
|
1068
1081
|
#
|
|
1069
1082
|
# * When `dest` is the path to an existing file, creates a symbolic link at
|
|
1070
|
-
# `dest` pointing to `src` if and only if keyword argument
|
|
1071
|
-
# given (raises an exception otherwise):
|
|
1083
|
+
# `dest` pointing to `src` if and only if keyword argument <code>force:
|
|
1084
|
+
# true</code> is given (raises an exception otherwise):
|
|
1072
1085
|
#
|
|
1073
1086
|
# FileUtils.touch('src1.txt')
|
|
1074
1087
|
# FileUtils.touch('dest1.txt')
|
|
@@ -1077,8 +1090,8 @@ module FileUtils
|
|
|
1077
1090
|
#
|
|
1078
1091
|
# FileUtils.ln_s('src1.txt', 'dest1.txt') # Raises Errno::EEXIST.
|
|
1079
1092
|
#
|
|
1080
|
-
# If `dest` is the path to a directory, creates a symbolic link at
|
|
1081
|
-
# pointing to `src`:
|
|
1093
|
+
# If `dest` is the path to a directory, creates a symbolic link at
|
|
1094
|
+
# <code>dest/src</code> pointing to `src`:
|
|
1082
1095
|
#
|
|
1083
1096
|
# FileUtils.touch('src2.txt')
|
|
1084
1097
|
# FileUtils.mkdir('destdir2')
|
|
@@ -1086,8 +1099,8 @@ module FileUtils
|
|
|
1086
1099
|
# File.symlink?('destdir2/src2.txt') # => true
|
|
1087
1100
|
#
|
|
1088
1101
|
# If `src` is an array of paths to existing files and `dest` is a directory, for
|
|
1089
|
-
# each child `child` in `src` creates a symbolic link
|
|
1090
|
-
# `child`:
|
|
1102
|
+
# each child `child` in `src` creates a symbolic link <code>dest/child</code>
|
|
1103
|
+
# pointing to `child`:
|
|
1091
1104
|
#
|
|
1092
1105
|
# FileUtils.mkdir('srcdir3')
|
|
1093
1106
|
# FileUtils.touch('srcdir3/src0.txt')
|
|
@@ -1099,10 +1112,10 @@ module FileUtils
|
|
|
1099
1112
|
#
|
|
1100
1113
|
# Keyword arguments:
|
|
1101
1114
|
#
|
|
1102
|
-
# *
|
|
1103
|
-
# *
|
|
1104
|
-
# *
|
|
1105
|
-
# *
|
|
1115
|
+
# * <code>force: true</code> - overwrites `dest` if it exists.
|
|
1116
|
+
# * <code>relative: false</code> - create links relative to `dest`.
|
|
1117
|
+
# * <code>noop: true</code> - does not create links.
|
|
1118
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1106
1119
|
#
|
|
1107
1120
|
# FileUtils.ln_s('src0.txt', 'dest0.txt', noop: true, verbose: true)
|
|
1108
1121
|
# FileUtils.ln_s('src1.txt', 'destdir1', noop: true, verbose: true)
|
|
@@ -1138,7 +1151,8 @@ module FileUtils
|
|
|
1138
1151
|
# rdoc-file=lib/fileutils.rb
|
|
1139
1152
|
# - ln_sf(src, dest, noop: nil, verbose: nil)
|
|
1140
1153
|
# -->
|
|
1141
|
-
# Like FileUtils.ln_s, but always with keyword argument
|
|
1154
|
+
# Like FileUtils.ln_s, but always with keyword argument <code>force: true</code>
|
|
1155
|
+
# given.
|
|
1142
1156
|
#
|
|
1143
1157
|
def self?.ln_sf: (pathlist src, path dest, ?noop: boolish, ?verbose: boolish) -> void
|
|
1144
1158
|
|
|
@@ -1155,23 +1169,25 @@ module FileUtils
|
|
|
1155
1169
|
# - mkdir(list, mode: nil, noop: nil, verbose: nil)
|
|
1156
1170
|
# -->
|
|
1157
1171
|
# Creates directories at the paths in the given `list` (a single path or an
|
|
1158
|
-
# array of paths); returns `list` if it is an array,
|
|
1172
|
+
# array of paths); returns `list` if it is an array, <code>[list]</code>
|
|
1173
|
+
# otherwise.
|
|
1159
1174
|
#
|
|
1160
1175
|
# Argument `list` or its elements should be [interpretable as
|
|
1161
1176
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1162
1177
|
#
|
|
1163
1178
|
# With no keyword arguments, creates a directory at each `path` in `list` by
|
|
1164
|
-
# calling:
|
|
1179
|
+
# calling: <code>Dir.mkdir(path, mode)</code>; see
|
|
1180
|
+
# [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1165
1181
|
#
|
|
1166
1182
|
# FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
|
|
1167
1183
|
# FileUtils.mkdir('tmp4') # => ["tmp4"]
|
|
1168
1184
|
#
|
|
1169
1185
|
# Keyword arguments:
|
|
1170
1186
|
#
|
|
1171
|
-
# *
|
|
1172
|
-
# [File.chmod](rdoc-ref:File.chmod).
|
|
1173
|
-
# *
|
|
1174
|
-
# *
|
|
1187
|
+
# * <code>mode: <i>mode</i></code> - also calls <code>File.chmod(mode,
|
|
1188
|
+
# path)</code>; see [File.chmod](rdoc-ref:File.chmod).
|
|
1189
|
+
# * <code>noop: true</code> - does not create directories.
|
|
1190
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1175
1191
|
#
|
|
1176
1192
|
# FileUtils.mkdir(%w[tmp0 tmp1], verbose: true)
|
|
1177
1193
|
# FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)
|
|
@@ -1194,24 +1210,24 @@ module FileUtils
|
|
|
1194
1210
|
# -->
|
|
1195
1211
|
# Creates directories at the paths in the given `list` (a single path or an
|
|
1196
1212
|
# array of paths), also creating ancestor directories as needed; returns `list`
|
|
1197
|
-
# if it is an array,
|
|
1213
|
+
# if it is an array, <code>[list]</code> otherwise.
|
|
1198
1214
|
#
|
|
1199
1215
|
# Argument `list` or its elements should be [interpretable as
|
|
1200
1216
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1201
1217
|
#
|
|
1202
1218
|
# With no keyword arguments, creates a directory at each `path` in `list`, along
|
|
1203
|
-
# with any needed ancestor directories, by calling:
|
|
1204
|
-
# [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1219
|
+
# with any needed ancestor directories, by calling: <code>Dir.mkdir(path,
|
|
1220
|
+
# mode)</code>; see [Dir.mkdir](rdoc-ref:Dir.mkdir):
|
|
1205
1221
|
#
|
|
1206
1222
|
# FileUtils.mkdir_p(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
|
|
1207
1223
|
# FileUtils.mkdir_p('tmp4/tmp5') # => ["tmp4/tmp5"]
|
|
1208
1224
|
#
|
|
1209
1225
|
# Keyword arguments:
|
|
1210
1226
|
#
|
|
1211
|
-
# *
|
|
1212
|
-
# [File.chmod](rdoc-ref:File.chmod).
|
|
1213
|
-
# *
|
|
1214
|
-
# *
|
|
1227
|
+
# * <code>mode: <i>mode</i></code> - also calls <code>File.chmod(mode,
|
|
1228
|
+
# path)</code>; see [File.chmod](rdoc-ref:File.chmod).
|
|
1229
|
+
# * <code>noop: true</code> - does not create directories.
|
|
1230
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1215
1231
|
#
|
|
1216
1232
|
# FileUtils.mkdir_p(%w[tmp0 tmp1], verbose: true)
|
|
1217
1233
|
# FileUtils.mkdir_p(%w[tmp2 tmp3], mode: 0700, verbose: true)
|
|
@@ -1269,8 +1285,8 @@ module FileUtils
|
|
|
1269
1285
|
# If `src` and `dest` are on different file systems, first copies, then removes
|
|
1270
1286
|
# `src`.
|
|
1271
1287
|
#
|
|
1272
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1273
|
-
# true
|
|
1288
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1289
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1274
1290
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1275
1291
|
#
|
|
1276
1292
|
# If `src` is the path to a single file or directory and `dest` does not exist,
|
|
@@ -1307,13 +1323,13 @@ module FileUtils
|
|
|
1307
1323
|
#
|
|
1308
1324
|
# Keyword arguments:
|
|
1309
1325
|
#
|
|
1310
|
-
# *
|
|
1311
|
-
# `dest` are on different file systems), ignores raised
|
|
1312
|
-
# StandardError and its descendants.
|
|
1313
|
-
# *
|
|
1314
|
-
# *
|
|
1326
|
+
# * <code>force: true</code> - if the move includes removing `src` (that is,
|
|
1327
|
+
# if `src` and `dest` are on different file systems), ignores raised
|
|
1328
|
+
# exceptions of StandardError and its descendants.
|
|
1329
|
+
# * <code>noop: true</code> - does not move files.
|
|
1330
|
+
# * <code>secure: true</code> - removes `src` securely; see details at
|
|
1315
1331
|
# FileUtils.remove_entry_secure.
|
|
1316
|
-
# *
|
|
1332
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1317
1333
|
#
|
|
1318
1334
|
# FileUtils.mv('src0', 'dest0', noop: true, verbose: true)
|
|
1319
1335
|
# FileUtils.mv(['src1.txt', 'src1'], 'dest1', noop: true, verbose: true)
|
|
@@ -1464,7 +1480,7 @@ module FileUtils
|
|
|
1464
1480
|
# - rm(list, force: nil, noop: nil, verbose: nil)
|
|
1465
1481
|
# -->
|
|
1466
1482
|
# Removes entries at the paths in the given `list` (a single path or an array of
|
|
1467
|
-
# paths) returns `list`, if it is an array,
|
|
1483
|
+
# paths) returns `list`, if it is an array, <code>[list]</code> otherwise.
|
|
1468
1484
|
#
|
|
1469
1485
|
# Argument `list` or its elements should be [interpretable as
|
|
1470
1486
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
@@ -1476,10 +1492,10 @@ module FileUtils
|
|
|
1476
1492
|
#
|
|
1477
1493
|
# Keyword arguments:
|
|
1478
1494
|
#
|
|
1479
|
-
# *
|
|
1480
|
-
# descendants.
|
|
1481
|
-
# *
|
|
1482
|
-
# *
|
|
1495
|
+
# * <code>force: true</code> - ignores raised exceptions of StandardError and
|
|
1496
|
+
# its descendants.
|
|
1497
|
+
# * <code>noop: true</code> - does not remove files; returns `nil`.
|
|
1498
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1483
1499
|
#
|
|
1484
1500
|
# FileUtils.rm(['src0.dat', 'src0.txt'], noop: true, verbose: true)
|
|
1485
1501
|
#
|
|
@@ -1541,13 +1557,13 @@ module FileUtils
|
|
|
1541
1557
|
# - rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
|
|
1542
1558
|
# -->
|
|
1543
1559
|
# Removes entries at the paths in the given `list` (a single path or an array of
|
|
1544
|
-
# paths); returns `list`, if it is an array,
|
|
1560
|
+
# paths); returns `list`, if it is an array, <code>[list]</code> otherwise.
|
|
1545
1561
|
#
|
|
1546
1562
|
# Argument `list` or its elements should be [interpretable as
|
|
1547
1563
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1548
1564
|
#
|
|
1549
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1550
|
-
# true
|
|
1565
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1566
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1551
1567
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1552
1568
|
#
|
|
1553
1569
|
# For each file path, removes the file at that path:
|
|
@@ -1572,12 +1588,12 @@ module FileUtils
|
|
|
1572
1588
|
#
|
|
1573
1589
|
# Keyword arguments:
|
|
1574
1590
|
#
|
|
1575
|
-
# *
|
|
1576
|
-
# descendants.
|
|
1577
|
-
# *
|
|
1578
|
-
# *
|
|
1591
|
+
# * <code>force: true</code> - ignores raised exceptions of StandardError and
|
|
1592
|
+
# its descendants.
|
|
1593
|
+
# * <code>noop: true</code> - does not remove entries; returns `nil`.
|
|
1594
|
+
# * <code>secure: true</code> - removes `src` securely; see details at
|
|
1579
1595
|
# FileUtils.remove_entry_secure.
|
|
1580
|
-
# *
|
|
1596
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1581
1597
|
#
|
|
1582
1598
|
# FileUtils.rm_r(['src0.dat', 'src0.txt'], noop: true, verbose: true)
|
|
1583
1599
|
# FileUtils.rm_r('src1', noop: true, verbose: true)
|
|
@@ -1602,8 +1618,8 @@ module FileUtils
|
|
|
1602
1618
|
# Argument `list` or its elements should be [interpretable as
|
|
1603
1619
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1604
1620
|
#
|
|
1605
|
-
# May cause a local vulnerability if not called with keyword argument
|
|
1606
|
-
# true
|
|
1621
|
+
# May cause a local vulnerability if not called with keyword argument
|
|
1622
|
+
# <code>secure: true</code>; see [Avoiding the TOCTTOU
|
|
1607
1623
|
# Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
|
|
1608
1624
|
#
|
|
1609
1625
|
# See FileUtils.rm_r for keyword arguments.
|
|
@@ -1631,22 +1647,24 @@ module FileUtils
|
|
|
1631
1647
|
# - rmdir(list, parents: nil, noop: nil, verbose: nil)
|
|
1632
1648
|
# -->
|
|
1633
1649
|
# Removes directories at the paths in the given `list` (a single path or an
|
|
1634
|
-
# array of paths); returns `list`, if it is an array,
|
|
1650
|
+
# array of paths); returns `list`, if it is an array, <code>[list]</code>
|
|
1651
|
+
# otherwise.
|
|
1635
1652
|
#
|
|
1636
1653
|
# Argument `list` or its elements should be [interpretable as
|
|
1637
1654
|
# paths](rdoc-ref:FileUtils@Path+Arguments).
|
|
1638
1655
|
#
|
|
1639
1656
|
# With no keyword arguments, removes the directory at each `path` in `list`, by
|
|
1640
|
-
# calling:
|
|
1657
|
+
# calling: <code>Dir.rmdir(path)</code>; see [Dir.rmdir](rdoc-ref:Dir.rmdir):
|
|
1641
1658
|
#
|
|
1642
1659
|
# FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
|
|
1643
1660
|
# FileUtils.rmdir('tmp4/tmp5') # => ["tmp4/tmp5"]
|
|
1644
1661
|
#
|
|
1645
1662
|
# Keyword arguments:
|
|
1646
1663
|
#
|
|
1647
|
-
# *
|
|
1648
|
-
#
|
|
1649
|
-
# *
|
|
1664
|
+
# * <code>parents: true</code> - removes successive ancestor directories if
|
|
1665
|
+
# empty.
|
|
1666
|
+
# * <code>noop: true</code> - does not remove directories.
|
|
1667
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1650
1668
|
#
|
|
1651
1669
|
# FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3], parents: true, verbose: true)
|
|
1652
1670
|
# FileUtils.rmdir('tmp4/tmp5', parents: true, verbose: true)
|
|
@@ -1669,7 +1687,7 @@ module FileUtils
|
|
|
1669
1687
|
# -->
|
|
1670
1688
|
# Updates modification times (mtime) and access times (atime) of the entries
|
|
1671
1689
|
# given by the paths in `list` (a single path or an array of paths); returns
|
|
1672
|
-
# `list` if it is an array,
|
|
1690
|
+
# `list` if it is an array, <code>[list]</code> otherwise.
|
|
1673
1691
|
#
|
|
1674
1692
|
# By default, creates an empty file for any path to a non-existent entry; use
|
|
1675
1693
|
# keyword argument `nocreate` to raise an exception instead.
|
|
@@ -1693,11 +1711,12 @@ module FileUtils
|
|
|
1693
1711
|
#
|
|
1694
1712
|
# Keyword arguments:
|
|
1695
1713
|
#
|
|
1696
|
-
# *
|
|
1697
|
-
# current time.
|
|
1698
|
-
# *
|
|
1699
|
-
#
|
|
1700
|
-
# *
|
|
1714
|
+
# * <code>mtime: <i>time</i></code> - sets the entry's mtime to the given
|
|
1715
|
+
# time, instead of the current time.
|
|
1716
|
+
# * <code>nocreate: true</code> - raises an exception if the entry does not
|
|
1717
|
+
# exist.
|
|
1718
|
+
# * <code>noop: true</code> - does not touch entries; returns `nil`.
|
|
1719
|
+
# * <code>verbose: true</code> - prints an equivalent command:
|
|
1701
1720
|
#
|
|
1702
1721
|
# FileUtils.touch('src0.txt', noop: true, verbose: true)
|
|
1703
1722
|
# FileUtils.touch(['src0.txt', 'src0.dat'], noop: true, verbose: true)
|