rbs 4.1.0.pre.2-java

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.
Files changed (574) hide show
  1. checksums.yaml +7 -0
  2. data/.clang-format +75 -0
  3. data/.clangd +2 -0
  4. data/.github/dependabot.yml +24 -0
  5. data/.github/workflows/bundle-update.yml +63 -0
  6. data/.github/workflows/c-check.yml +61 -0
  7. data/.github/workflows/comments.yml +37 -0
  8. data/.github/workflows/dependabot.yml +30 -0
  9. data/.github/workflows/jruby.yml +67 -0
  10. data/.github/workflows/milestone.yml +83 -0
  11. data/.github/workflows/ruby.yml +158 -0
  12. data/.github/workflows/rust.yml +184 -0
  13. data/.github/workflows/truffleruby.yml +54 -0
  14. data/.github/workflows/typecheck.yml +39 -0
  15. data/.github/workflows/wasm.yml +53 -0
  16. data/.github/workflows/windows.yml +49 -0
  17. data/.gitignore +38 -0
  18. data/.rubocop.yml +72 -0
  19. data/BSDL +22 -0
  20. data/CHANGELOG.md +2292 -0
  21. data/COPYING +56 -0
  22. data/README.md +240 -0
  23. data/Rakefile +869 -0
  24. data/Steepfile +53 -0
  25. data/config.yml +913 -0
  26. data/core/array.rbs +4142 -0
  27. data/core/basic_object.rbs +376 -0
  28. data/core/binding.rbs +148 -0
  29. data/core/builtin.rbs +278 -0
  30. data/core/class.rbs +223 -0
  31. data/core/comparable.rbs +192 -0
  32. data/core/complex.rbs +812 -0
  33. data/core/constants.rbs +96 -0
  34. data/core/data.rbs +415 -0
  35. data/core/dir.rbs +993 -0
  36. data/core/encoding.rbs +1368 -0
  37. data/core/enumerable.rbs +2506 -0
  38. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  39. data/core/enumerator/product.rbs +92 -0
  40. data/core/enumerator.rbs +705 -0
  41. data/core/env.rbs +6 -0
  42. data/core/errno.rbs +682 -0
  43. data/core/errors.rbs +789 -0
  44. data/core/exception.rbs +485 -0
  45. data/core/false_class.rbs +82 -0
  46. data/core/fiber.rbs +570 -0
  47. data/core/fiber_error.rbs +11 -0
  48. data/core/file.rbs +2045 -0
  49. data/core/file_constants.rbs +463 -0
  50. data/core/file_stat.rbs +534 -0
  51. data/core/file_test.rbs +331 -0
  52. data/core/float.rbs +1316 -0
  53. data/core/gc.rbs +788 -0
  54. data/core/global_variables.rbs +184 -0
  55. data/core/hash.rbs +2183 -0
  56. data/core/integer.rbs +1374 -0
  57. data/core/io/buffer.rbs +995 -0
  58. data/core/io/wait.rbs +48 -0
  59. data/core/io.rbs +3472 -0
  60. data/core/kernel.rbs +3172 -0
  61. data/core/marshal.rbs +207 -0
  62. data/core/match_data.rbs +637 -0
  63. data/core/math.rbs +770 -0
  64. data/core/method.rbs +422 -0
  65. data/core/module.rbs +1856 -0
  66. data/core/nil_class.rbs +210 -0
  67. data/core/numeric.rbs +832 -0
  68. data/core/object.rbs +108 -0
  69. data/core/object_space/weak_key_map.rbs +166 -0
  70. data/core/object_space.rbs +197 -0
  71. data/core/pathname.rbs +1322 -0
  72. data/core/proc.rbs +905 -0
  73. data/core/process.rbs +2316 -0
  74. data/core/ractor.rbs +924 -0
  75. data/core/random.rbs +255 -0
  76. data/core/range.rbs +1209 -0
  77. data/core/rational.rbs +502 -0
  78. data/core/rb_config.rbs +88 -0
  79. data/core/rbs/ops.rbs +154 -0
  80. data/core/rbs/unnamed/argf.rbs +1236 -0
  81. data/core/rbs/unnamed/env_class.rbs +1214 -0
  82. data/core/rbs/unnamed/main_class.rbs +123 -0
  83. data/core/rbs/unnamed/random.rbs +186 -0
  84. data/core/refinement.rbs +59 -0
  85. data/core/regexp.rbs +1974 -0
  86. data/core/ruby.rbs +53 -0
  87. data/core/ruby_vm.rbs +809 -0
  88. data/core/rubygems/basic_specification.rbs +6 -0
  89. data/core/rubygems/config_file.rbs +38 -0
  90. data/core/rubygems/dependency_installer.rbs +6 -0
  91. data/core/rubygems/errors.rbs +109 -0
  92. data/core/rubygems/installer.rbs +15 -0
  93. data/core/rubygems/path_support.rbs +6 -0
  94. data/core/rubygems/platform.rbs +7 -0
  95. data/core/rubygems/request_set.rbs +49 -0
  96. data/core/rubygems/requirement.rbs +148 -0
  97. data/core/rubygems/rubygems.rbs +1105 -0
  98. data/core/rubygems/source_list.rbs +15 -0
  99. data/core/rubygems/specification.rbs +23 -0
  100. data/core/rubygems/stream_ui.rbs +5 -0
  101. data/core/rubygems/uninstaller.rbs +10 -0
  102. data/core/rubygems/version.rbs +293 -0
  103. data/core/set.rbs +751 -0
  104. data/core/signal.rbs +110 -0
  105. data/core/string.rbs +5532 -0
  106. data/core/struct.rbs +668 -0
  107. data/core/symbol.rbs +482 -0
  108. data/core/thread.rbs +1826 -0
  109. data/core/thread_group.rbs +79 -0
  110. data/core/time.rbs +1793 -0
  111. data/core/trace_point.rbs +483 -0
  112. data/core/true_class.rbs +98 -0
  113. data/core/unbound_method.rbs +337 -0
  114. data/core/warning.rbs +87 -0
  115. data/docs/CONTRIBUTING.md +107 -0
  116. data/docs/aliases.md +79 -0
  117. data/docs/architecture.md +110 -0
  118. data/docs/collection.md +192 -0
  119. data/docs/config.md +171 -0
  120. data/docs/data_and_struct.md +86 -0
  121. data/docs/encoding.md +56 -0
  122. data/docs/gem.md +56 -0
  123. data/docs/inline.md +634 -0
  124. data/docs/rbs_by_example.md +309 -0
  125. data/docs/repo.md +125 -0
  126. data/docs/rust.md +96 -0
  127. data/docs/sigs.md +167 -0
  128. data/docs/stdlib.md +147 -0
  129. data/docs/syntax.md +940 -0
  130. data/docs/tools.md +17 -0
  131. data/docs/type_fingerprint.md +21 -0
  132. data/docs/wasm_serialization.md +80 -0
  133. data/exe/rbs +7 -0
  134. data/ext/rbs_extension/ast_translation.c +1855 -0
  135. data/ext/rbs_extension/ast_translation.h +41 -0
  136. data/ext/rbs_extension/class_constants.c +187 -0
  137. data/ext/rbs_extension/class_constants.h +104 -0
  138. data/ext/rbs_extension/compat.h +10 -0
  139. data/ext/rbs_extension/extconf.rb +40 -0
  140. data/ext/rbs_extension/legacy_location.c +294 -0
  141. data/ext/rbs_extension/legacy_location.h +82 -0
  142. data/ext/rbs_extension/main.c +613 -0
  143. data/ext/rbs_extension/rbs_extension.h +16 -0
  144. data/ext/rbs_extension/rbs_string_bridging.c +9 -0
  145. data/ext/rbs_extension/rbs_string_bridging.h +24 -0
  146. data/goodcheck.yml +91 -0
  147. data/include/rbs/ast.h +1047 -0
  148. data/include/rbs/defines.h +99 -0
  149. data/include/rbs/lexer.h +207 -0
  150. data/include/rbs/location.h +40 -0
  151. data/include/rbs/parser.h +153 -0
  152. data/include/rbs/serialize.h +39 -0
  153. data/include/rbs/string.h +47 -0
  154. data/include/rbs/util/rbs_allocator.h +59 -0
  155. data/include/rbs/util/rbs_assert.h +20 -0
  156. data/include/rbs/util/rbs_buffer.h +83 -0
  157. data/include/rbs/util/rbs_constant_pool.h +155 -0
  158. data/include/rbs/util/rbs_encoding.h +282 -0
  159. data/include/rbs/util/rbs_unescape.h +24 -0
  160. data/include/rbs.h +14 -0
  161. data/lib/rbs/ancestor_graph.rb +92 -0
  162. data/lib/rbs/annotate/annotations.rb +199 -0
  163. data/lib/rbs/annotate/formatter.rb +82 -0
  164. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  165. data/lib/rbs/annotate/rdoc_source.rb +131 -0
  166. data/lib/rbs/annotate.rb +8 -0
  167. data/lib/rbs/ast/annotation.rb +29 -0
  168. data/lib/rbs/ast/comment.rb +29 -0
  169. data/lib/rbs/ast/declarations.rb +472 -0
  170. data/lib/rbs/ast/directives.rb +49 -0
  171. data/lib/rbs/ast/members.rb +451 -0
  172. data/lib/rbs/ast/ruby/annotations.rb +451 -0
  173. data/lib/rbs/ast/ruby/comment_block.rb +247 -0
  174. data/lib/rbs/ast/ruby/declarations.rb +291 -0
  175. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  176. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  177. data/lib/rbs/ast/ruby/members.rb +762 -0
  178. data/lib/rbs/ast/type_param.rb +235 -0
  179. data/lib/rbs/ast/visitor.rb +137 -0
  180. data/lib/rbs/buffer.rb +189 -0
  181. data/lib/rbs/builtin_names.rb +58 -0
  182. data/lib/rbs/cli/colored_io.rb +48 -0
  183. data/lib/rbs/cli/diff.rb +84 -0
  184. data/lib/rbs/cli/validate.rb +294 -0
  185. data/lib/rbs/cli.rb +1253 -0
  186. data/lib/rbs/collection/cleaner.rb +38 -0
  187. data/lib/rbs/collection/config/lockfile.rb +92 -0
  188. data/lib/rbs/collection/config/lockfile_generator.rb +269 -0
  189. data/lib/rbs/collection/config.rb +81 -0
  190. data/lib/rbs/collection/installer.rb +32 -0
  191. data/lib/rbs/collection/sources/base.rb +14 -0
  192. data/lib/rbs/collection/sources/git.rb +265 -0
  193. data/lib/rbs/collection/sources/local.rb +81 -0
  194. data/lib/rbs/collection/sources/rubygems.rb +48 -0
  195. data/lib/rbs/collection/sources/stdlib.rb +50 -0
  196. data/lib/rbs/collection/sources.rb +38 -0
  197. data/lib/rbs/collection.rb +16 -0
  198. data/lib/rbs/constant.rb +28 -0
  199. data/lib/rbs/definition.rb +415 -0
  200. data/lib/rbs/definition_builder/ancestor_builder.rb +678 -0
  201. data/lib/rbs/definition_builder/method_builder.rb +295 -0
  202. data/lib/rbs/definition_builder.rb +1054 -0
  203. data/lib/rbs/diff.rb +131 -0
  204. data/lib/rbs/environment/class_entry.rb +69 -0
  205. data/lib/rbs/environment/module_entry.rb +66 -0
  206. data/lib/rbs/environment/use_map.rb +77 -0
  207. data/lib/rbs/environment.rb +1028 -0
  208. data/lib/rbs/environment_loader.rb +167 -0
  209. data/lib/rbs/environment_walker.rb +155 -0
  210. data/lib/rbs/errors.rb +634 -0
  211. data/lib/rbs/factory.rb +18 -0
  212. data/lib/rbs/file_finder.rb +28 -0
  213. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  214. data/lib/rbs/inline_parser.rb +568 -0
  215. data/lib/rbs/location_aux.rb +170 -0
  216. data/lib/rbs/locator.rb +247 -0
  217. data/lib/rbs/method_type.rb +145 -0
  218. data/lib/rbs/namespace.rb +154 -0
  219. data/lib/rbs/parser/lex_result.rb +15 -0
  220. data/lib/rbs/parser/token.rb +23 -0
  221. data/lib/rbs/parser_aux.rb +142 -0
  222. data/lib/rbs/prototype/helpers.rb +197 -0
  223. data/lib/rbs/prototype/node_usage.rb +99 -0
  224. data/lib/rbs/prototype/rb.rb +816 -0
  225. data/lib/rbs/prototype/rbi.rb +625 -0
  226. data/lib/rbs/prototype/runtime/helpers.rb +59 -0
  227. data/lib/rbs/prototype/runtime/reflection.rb +19 -0
  228. data/lib/rbs/prototype/runtime/value_object_generator.rb +279 -0
  229. data/lib/rbs/prototype/runtime.rb +680 -0
  230. data/lib/rbs/repository.rb +127 -0
  231. data/lib/rbs/resolver/constant_resolver.rb +219 -0
  232. data/lib/rbs/resolver/type_name_resolver.rb +167 -0
  233. data/lib/rbs/rewriter.rb +70 -0
  234. data/lib/rbs/sorter.rb +198 -0
  235. data/lib/rbs/source.rb +99 -0
  236. data/lib/rbs/substitution.rb +83 -0
  237. data/lib/rbs/subtractor.rb +204 -0
  238. data/lib/rbs/test/errors.rb +80 -0
  239. data/lib/rbs/test/guaranteed.rb +30 -0
  240. data/lib/rbs/test/hook.rb +212 -0
  241. data/lib/rbs/test/observer.rb +19 -0
  242. data/lib/rbs/test/setup.rb +84 -0
  243. data/lib/rbs/test/setup_helper.rb +50 -0
  244. data/lib/rbs/test/tester.rb +167 -0
  245. data/lib/rbs/test/type_check.rb +457 -0
  246. data/lib/rbs/test.rb +112 -0
  247. data/lib/rbs/type_alias_dependency.rb +100 -0
  248. data/lib/rbs/type_alias_regularity.rb +126 -0
  249. data/lib/rbs/type_name.rb +122 -0
  250. data/lib/rbs/types.rb +1604 -0
  251. data/lib/rbs/unit_test/convertibles.rb +177 -0
  252. data/lib/rbs/unit_test/spy.rb +138 -0
  253. data/lib/rbs/unit_test/type_assertions.rb +383 -0
  254. data/lib/rbs/unit_test/with_aliases.rb +145 -0
  255. data/lib/rbs/unit_test.rb +6 -0
  256. data/lib/rbs/validator.rb +186 -0
  257. data/lib/rbs/variance_calculator.rb +189 -0
  258. data/lib/rbs/vendorer.rb +71 -0
  259. data/lib/rbs/version.rb +5 -0
  260. data/lib/rbs/wasm/deserializer.rb +213 -0
  261. data/lib/rbs/wasm/jars/asm-analysis.jar +0 -0
  262. data/lib/rbs/wasm/jars/asm-commons.jar +0 -0
  263. data/lib/rbs/wasm/jars/asm-tree.jar +0 -0
  264. data/lib/rbs/wasm/jars/asm-util.jar +0 -0
  265. data/lib/rbs/wasm/jars/asm.jar +0 -0
  266. data/lib/rbs/wasm/jars/compiler.jar +0 -0
  267. data/lib/rbs/wasm/jars/log.jar +0 -0
  268. data/lib/rbs/wasm/jars/runtime.jar +0 -0
  269. data/lib/rbs/wasm/jars/wasi.jar +0 -0
  270. data/lib/rbs/wasm/jars/wasm.jar +0 -0
  271. data/lib/rbs/wasm/location.rb +61 -0
  272. data/lib/rbs/wasm/parser.rb +137 -0
  273. data/lib/rbs/wasm/rbs_parser.wasm +0 -0
  274. data/lib/rbs/wasm/runtime.rb +217 -0
  275. data/lib/rbs/wasm/serialization_schema.rb +110 -0
  276. data/lib/rbs/writer.rb +424 -0
  277. data/lib/rbs.rb +117 -0
  278. data/lib/rdoc/discover.rb +20 -0
  279. data/lib/rdoc_plugin/parser.rb +163 -0
  280. data/rbs.gemspec +68 -0
  281. data/schema/annotation.json +14 -0
  282. data/schema/comment.json +26 -0
  283. data/schema/decls.json +326 -0
  284. data/schema/function.json +87 -0
  285. data/schema/location.json +56 -0
  286. data/schema/members.json +266 -0
  287. data/schema/methodType.json +50 -0
  288. data/schema/typeParam.json +52 -0
  289. data/schema/types.json +317 -0
  290. data/sig/ancestor_builder.rbs +163 -0
  291. data/sig/ancestor_graph.rbs +60 -0
  292. data/sig/annotate/annotations.rbs +102 -0
  293. data/sig/annotate/formatter.rbs +24 -0
  294. data/sig/annotate/rdoc_annotater.rbs +85 -0
  295. data/sig/annotate/rdoc_source.rbs +32 -0
  296. data/sig/annotation.rbs +27 -0
  297. data/sig/ast/ruby/annotations.rbs +470 -0
  298. data/sig/ast/ruby/comment_block.rbs +127 -0
  299. data/sig/ast/ruby/declarations.rbs +158 -0
  300. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  301. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  302. data/sig/ast/ruby/members.rbs +198 -0
  303. data/sig/buffer.rbs +108 -0
  304. data/sig/builtin_names.rbs +44 -0
  305. data/sig/cli/colored_io.rbs +15 -0
  306. data/sig/cli/diff.rbs +15 -0
  307. data/sig/cli/validate.rbs +47 -0
  308. data/sig/cli.rbs +89 -0
  309. data/sig/collection/cleaner.rbs +13 -0
  310. data/sig/collection/config/lockfile.rbs +74 -0
  311. data/sig/collection/config/lockfile_generator.rbs +68 -0
  312. data/sig/collection/config.rbs +46 -0
  313. data/sig/collection/installer.rbs +17 -0
  314. data/sig/collection/sources.rbs +214 -0
  315. data/sig/collection.rbs +4 -0
  316. data/sig/comment.rbs +26 -0
  317. data/sig/constant.rbs +21 -0
  318. data/sig/declarations.rbs +274 -0
  319. data/sig/definition.rbs +232 -0
  320. data/sig/definition_builder.rbs +181 -0
  321. data/sig/diff.rbs +28 -0
  322. data/sig/directives.rbs +77 -0
  323. data/sig/environment/class_entry.rbs +50 -0
  324. data/sig/environment/module_entry.rbs +50 -0
  325. data/sig/environment.rbs +286 -0
  326. data/sig/environment_loader.rbs +111 -0
  327. data/sig/environment_walker.rbs +65 -0
  328. data/sig/errors.rbs +408 -0
  329. data/sig/factory.rbs +5 -0
  330. data/sig/file_finder.rbs +28 -0
  331. data/sig/inline_parser/comment_association.rbs +71 -0
  332. data/sig/inline_parser.rbs +126 -0
  333. data/sig/location.rbs +135 -0
  334. data/sig/locator.rbs +56 -0
  335. data/sig/manifest.yaml +5 -0
  336. data/sig/members.rbs +258 -0
  337. data/sig/method_builder.rbs +89 -0
  338. data/sig/method_types.rbs +58 -0
  339. data/sig/namespace.rbs +161 -0
  340. data/sig/parser.rbs +164 -0
  341. data/sig/prototype/helpers.rbs +29 -0
  342. data/sig/prototype/node_usage.rbs +20 -0
  343. data/sig/prototype/rb.rbs +96 -0
  344. data/sig/prototype/rbi.rbs +75 -0
  345. data/sig/prototype/runtime.rbs +182 -0
  346. data/sig/rbs.rbs +21 -0
  347. data/sig/rdoc/rbs.rbs +67 -0
  348. data/sig/repository.rbs +85 -0
  349. data/sig/resolver/constant_resolver.rbs +92 -0
  350. data/sig/resolver/context.rbs +34 -0
  351. data/sig/resolver/type_name_resolver.rbs +61 -0
  352. data/sig/rewriter.rbs +45 -0
  353. data/sig/shims/bundler.rbs +38 -0
  354. data/sig/shims/enumerable.rbs +5 -0
  355. data/sig/shims/rubygems.rbs +19 -0
  356. data/sig/sorter.rbs +41 -0
  357. data/sig/source.rbs +48 -0
  358. data/sig/substitution.rbs +48 -0
  359. data/sig/subtractor.rbs +37 -0
  360. data/sig/test/errors.rbs +52 -0
  361. data/sig/test/guranteed.rbs +9 -0
  362. data/sig/test/type_check.rbs +19 -0
  363. data/sig/test.rbs +82 -0
  364. data/sig/type_alias_dependency.rbs +53 -0
  365. data/sig/type_alias_regularity.rbs +98 -0
  366. data/sig/type_param.rbs +115 -0
  367. data/sig/typename.rbs +89 -0
  368. data/sig/types.rbs +578 -0
  369. data/sig/unit_test/convertibles.rbs +154 -0
  370. data/sig/unit_test/spy.rbs +22 -0
  371. data/sig/unit_test/type_assertions.rbs +211 -0
  372. data/sig/unit_test/with_aliases.rbs +136 -0
  373. data/sig/use_map.rbs +35 -0
  374. data/sig/util.rbs +9 -0
  375. data/sig/validator.rbs +63 -0
  376. data/sig/variance_calculator.rbs +87 -0
  377. data/sig/vendorer.rbs +51 -0
  378. data/sig/version.rbs +3 -0
  379. data/sig/visitor.rbs +47 -0
  380. data/sig/wasm/deserializer.rbs +66 -0
  381. data/sig/wasm/serialization_schema.rbs +13 -0
  382. data/sig/writer.rbs +127 -0
  383. data/src/ast.c +1628 -0
  384. data/src/lexer.c +3217 -0
  385. data/src/lexer.re +155 -0
  386. data/src/lexstate.c +217 -0
  387. data/src/location.c +31 -0
  388. data/src/parser.c +4255 -0
  389. data/src/serialize.c +958 -0
  390. data/src/string.c +41 -0
  391. data/src/util/rbs_allocator.c +162 -0
  392. data/src/util/rbs_assert.c +19 -0
  393. data/src/util/rbs_buffer.c +54 -0
  394. data/src/util/rbs_constant_pool.c +268 -0
  395. data/src/util/rbs_encoding.c +21308 -0
  396. data/src/util/rbs_unescape.c +167 -0
  397. data/stdlib/abbrev/0/abbrev.rbs +66 -0
  398. data/stdlib/abbrev/0/array.rbs +26 -0
  399. data/stdlib/base64/0/base64.rbs +355 -0
  400. data/stdlib/benchmark/0/benchmark.rbs +452 -0
  401. data/stdlib/bigdecimal/0/big_decimal.rbs +1647 -0
  402. data/stdlib/bigdecimal-math/0/big_math.rbs +280 -0
  403. data/stdlib/bigdecimal-math/0/manifest.yaml +2 -0
  404. data/stdlib/cgi/0/core.rbs +911 -0
  405. data/stdlib/cgi/0/manifest.yaml +4 -0
  406. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  407. data/stdlib/coverage/0/coverage.rbs +266 -0
  408. data/stdlib/csv/0/csv.rbs +3776 -0
  409. data/stdlib/csv/0/manifest.yaml +3 -0
  410. data/stdlib/date/0/date.rbs +1598 -0
  411. data/stdlib/date/0/date_time.rbs +617 -0
  412. data/stdlib/date/0/time.rbs +26 -0
  413. data/stdlib/dbm/0/dbm.rbs +421 -0
  414. data/stdlib/delegate/0/delegator.rbs +187 -0
  415. data/stdlib/delegate/0/kernel.rbs +47 -0
  416. data/stdlib/delegate/0/simple_delegator.rbs +96 -0
  417. data/stdlib/did_you_mean/0/did_you_mean.rbs +344 -0
  418. data/stdlib/digest/0/digest.rbs +687 -0
  419. data/stdlib/erb/0/erb.rbs +933 -0
  420. data/stdlib/etc/0/etc.rbs +884 -0
  421. data/stdlib/fileutils/0/fileutils.rbs +1753 -0
  422. data/stdlib/find/0/find.rbs +49 -0
  423. data/stdlib/forwardable/0/forwardable.rbs +271 -0
  424. data/stdlib/io-console/0/io-console.rbs +414 -0
  425. data/stdlib/ipaddr/0/ipaddr.rbs +436 -0
  426. data/stdlib/json/0/json.rbs +1963 -0
  427. data/stdlib/kconv/0/kconv.rbs +166 -0
  428. data/stdlib/logger/0/formatter.rbs +45 -0
  429. data/stdlib/logger/0/log_device.rbs +100 -0
  430. data/stdlib/logger/0/logger.rbs +796 -0
  431. data/stdlib/logger/0/manifest.yaml +2 -0
  432. data/stdlib/logger/0/period.rbs +17 -0
  433. data/stdlib/logger/0/severity.rbs +34 -0
  434. data/stdlib/minitest/0/kernel.rbs +42 -0
  435. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +52 -0
  436. data/stdlib/minitest/0/minitest/assertion.rbs +17 -0
  437. data/stdlib/minitest/0/minitest/assertions.rbs +590 -0
  438. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +23 -0
  439. data/stdlib/minitest/0/minitest/bench_spec.rbs +102 -0
  440. data/stdlib/minitest/0/minitest/benchmark.rbs +259 -0
  441. data/stdlib/minitest/0/minitest/composite_reporter.rbs +25 -0
  442. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  443. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  444. data/stdlib/minitest/0/minitest/expectation.rbs +2 -0
  445. data/stdlib/minitest/0/minitest/expectations.rbs +21 -0
  446. data/stdlib/minitest/0/minitest/guard.rbs +64 -0
  447. data/stdlib/minitest/0/minitest/mock.rbs +64 -0
  448. data/stdlib/minitest/0/minitest/parallel/executor.rbs +46 -0
  449. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +5 -0
  450. data/stdlib/minitest/0/minitest/parallel/test.rbs +3 -0
  451. data/stdlib/minitest/0/minitest/parallel.rbs +2 -0
  452. data/stdlib/minitest/0/minitest/pride_io.rbs +62 -0
  453. data/stdlib/minitest/0/minitest/pride_lol.rbs +19 -0
  454. data/stdlib/minitest/0/minitest/progress_reporter.rbs +11 -0
  455. data/stdlib/minitest/0/minitest/reportable.rbs +53 -0
  456. data/stdlib/minitest/0/minitest/reporter.rbs +5 -0
  457. data/stdlib/minitest/0/minitest/result.rbs +28 -0
  458. data/stdlib/minitest/0/minitest/runnable.rbs +163 -0
  459. data/stdlib/minitest/0/minitest/skip.rbs +6 -0
  460. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +48 -0
  461. data/stdlib/minitest/0/minitest/spec/dsl.rbs +129 -0
  462. data/stdlib/minitest/0/minitest/spec.rbs +11 -0
  463. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +81 -0
  464. data/stdlib/minitest/0/minitest/summary_reporter.rbs +18 -0
  465. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +92 -0
  466. data/stdlib/minitest/0/minitest/test.rbs +69 -0
  467. data/stdlib/minitest/0/minitest/unexpected_error.rbs +12 -0
  468. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  469. data/stdlib/minitest/0/minitest/unit/test_case.rbs +3 -0
  470. data/stdlib/minitest/0/minitest/unit.rbs +4 -0
  471. data/stdlib/minitest/0/minitest.rbs +115 -0
  472. data/stdlib/monitor/0/monitor.rbs +363 -0
  473. data/stdlib/mutex_m/0/mutex_m.rbs +104 -0
  474. data/stdlib/net-http/0/manifest.yaml +3 -0
  475. data/stdlib/net-http/0/net-http.rbs +5580 -0
  476. data/stdlib/net-protocol/0/manifest.yaml +2 -0
  477. data/stdlib/net-protocol/0/net-protocol.rbs +56 -0
  478. data/stdlib/net-smtp/0/manifest.yaml +2 -0
  479. data/stdlib/net-smtp/0/net-smtp.rbs +55 -0
  480. data/stdlib/nkf/0/nkf.rbs +402 -0
  481. data/stdlib/objspace/0/objspace.rbs +470 -0
  482. data/stdlib/observable/0/observable.rbs +217 -0
  483. data/stdlib/open-uri/0/manifest.yaml +4 -0
  484. data/stdlib/open-uri/0/open-uri.rbs +433 -0
  485. data/stdlib/open3/0/open3.rbs +606 -0
  486. data/stdlib/openssl/0/manifest.yaml +3 -0
  487. data/stdlib/openssl/0/openssl.rbs +12231 -0
  488. data/stdlib/optparse/0/optparse.rbs +1734 -0
  489. data/stdlib/pathname/0/pathname.rbs +36 -0
  490. data/stdlib/pp/0/manifest.yaml +2 -0
  491. data/stdlib/pp/0/pp.rbs +301 -0
  492. data/stdlib/prettyprint/0/prettyprint.rbs +383 -0
  493. data/stdlib/pstore/0/pstore.rbs +608 -0
  494. data/stdlib/psych/0/core_ext.rbs +12 -0
  495. data/stdlib/psych/0/dbm.rbs +237 -0
  496. data/stdlib/psych/0/manifest.yaml +3 -0
  497. data/stdlib/psych/0/psych.rbs +455 -0
  498. data/stdlib/psych/0/store.rbs +57 -0
  499. data/stdlib/pty/0/pty.rbs +240 -0
  500. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  501. data/stdlib/rdoc/0/code_object.rbs +52 -0
  502. data/stdlib/rdoc/0/comment.rbs +61 -0
  503. data/stdlib/rdoc/0/context.rbs +153 -0
  504. data/stdlib/rdoc/0/markup.rbs +117 -0
  505. data/stdlib/rdoc/0/options.rbs +76 -0
  506. data/stdlib/rdoc/0/parser.rbs +56 -0
  507. data/stdlib/rdoc/0/rdoc.rbs +393 -0
  508. data/stdlib/rdoc/0/ri.rbs +17 -0
  509. data/stdlib/rdoc/0/store.rbs +48 -0
  510. data/stdlib/rdoc/0/top_level.rbs +97 -0
  511. data/stdlib/resolv/0/manifest.yaml +3 -0
  512. data/stdlib/resolv/0/resolv.rbs +1787 -0
  513. data/stdlib/ripper/0/ripper.rbs +1654 -0
  514. data/stdlib/securerandom/0/manifest.yaml +2 -0
  515. data/stdlib/securerandom/0/securerandom.rbs +49 -0
  516. data/stdlib/shellwords/0/shellwords.rbs +229 -0
  517. data/stdlib/singleton/0/singleton.rbs +134 -0
  518. data/stdlib/socket/0/addrinfo.rbs +666 -0
  519. data/stdlib/socket/0/basic_socket.rbs +590 -0
  520. data/stdlib/socket/0/constants.rbs +2295 -0
  521. data/stdlib/socket/0/ip_socket.rbs +94 -0
  522. data/stdlib/socket/0/socket.rbs +4170 -0
  523. data/stdlib/socket/0/socket_error.rbs +5 -0
  524. data/stdlib/socket/0/tcp_server.rbs +192 -0
  525. data/stdlib/socket/0/tcp_socket.rbs +87 -0
  526. data/stdlib/socket/0/udp_socket.rbs +133 -0
  527. data/stdlib/socket/0/unix_server.rbs +169 -0
  528. data/stdlib/socket/0/unix_socket.rbs +172 -0
  529. data/stdlib/stringio/0/stringio.rbs +1681 -0
  530. data/stdlib/strscan/0/string_scanner.rbs +1648 -0
  531. data/stdlib/tempfile/0/tempfile.rbs +483 -0
  532. data/stdlib/time/0/time.rbs +434 -0
  533. data/stdlib/timeout/0/timeout.rbs +137 -0
  534. data/stdlib/tmpdir/0/tmpdir.rbs +69 -0
  535. data/stdlib/tsort/0/cyclic.rbs +8 -0
  536. data/stdlib/tsort/0/interfaces.rbs +20 -0
  537. data/stdlib/tsort/0/tsort.rbs +410 -0
  538. data/stdlib/uri/0/common.rbs +621 -0
  539. data/stdlib/uri/0/file.rbs +118 -0
  540. data/stdlib/uri/0/ftp.rbs +13 -0
  541. data/stdlib/uri/0/generic.rbs +1116 -0
  542. data/stdlib/uri/0/http.rbs +104 -0
  543. data/stdlib/uri/0/https.rbs +14 -0
  544. data/stdlib/uri/0/ldap.rbs +230 -0
  545. data/stdlib/uri/0/ldaps.rbs +14 -0
  546. data/stdlib/uri/0/mailto.rbs +92 -0
  547. data/stdlib/uri/0/rfc2396_parser.rbs +189 -0
  548. data/stdlib/uri/0/rfc3986_parser.rbs +2 -0
  549. data/stdlib/uri/0/ws.rbs +13 -0
  550. data/stdlib/uri/0/wss.rbs +9 -0
  551. data/stdlib/yaml/0/manifest.yaml +2 -0
  552. data/stdlib/yaml/0/yaml.rbs +1 -0
  553. data/stdlib/zlib/0/buf_error.rbs +10 -0
  554. data/stdlib/zlib/0/data_error.rbs +10 -0
  555. data/stdlib/zlib/0/deflate.rbs +211 -0
  556. data/stdlib/zlib/0/error.rbs +20 -0
  557. data/stdlib/zlib/0/gzip_file/crc_error.rbs +12 -0
  558. data/stdlib/zlib/0/gzip_file/error.rbs +23 -0
  559. data/stdlib/zlib/0/gzip_file/length_error.rbs +12 -0
  560. data/stdlib/zlib/0/gzip_file/no_footer.rbs +11 -0
  561. data/stdlib/zlib/0/gzip_file.rbs +156 -0
  562. data/stdlib/zlib/0/gzip_reader.rbs +293 -0
  563. data/stdlib/zlib/0/gzip_writer.rbs +168 -0
  564. data/stdlib/zlib/0/inflate.rbs +180 -0
  565. data/stdlib/zlib/0/mem_error.rbs +10 -0
  566. data/stdlib/zlib/0/need_dict.rbs +13 -0
  567. data/stdlib/zlib/0/stream_end.rbs +11 -0
  568. data/stdlib/zlib/0/stream_error.rbs +11 -0
  569. data/stdlib/zlib/0/version_error.rbs +11 -0
  570. data/stdlib/zlib/0/zlib.rbs +449 -0
  571. data/stdlib/zlib/0/zstream.rbs +201 -0
  572. data/wasm/README.md +59 -0
  573. data/wasm/rbs_wasm.c +411 -0
  574. metadata +660 -0
@@ -0,0 +1,1753 @@
1
+ # <!-- rdoc-file=lib/fileutils.rb -->
2
+ # Namespace for file utility methods for copying, moving, removing, etc.
3
+ #
4
+ # ## What's Here
5
+ #
6
+ # First, what’s elsewhere. Module FileUtils:
7
+ #
8
+ # * Inherits from [class Object](rdoc-ref:Object).
9
+ # * Supplements [class File](rdoc-ref:File) (but is not included or extended
10
+ # there).
11
+ #
12
+ # Here, module FileUtils provides methods that are useful for:
13
+ #
14
+ # * [Creating](rdoc-ref:FileUtils@Creating).
15
+ # * [Deleting](rdoc-ref:FileUtils@Deleting).
16
+ # * [Querying](rdoc-ref:FileUtils@Querying).
17
+ # * [Setting](rdoc-ref:FileUtils@Setting).
18
+ # * [Comparing](rdoc-ref:FileUtils@Comparing).
19
+ # * [Copying](rdoc-ref:FileUtils@Copying).
20
+ # * [Moving](rdoc-ref:FileUtils@Moving).
21
+ # * [Options](rdoc-ref:FileUtils@Options).
22
+ #
23
+ # ### Creating
24
+ #
25
+ # * ::mkdir: Creates directories.
26
+ # * ::mkdir_p, ::makedirs, ::mkpath: Creates directories, also creating
27
+ # ancestor directories as needed.
28
+ # * ::link_entry: Creates a hard link.
29
+ # * ::ln, ::link: Creates hard links.
30
+ # * ::ln_s, ::symlink: Creates symbolic links.
31
+ # * ::ln_sf: Creates symbolic links, overwriting if necessary.
32
+ # * ::ln_sr: Creates symbolic links relative to targets
33
+ #
34
+ # ### Deleting
35
+ #
36
+ # * ::remove_dir: Removes a directory and its descendants.
37
+ # * ::remove_entry: Removes an entry, including its descendants if it is a
38
+ # directory.
39
+ # * ::remove_entry_secure: Like ::remove_entry, but removes securely.
40
+ # * ::remove_file: Removes a file entry.
41
+ # * ::rm, ::remove: Removes entries.
42
+ # * ::rm_f, ::safe_unlink: Like ::rm, but removes forcibly.
43
+ # * ::rm_r: Removes entries and their descendants.
44
+ # * ::rm_rf, ::rmtree: Like ::rm_r, but removes forcibly.
45
+ # * ::rmdir: Removes directories.
46
+ #
47
+ # ### Querying
48
+ #
49
+ # * ::pwd, ::getwd: Returns the path to the working directory.
50
+ # * ::uptodate?: Returns whether a given entry is newer than given other
51
+ # entries.
52
+ #
53
+ # ### Setting
54
+ #
55
+ # * ::cd, ::chdir: Sets the working directory.
56
+ # * ::chmod: Sets permissions for an entry.
57
+ # * ::chmod_R: Sets permissions for an entry and its descendants.
58
+ # * ::chown: Sets the owner and group for entries.
59
+ # * ::chown_R: Sets the owner and group for entries and their descendants.
60
+ # * ::touch: Sets modification and access times for entries, creating if
61
+ # necessary.
62
+ #
63
+ # ### Comparing
64
+ #
65
+ # * ::compare_file, ::cmp, ::identical?: Returns whether two entries are
66
+ # identical.
67
+ # * ::compare_stream: Returns whether two streams are identical.
68
+ #
69
+ # ### Copying
70
+ #
71
+ # * ::copy_entry: Recursively copies an entry.
72
+ # * ::copy_file: Copies an entry.
73
+ # * ::copy_stream: Copies a stream.
74
+ # * ::cp, ::copy: Copies files.
75
+ # * ::cp_lr: Recursively creates hard links.
76
+ # * ::cp_r: Recursively copies files, retaining mode, owner, and group.
77
+ # * ::install: Recursively copies files, optionally setting mode, owner, and
78
+ # group.
79
+ #
80
+ # ### Moving
81
+ #
82
+ # * ::mv, ::move: Moves entries.
83
+ #
84
+ # ### Options
85
+ #
86
+ # * ::collect_method: Returns the names of methods that accept a given option.
87
+ # * ::commands: Returns the names of methods that accept options.
88
+ # * ::have_option?: Returns whether a given method accepts a given option.
89
+ # * ::options: Returns all option names.
90
+ # * ::options_of: Returns the names of the options for a given method.
91
+ #
92
+ # ## Path Arguments
93
+ #
94
+ # Some methods in FileUtils accept *path* arguments, which are interpreted as
95
+ # paths to filesystem entries:
96
+ #
97
+ # * If the argument is a string, that value is the path.
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.
102
+ #
103
+ # ## About the Examples
104
+ #
105
+ # Some examples here involve trees of file entries. For these, we sometimes
106
+ # display trees using the [tree command-line
107
+ # utility](https://en.wikipedia.org/wiki/Tree_(command)), which is a recursive
108
+ # directory-listing utility that produces a depth-indented listing of files and
109
+ # directories.
110
+ #
111
+ # We use a helper method to launch the command and control the format:
112
+ #
113
+ # def tree(dirpath = '.')
114
+ # command = "tree --noreport --charset=ascii #{dirpath}"
115
+ # system(command)
116
+ # end
117
+ #
118
+ # To illustrate:
119
+ #
120
+ # tree('src0')
121
+ # # => src0
122
+ # # |-- sub0
123
+ # # | |-- src0.txt
124
+ # # | `-- src1.txt
125
+ # # `-- sub1
126
+ # # |-- src2.txt
127
+ # # `-- src3.txt
128
+ #
129
+ # ## Avoiding the TOCTTOU Vulnerability
130
+ #
131
+ # For certain methods that recursively remove entries, there is a potential
132
+ # vulnerability called the [Time-of-check to
133
+ # time-of-use](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use), or
134
+ # TOCTTOU, vulnerability that can exist when:
135
+ #
136
+ # * An ancestor directory of the entry at the target path is world writable;
137
+ # such directories include <code>/tmp</code>.
138
+ # * The directory tree at the target path includes:
139
+ #
140
+ # * A world-writable descendant directory.
141
+ # * A symbolic link.
142
+ #
143
+ # To avoid that vulnerability, you can use this method to remove entries:
144
+ #
145
+ # * FileUtils.remove_entry_secure: removes recursively if the target path
146
+ # points to a directory.
147
+ #
148
+ # Also available are these methods, each of which calls
149
+ # FileUtils.remove_entry_secure:
150
+ #
151
+ # * FileUtils.rm_r with keyword argument <code>secure: true</code>.
152
+ # * FileUtils.rm_rf with keyword argument <code>secure: true</code>.
153
+ #
154
+ # Finally, this method for moving entries calls FileUtils.remove_entry_secure if
155
+ # the source and destination are on different file systems (which means that the
156
+ # "move" is really a copy and remove):
157
+ #
158
+ # * FileUtils.mv with keyword argument <code>secure: true</code>.
159
+ #
160
+ # Method FileUtils.remove_entry_secure removes securely by applying a special
161
+ # pre-process:
162
+ #
163
+ # * If the target path points to a directory, this method uses methods
164
+ # [File#chown](rdoc-ref:File#chown) and [File#chmod](rdoc-ref:File#chmod) in
165
+ # removing directories.
166
+ # * The owner of the target directory should be either the current process or
167
+ # the super user (root).
168
+ #
169
+ # WARNING: You must ensure that **ALL** parent directories cannot be moved by
170
+ # other untrusted users. For example, parent directories should not be owned by
171
+ # untrusted users, and should not be world writable except when the sticky bit
172
+ # is set.
173
+ #
174
+ # For details of this security vulnerability, see Perl cases:
175
+ #
176
+ # * [CVE-2005-0448](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-04
177
+ # 48).
178
+ # * [CVE-2004-0452](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-04
179
+ # 52).
180
+ #
181
+ module FileUtils
182
+ # <!-- rdoc-file=lib/fileutils.rb -->
183
+ # The version number.
184
+ #
185
+ VERSION: String
186
+
187
+ type mode = Integer | String
188
+
189
+ %a{deprecated: Use top-level `path` instead}
190
+ type path = ::path
191
+
192
+ type pathlist = ::path | Array[::path]
193
+
194
+ # <!--
195
+ # rdoc-file=lib/fileutils.rb
196
+ # - cd(dir, verbose: nil) { |dir| ... }
197
+ # -->
198
+ # Changes the working directory to the given `dir`, which should be
199
+ # [interpretable as a path](rdoc-ref:FileUtils@Path+Arguments):
200
+ #
201
+ # With no block given, changes the current directory to the directory at `dir`;
202
+ # returns zero:
203
+ #
204
+ # FileUtils.pwd # => "/rdoc/fileutils"
205
+ # FileUtils.cd('..')
206
+ # FileUtils.pwd # => "/rdoc"
207
+ # FileUtils.cd('fileutils')
208
+ #
209
+ # With a block given, changes the current directory to the directory at `dir`,
210
+ # calls the block with argument `dir`, and restores the original current
211
+ # directory; returns the block's value:
212
+ #
213
+ # FileUtils.pwd # => "/rdoc/fileutils"
214
+ # FileUtils.cd('..') { |arg| [arg, FileUtils.pwd] } # => ["..", "/rdoc"]
215
+ # FileUtils.pwd # => "/rdoc/fileutils"
216
+ #
217
+ # Keyword arguments:
218
+ #
219
+ # * <code>verbose: true</code> - prints an equivalent command:
220
+ #
221
+ # FileUtils.cd('..')
222
+ # FileUtils.cd('fileutils')
223
+ #
224
+ # Output:
225
+ #
226
+ # cd ..
227
+ # cd fileutils
228
+ #
229
+ # Related: FileUtils.pwd.
230
+ #
231
+ def self?.cd: (::path dir, ?verbose: boolish) -> void
232
+ | [X] (::path dir, ?verbose: boolish) { (String) -> X } -> X
233
+
234
+ # <!--
235
+ # rdoc-file=lib/fileutils.rb
236
+ # - chdir(dir, verbose: nil)
237
+ # -->
238
+ #
239
+ alias self.chdir self.cd
240
+
241
+ # <!--
242
+ # rdoc-file=lib/fileutils.rb
243
+ # - chdir(dir, verbose: nil)
244
+ # -->
245
+ #
246
+ alias chdir cd
247
+
248
+ # <!--
249
+ # rdoc-file=lib/fileutils.rb
250
+ # - chmod(mode, list, noop: nil, verbose: nil)
251
+ # -->
252
+ # Changes permissions on the entries at the paths given in `list` (a single path
253
+ # or an array of paths) to the permissions given by `mode`; returns `list` if it
254
+ # is an array, <code>[list]</code> otherwise:
255
+ #
256
+ # * Modifies each entry that is a regular file using
257
+ # [File.chmod](rdoc-ref:File.chmod).
258
+ # * Modifies each entry that is a symbolic link using
259
+ # [File.lchmod](rdoc-ref:File.lchmod).
260
+ #
261
+ # Argument `list` or its elements should be [interpretable as
262
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
263
+ #
264
+ # Argument `mode` may be either an integer or a string:
265
+ #
266
+ # * Integer `mode`: represents the permission bits to be set:
267
+ #
268
+ # FileUtils.chmod(0755, 'src0.txt')
269
+ # FileUtils.chmod(0644, ['src0.txt', 'src0.dat'])
270
+ #
271
+ # * String `mode`: represents the permissions to be set:
272
+ #
273
+ # The string is of the form
274
+ # <code>[targets][[operator][perms[,perms]]</code>, where:
275
+ #
276
+ # * `targets` may be any combination of these letters:
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.
283
+ #
284
+ # * `operator` may be one of these letters:
285
+ #
286
+ # * <code>'+'</code>: adds permissions.
287
+ # * <code>'-'</code>: removes permissions.
288
+ # * <code>'='</code>: sets (replaces) permissions.
289
+ #
290
+ # * `perms` (may be repeated, with separating commas) may be any
291
+ # combination of these letters:
292
+ #
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.
300
+ #
301
+ # Examples:
302
+ #
303
+ # FileUtils.chmod('u=wrx,go=rx', 'src1.txt')
304
+ # FileUtils.chmod('u=wrx,go=rx', '/usr/bin/ruby')
305
+ #
306
+ # Keyword arguments:
307
+ #
308
+ # * <code>noop: true</code> - does not change permissions; returns `nil`.
309
+ # * <code>verbose: true</code> - prints an equivalent command:
310
+ #
311
+ # FileUtils.chmod(0755, 'src0.txt', noop: true, verbose: true)
312
+ # FileUtils.chmod(0644, ['src0.txt', 'src0.dat'], noop: true, verbose: true)
313
+ # FileUtils.chmod('u=wrx,go=rx', 'src1.txt', noop: true, verbose: true)
314
+ # FileUtils.chmod('u=wrx,go=rx', '/usr/bin/ruby', noop: true, verbose: true)
315
+ #
316
+ # Output:
317
+ #
318
+ # chmod 755 src0.txt
319
+ # chmod 644 src0.txt src0.dat
320
+ # chmod u=wrx,go=rx src1.txt
321
+ # chmod u=wrx,go=rx /usr/bin/ruby
322
+ #
323
+ # Related: FileUtils.chmod_R.
324
+ #
325
+ def self?.chmod: (mode mode, pathlist list, ?noop: boolish, ?verbose: boolish) -> void
326
+
327
+ # <!--
328
+ # rdoc-file=lib/fileutils.rb
329
+ # - chmod_R(mode, list, noop: nil, verbose: nil, force: nil)
330
+ # -->
331
+ # Like FileUtils.chmod, but changes permissions recursively.
332
+ #
333
+ def self?.chmod_R: (mode mode, pathlist list, ?noop: boolish, ?verbose: boolish, ?force: boolish) -> void
334
+
335
+ # <!--
336
+ # rdoc-file=lib/fileutils.rb
337
+ # - chown(user, group, list, noop: nil, verbose: nil)
338
+ # -->
339
+ # Changes the owner and group on the entries at the paths given in `list` (a
340
+ # single path or an array of paths) to the given `user` and `group`; returns
341
+ # `list` if it is an array, <code>[list]</code> otherwise:
342
+ #
343
+ # * Modifies each entry that is a regular file using
344
+ # [File.chown](rdoc-ref:File.chown).
345
+ # * Modifies each entry that is a symbolic link using
346
+ # [File.lchown](rdoc-ref:File.lchown).
347
+ #
348
+ # Argument `list` or its elements should be [interpretable as
349
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
350
+ #
351
+ # User and group:
352
+ #
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.
357
+ # * The user must be a member of the group.
358
+ #
359
+ # Examples:
360
+ #
361
+ # # One path.
362
+ # # User and group as string names.
363
+ # File.stat('src0.txt').uid # => 1004
364
+ # File.stat('src0.txt').gid # => 1004
365
+ # FileUtils.chown('user2', 'group1', 'src0.txt')
366
+ # File.stat('src0.txt').uid # => 1006
367
+ # File.stat('src0.txt').gid # => 1005
368
+ #
369
+ # # User and group as uid and gid.
370
+ # FileUtils.chown(1004, 1004, 'src0.txt')
371
+ # File.stat('src0.txt').uid # => 1004
372
+ # File.stat('src0.txt').gid # => 1004
373
+ #
374
+ # # Array of paths.
375
+ # FileUtils.chown(1006, 1005, ['src0.txt', 'src0.dat'])
376
+ #
377
+ # # Directory (not recursive).
378
+ # FileUtils.chown('user2', 'group1', '.')
379
+ #
380
+ # Keyword arguments:
381
+ #
382
+ # * <code>noop: true</code> - does not change permissions; returns `nil`.
383
+ # * <code>verbose: true</code> - prints an equivalent command:
384
+ #
385
+ # FileUtils.chown('user2', 'group1', 'src0.txt', noop: true, verbose: true)
386
+ # FileUtils.chown(1004, 1004, 'src0.txt', noop: true, verbose: true)
387
+ # FileUtils.chown(1006, 1005, ['src0.txt', 'src0.dat'], noop: true, verbose: true)
388
+ # FileUtils.chown('user2', 'group1', path, noop: true, verbose: true)
389
+ # FileUtils.chown('user2', 'group1', '.', noop: true, verbose: true)
390
+ #
391
+ # Output:
392
+ #
393
+ # chown user2:group1 src0.txt
394
+ # chown 1004:1004 src0.txt
395
+ # chown 1006:1005 src0.txt src0.dat
396
+ # chown user2:group1 src0.txt
397
+ # chown user2:group1 .
398
+ #
399
+ # Related: FileUtils.chown_R.
400
+ #
401
+ def self?.chown: (String? user, String? group, pathlist list, ?noop: boolish, ?verbose: boolish) -> void
402
+
403
+ # <!--
404
+ # rdoc-file=lib/fileutils.rb
405
+ # - chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
406
+ # -->
407
+ # Like FileUtils.chown, but changes owner and group recursively.
408
+ #
409
+ def self?.chown_R: (String? user, String? group, pathlist list, ?noop: boolish, ?verbose: boolish, ?force: boolish) -> void
410
+
411
+ # <!--
412
+ # rdoc-file=lib/fileutils.rb
413
+ # - collect_method(opt)
414
+ # -->
415
+ # Returns an array of the string method names of the methods that accept the
416
+ # given keyword option `opt`; the argument must be a symbol:
417
+ #
418
+ # FileUtils.collect_method(:preserve) # => ["cp", "copy", "cp_r", "install"]
419
+ #
420
+ def self.collect_method: (Symbol opt) -> Array[String]
421
+
422
+ # <!--
423
+ # rdoc-file=lib/fileutils.rb
424
+ # - commands()
425
+ # -->
426
+ # Returns an array of the string names of FileUtils methods that accept one or
427
+ # more keyword arguments:
428
+ #
429
+ # FileUtils.commands.sort.take(3) # => ["cd", "chdir", "chmod"]
430
+ #
431
+ def self.commands: () -> Array[String]
432
+
433
+ # <!--
434
+ # rdoc-file=lib/fileutils.rb
435
+ # - compare_file(a, b)
436
+ # -->
437
+ # Returns `true` if the contents of files `a` and `b` are identical, `false`
438
+ # otherwise.
439
+ #
440
+ # Arguments `a` and `b` should be [interpretable as a
441
+ # path](rdoc-ref:FileUtils@Path+Arguments).
442
+ #
443
+ # FileUtils.identical? and FileUtils.cmp are aliases for FileUtils.compare_file.
444
+ #
445
+ # Related: FileUtils.compare_stream.
446
+ #
447
+ def self?.compare_file: (::path a, ::path b) -> bool
448
+
449
+ # <!--
450
+ # rdoc-file=lib/fileutils.rb
451
+ # - cmp(a, b)
452
+ # -->
453
+ #
454
+ alias self.cmp self.compare_file
455
+
456
+ # <!--
457
+ # rdoc-file=lib/fileutils.rb
458
+ # - cmp(a, b)
459
+ # -->
460
+ #
461
+ alias cmp compare_file
462
+
463
+ # <!--
464
+ # rdoc-file=lib/fileutils.rb
465
+ # - identical?(a, b)
466
+ # -->
467
+ #
468
+ alias self.identical? self.compare_file
469
+
470
+ # <!--
471
+ # rdoc-file=lib/fileutils.rb
472
+ # - identical?(a, b)
473
+ # -->
474
+ #
475
+ alias identical? compare_file
476
+
477
+ # <!--
478
+ # rdoc-file=lib/fileutils.rb
479
+ # - compare_stream(a, b)
480
+ # -->
481
+ # Returns `true` if the contents of streams `a` and `b` are identical, `false`
482
+ # otherwise.
483
+ #
484
+ # Arguments `a` and `b` should be [interpretable as a
485
+ # path](rdoc-ref:FileUtils@Path+Arguments).
486
+ #
487
+ # Related: FileUtils.compare_file.
488
+ #
489
+ def self?.compare_stream: (IO a, IO b) -> bool
490
+
491
+ # <!--
492
+ # rdoc-file=lib/fileutils.rb
493
+ # - copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
494
+ # -->
495
+ # Recursively copies files from `src` to `dest`.
496
+ #
497
+ # Arguments `src` and `dest` should be [interpretable as
498
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
499
+ #
500
+ # If `src` is the path to a file, copies `src` to `dest`:
501
+ #
502
+ # FileUtils.touch('src0.txt')
503
+ # File.exist?('dest0.txt') # => false
504
+ # FileUtils.copy_entry('src0.txt', 'dest0.txt')
505
+ # File.file?('dest0.txt') # => true
506
+ #
507
+ # If `src` is a directory, recursively copies `src` to `dest`:
508
+ #
509
+ # tree('src1')
510
+ # # => src1
511
+ # # |-- dir0
512
+ # # | |-- src0.txt
513
+ # # | `-- src1.txt
514
+ # # `-- dir1
515
+ # # |-- src2.txt
516
+ # # `-- src3.txt
517
+ # FileUtils.copy_entry('src1', 'dest1')
518
+ # tree('dest1')
519
+ # # => dest1
520
+ # # |-- dir0
521
+ # # | |-- src0.txt
522
+ # # | `-- src1.txt
523
+ # # `-- dir1
524
+ # # |-- src2.txt
525
+ # # `-- src3.txt
526
+ #
527
+ # The recursive copying preserves file types for regular files, directories, and
528
+ # symbolic links; other file types (FIFO streams, device files, etc.) are not
529
+ # supported.
530
+ #
531
+ # Optional arguments:
532
+ #
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).
538
+ #
539
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
540
+ #
541
+ def self?.copy_entry: (::path src, ::path dest, ?boolish preserve, ?boolish dereference_root, ?boolish remove_destination) -> void
542
+
543
+ # <!--
544
+ # rdoc-file=lib/fileutils.rb
545
+ # - copy_file(src, dest, preserve = false, dereference = true)
546
+ # -->
547
+ # Copies file from `src` to `dest`, which should not be directories.
548
+ #
549
+ # Arguments `src` and `dest` should be [interpretable as
550
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
551
+ #
552
+ # Examples:
553
+ #
554
+ # FileUtils.touch('src0.txt')
555
+ # FileUtils.copy_file('src0.txt', 'dest0.txt')
556
+ # File.file?('dest0.txt') # => true
557
+ #
558
+ # Optional arguments:
559
+ #
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).
565
+ #
566
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
567
+ #
568
+ def self?.copy_file: (::path src, ::path dest, ?boolish preserve, ?boolish dereference) -> void
569
+
570
+ # <!--
571
+ # rdoc-file=lib/fileutils.rb
572
+ # - copy_stream(src, dest)
573
+ # -->
574
+ # Copies IO stream `src` to IO stream `dest` via
575
+ # [IO.copy_stream](rdoc-ref:IO.copy_stream).
576
+ #
577
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
578
+ #
579
+ def self?.copy_stream: (_Reader src, _Writer dest) -> void
580
+
581
+ # <!--
582
+ # rdoc-file=lib/fileutils.rb
583
+ # - cp(src, dest, preserve: nil, noop: nil, verbose: nil)
584
+ # -->
585
+ # Copies files.
586
+ #
587
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
588
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
589
+ #
590
+ # If `src` is the path to a file and `dest` is not the path to a directory,
591
+ # copies `src` to `dest`:
592
+ #
593
+ # FileUtils.touch('src0.txt')
594
+ # File.exist?('dest0.txt') # => false
595
+ # FileUtils.cp('src0.txt', 'dest0.txt')
596
+ # File.file?('dest0.txt') # => true
597
+ #
598
+ # If `src` is the path to a file and `dest` is the path to a directory, copies
599
+ # `src` to <code>dest/src</code>:
600
+ #
601
+ # FileUtils.touch('src1.txt')
602
+ # FileUtils.mkdir('dest1')
603
+ # FileUtils.cp('src1.txt', 'dest1')
604
+ # File.file?('dest1/src1.txt') # => true
605
+ #
606
+ # If `src` is an array of paths to files and `dest` is the path to a directory,
607
+ # copies from each `src` to `dest`:
608
+ #
609
+ # src_file_paths = ['src2.txt', 'src2.dat']
610
+ # FileUtils.touch(src_file_paths)
611
+ # FileUtils.mkdir('dest2')
612
+ # FileUtils.cp(src_file_paths, 'dest2')
613
+ # File.file?('dest2/src2.txt') # => true
614
+ # File.file?('dest2/src2.dat') # => true
615
+ #
616
+ # Keyword arguments:
617
+ #
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:
621
+ #
622
+ # FileUtils.cp('src0.txt', 'dest0.txt', noop: true, verbose: true)
623
+ # FileUtils.cp('src1.txt', 'dest1', noop: true, verbose: true)
624
+ # FileUtils.cp(src_file_paths, 'dest2', noop: true, verbose: true)
625
+ #
626
+ # Output:
627
+ #
628
+ # cp src0.txt dest0.txt
629
+ # cp src1.txt dest1
630
+ # cp src2.txt src2.dat dest2
631
+ #
632
+ # Raises an exception if `src` is a directory.
633
+ #
634
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
635
+ #
636
+ def self?.cp: (pathlist src, ::path dest, ?preserve: boolish, ?noop: boolish, ?verbose: boolish) -> void
637
+
638
+ # <!--
639
+ # rdoc-file=lib/fileutils.rb
640
+ # - copy(src, dest, preserve: nil, noop: nil, verbose: nil)
641
+ # -->
642
+ #
643
+ alias self.copy self.cp
644
+
645
+ # <!--
646
+ # rdoc-file=lib/fileutils.rb
647
+ # - copy(src, dest, preserve: nil, noop: nil, verbose: nil)
648
+ # -->
649
+ #
650
+ alias copy cp
651
+
652
+ # <!--
653
+ # rdoc-file=lib/fileutils.rb
654
+ # - cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false)
655
+ # -->
656
+ # Creates [hard links](https://en.wikipedia.org/wiki/Hard_link).
657
+ #
658
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
659
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
660
+ #
661
+ # If `src` is the path to a directory and `dest` does not exist, creates links
662
+ # `dest` and descendents pointing to `src` and its descendents:
663
+ #
664
+ # tree('src0')
665
+ # # => src0
666
+ # # |-- sub0
667
+ # # | |-- src0.txt
668
+ # # | `-- src1.txt
669
+ # # `-- sub1
670
+ # # |-- src2.txt
671
+ # # `-- src3.txt
672
+ # File.exist?('dest0') # => false
673
+ # FileUtils.cp_lr('src0', 'dest0')
674
+ # tree('dest0')
675
+ # # => dest0
676
+ # # |-- sub0
677
+ # # | |-- src0.txt
678
+ # # | `-- src1.txt
679
+ # # `-- sub1
680
+ # # |-- src2.txt
681
+ # # `-- src3.txt
682
+ #
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:
685
+ #
686
+ # tree('src1')
687
+ # # => src1
688
+ # # |-- sub0
689
+ # # | |-- src0.txt
690
+ # # | `-- src1.txt
691
+ # # `-- sub1
692
+ # # |-- src2.txt
693
+ # # `-- src3.txt
694
+ # FileUtils.mkdir('dest1')
695
+ # FileUtils.cp_lr('src1', 'dest1')
696
+ # tree('dest1')
697
+ # # => dest1
698
+ # # `-- src1
699
+ # # |-- sub0
700
+ # # | |-- src0.txt
701
+ # # | `-- src1.txt
702
+ # # `-- sub1
703
+ # # |-- src2.txt
704
+ # # `-- src3.txt
705
+ #
706
+ # If `src` is an array of paths to entries and `dest` is the path to a
707
+ # directory, for each path `filepath` in `src`, creates a link at
708
+ # <code>dest/filepath</code> pointing to that path:
709
+ #
710
+ # tree('src2')
711
+ # # => src2
712
+ # # |-- sub0
713
+ # # | |-- src0.txt
714
+ # # | `-- src1.txt
715
+ # # `-- sub1
716
+ # # |-- src2.txt
717
+ # # `-- src3.txt
718
+ # FileUtils.mkdir('dest2')
719
+ # FileUtils.cp_lr(['src2/sub0', 'src2/sub1'], 'dest2')
720
+ # tree('dest2')
721
+ # # => dest2
722
+ # # |-- sub0
723
+ # # | |-- src0.txt
724
+ # # | `-- src1.txt
725
+ # # `-- sub1
726
+ # # |-- src2.txt
727
+ # # `-- src3.txt
728
+ #
729
+ # Keyword arguments:
730
+ #
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:
737
+ #
738
+ # FileUtils.cp_lr('src0', 'dest0', noop: true, verbose: true)
739
+ # FileUtils.cp_lr('src1', 'dest1', noop: true, verbose: true)
740
+ # FileUtils.cp_lr(['src2/sub0', 'src2/sub1'], 'dest2', noop: true, verbose: true)
741
+ #
742
+ # Output:
743
+ #
744
+ # cp -lr src0 dest0
745
+ # cp -lr src1 dest1
746
+ # cp -lr src2/sub0 src2/sub1 dest2
747
+ #
748
+ # Raises an exception if `dest` is the path to an existing file or directory and
749
+ # keyword argument <code>remove_destination: true</code> is not given.
750
+ #
751
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
752
+ #
753
+ def self?.cp_lr: (pathlist src, ::path dest, ?noop: boolish, ?verbose: boolish, ?dereference_root: boolish, ?remove_destination: boolish) -> void
754
+
755
+ # <!--
756
+ # rdoc-file=lib/fileutils.rb
757
+ # - cp_r(src, dest, preserve: nil, noop: nil, verbose: nil, dereference_root: true, remove_destination: nil)
758
+ # -->
759
+ # Recursively copies files.
760
+ #
761
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
762
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
763
+ #
764
+ # The mode, owner, and group are retained in the copy; to change those, use
765
+ # FileUtils.install instead.
766
+ #
767
+ # If `src` is the path to a file and `dest` is not the path to a directory,
768
+ # copies `src` to `dest`:
769
+ #
770
+ # FileUtils.touch('src0.txt')
771
+ # File.exist?('dest0.txt') # => false
772
+ # FileUtils.cp_r('src0.txt', 'dest0.txt')
773
+ # File.file?('dest0.txt') # => true
774
+ #
775
+ # If `src` is the path to a file and `dest` is the path to a directory, copies
776
+ # `src` to <code>dest/src</code>:
777
+ #
778
+ # FileUtils.touch('src1.txt')
779
+ # FileUtils.mkdir('dest1')
780
+ # FileUtils.cp_r('src1.txt', 'dest1')
781
+ # File.file?('dest1/src1.txt') # => true
782
+ #
783
+ # If `src` is the path to a directory and `dest` does not exist, recursively
784
+ # copies `src` to `dest`:
785
+ #
786
+ # tree('src2')
787
+ # # => src2
788
+ # # |-- dir0
789
+ # # | |-- src0.txt
790
+ # # | `-- src1.txt
791
+ # # `-- dir1
792
+ # # |-- src2.txt
793
+ # # `-- src3.txt
794
+ # FileUtils.exist?('dest2') # => false
795
+ # FileUtils.cp_r('src2', 'dest2')
796
+ # tree('dest2')
797
+ # # => dest2
798
+ # # |-- dir0
799
+ # # | |-- src0.txt
800
+ # # | `-- src1.txt
801
+ # # `-- dir1
802
+ # # |-- src2.txt
803
+ # # `-- src3.txt
804
+ #
805
+ # If `src` and `dest` are paths to directories, recursively copies `src` to
806
+ # <code>dest/src</code>:
807
+ #
808
+ # tree('src3')
809
+ # # => src3
810
+ # # |-- dir0
811
+ # # | |-- src0.txt
812
+ # # | `-- src1.txt
813
+ # # `-- dir1
814
+ # # |-- src2.txt
815
+ # # `-- src3.txt
816
+ # FileUtils.mkdir('dest3')
817
+ # FileUtils.cp_r('src3', 'dest3')
818
+ # tree('dest3')
819
+ # # => dest3
820
+ # # `-- src3
821
+ # # |-- dir0
822
+ # # | |-- src0.txt
823
+ # # | `-- src1.txt
824
+ # # `-- dir1
825
+ # # |-- src2.txt
826
+ # # `-- src3.txt
827
+ #
828
+ # If `src` is an array of paths and `dest` is a directory, recursively copies
829
+ # from each path in `src` to `dest`; the paths in `src` may point to files
830
+ # and/or directories.
831
+ #
832
+ # Keyword arguments:
833
+ #
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:
841
+ #
842
+ # FileUtils.cp_r('src0.txt', 'dest0.txt', noop: true, verbose: true)
843
+ # FileUtils.cp_r('src1.txt', 'dest1', noop: true, verbose: true)
844
+ # FileUtils.cp_r('src2', 'dest2', noop: true, verbose: true)
845
+ # FileUtils.cp_r('src3', 'dest3', noop: true, verbose: true)
846
+ #
847
+ # Output:
848
+ #
849
+ # cp -r src0.txt dest0.txt
850
+ # cp -r src1.txt dest1
851
+ # cp -r src2 dest2
852
+ # cp -r src3 dest3
853
+ #
854
+ # Raises an exception of `src` is the path to a directory and `dest` is the path
855
+ # to a file.
856
+ #
857
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
858
+ #
859
+ def self?.cp_r: (pathlist src, ::path dest, ?preserve: boolish, ?noop: boolish, ?verbose: boolish, ?dereference_root: boolish, ?remove_destination: boolish) -> void
860
+
861
+ # <!--
862
+ # rdoc-file=lib/fileutils.rb
863
+ # - have_option?(mid, opt)
864
+ # -->
865
+ # Returns `true` if method `mid` accepts the given option `opt`, `false`
866
+ # otherwise; the arguments may be strings or symbols:
867
+ #
868
+ # FileUtils.have_option?(:chmod, :noop) # => true
869
+ # FileUtils.have_option?('chmod', 'secure') # => false
870
+ #
871
+ def self.have_option?: (Symbol mid, Symbol opt) -> bool
872
+
873
+ # <!--
874
+ # rdoc-file=lib/fileutils.rb
875
+ # - install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil, noop: nil, verbose: nil)
876
+ # -->
877
+ # Copies a file entry. See
878
+ # [install(1)](https://man7.org/linux/man-pages/man1/install.1.html).
879
+ #
880
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
881
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments);
882
+ #
883
+ # If the entry at `dest` does not exist, copies from `src` to `dest`:
884
+ #
885
+ # File.read('src0.txt') # => "aaa\n"
886
+ # File.exist?('dest0.txt') # => false
887
+ # FileUtils.install('src0.txt', 'dest0.txt')
888
+ # File.read('dest0.txt') # => "aaa\n"
889
+ #
890
+ # If `dest` is a file entry, copies from `src` to `dest`, overwriting:
891
+ #
892
+ # File.read('src1.txt') # => "aaa\n"
893
+ # File.read('dest1.txt') # => "bbb\n"
894
+ # FileUtils.install('src1.txt', 'dest1.txt')
895
+ # File.read('dest1.txt') # => "aaa\n"
896
+ #
897
+ # If `dest` is a directory entry, copies from `src` to <code>dest/src</code>,
898
+ # overwriting if necessary:
899
+ #
900
+ # File.read('src2.txt') # => "aaa\n"
901
+ # File.read('dest2/src2.txt') # => "bbb\n"
902
+ # FileUtils.install('src2.txt', 'dest2')
903
+ # File.read('dest2/src2.txt') # => "aaa\n"
904
+ #
905
+ # If `src` is an array of paths and `dest` points to a directory, copies each
906
+ # path `path` in `src` to <code>dest/path</code>:
907
+ #
908
+ # File.file?('src3.txt') # => true
909
+ # File.file?('src3.dat') # => true
910
+ # FileUtils.mkdir('dest3')
911
+ # FileUtils.install(['src3.txt', 'src3.dat'], 'dest3')
912
+ # File.file?('dest3/src3.txt') # => true
913
+ # File.file?('dest3/src3.dat') # => true
914
+ #
915
+ # Keyword arguments:
916
+ #
917
+ # * <code>group: <i>group</i></code> - changes the group if not `nil`, using
918
+ # [File.chown](rdoc-ref:File.chown).
919
+ # * <code>mode: <i>permissions</i></code> - changes the permissions. using
920
+ # [File.chmod](rdoc-ref:File.chmod).
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
923
+ # [File.chown](rdoc-ref:File.chown).
924
+ # * <code>preserve: true</code> - preserve timestamps using
925
+ # [File.utime](rdoc-ref:File.utime).
926
+ # * <code>verbose: true</code> - prints an equivalent command:
927
+ #
928
+ # FileUtils.install('src0.txt', 'dest0.txt', noop: true, verbose: true)
929
+ # FileUtils.install('src1.txt', 'dest1.txt', noop: true, verbose: true)
930
+ # FileUtils.install('src2.txt', 'dest2', noop: true, verbose: true)
931
+ #
932
+ # Output:
933
+ #
934
+ # install -c src0.txt dest0.txt
935
+ # install -c src1.txt dest1.txt
936
+ # install -c src2.txt dest2
937
+ #
938
+ # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
939
+ #
940
+ def self?.install: (::path src, ::path dest, ?mode: mode?, ?owner: String?, ?group: String?, ?preserve: boolish, ?noop: boolish, ?verbose: boolish) -> void
941
+
942
+ # <!--
943
+ # rdoc-file=lib/fileutils.rb
944
+ # - link_entry(src, dest, dereference_root = false, remove_destination = false)
945
+ # -->
946
+ # Creates [hard links](https://en.wikipedia.org/wiki/Hard_link); returns `nil`.
947
+ #
948
+ # Arguments `src` and `dest` should be [interpretable as
949
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
950
+ #
951
+ # If `src` is the path to a file and `dest` does not exist, creates a hard link
952
+ # at `dest` pointing to `src`:
953
+ #
954
+ # FileUtils.touch('src0.txt')
955
+ # File.exist?('dest0.txt') # => false
956
+ # FileUtils.link_entry('src0.txt', 'dest0.txt')
957
+ # File.file?('dest0.txt') # => true
958
+ #
959
+ # If `src` is the path to a directory and `dest` does not exist, recursively
960
+ # creates hard links at `dest` pointing to paths in `src`:
961
+ #
962
+ # FileUtils.mkdir_p(['src1/dir0', 'src1/dir1'])
963
+ # src_file_paths = [
964
+ # 'src1/dir0/t0.txt',
965
+ # 'src1/dir0/t1.txt',
966
+ # 'src1/dir1/t2.txt',
967
+ # 'src1/dir1/t3.txt',
968
+ # ]
969
+ # FileUtils.touch(src_file_paths)
970
+ # File.directory?('dest1') # => true
971
+ # FileUtils.link_entry('src1', 'dest1')
972
+ # File.file?('dest1/dir0/t0.txt') # => true
973
+ # File.file?('dest1/dir0/t1.txt') # => true
974
+ # File.file?('dest1/dir1/t2.txt') # => true
975
+ # File.file?('dest1/dir1/t3.txt') # => true
976
+ #
977
+ # Optional arguments:
978
+ #
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).
983
+ #
984
+ # Raises an exception if `dest` is the path to an existing file or directory and
985
+ # optional argument `remove_destination` is not given.
986
+ #
987
+ # Related: FileUtils.ln (has different options).
988
+ #
989
+ def self?.link_entry: (::path src, ::path dest, ?boolish dereference_root, ?boolish remove_destination) -> void
990
+
991
+ # <!--
992
+ # rdoc-file=lib/fileutils.rb
993
+ # - ln(src, dest, force: nil, noop: nil, verbose: nil)
994
+ # -->
995
+ # Creates [hard links](https://en.wikipedia.org/wiki/Hard_link).
996
+ #
997
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
998
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
999
+ #
1000
+ # When `src` is the path to an existing file and `dest` is the path to a
1001
+ # non-existent file, creates a hard link at `dest` pointing to `src`; returns
1002
+ # zero:
1003
+ #
1004
+ # Dir.children('tmp0/') # => ["t.txt"]
1005
+ # Dir.children('tmp1/') # => []
1006
+ # FileUtils.ln('tmp0/t.txt', 'tmp1/t.lnk') # => 0
1007
+ # Dir.children('tmp1/') # => ["t.lnk"]
1008
+ #
1009
+ # When `src` is the path to an existing file and `dest` is the path to an
1010
+ # existing directory, creates a hard link at <code>dest/src</code> pointing to
1011
+ # `src`; returns zero:
1012
+ #
1013
+ # Dir.children('tmp2') # => ["t.dat"]
1014
+ # Dir.children('tmp3') # => []
1015
+ # FileUtils.ln('tmp2/t.dat', 'tmp3') # => 0
1016
+ # Dir.children('tmp3') # => ["t.dat"]
1017
+ #
1018
+ # When `src` is an array of paths to existing files and `dest` is the path to an
1019
+ # existing directory, then for each path `target` in `src`, creates a hard link
1020
+ # at <code>dest/target</code> pointing to `target`; returns `src`:
1021
+ #
1022
+ # Dir.children('tmp4/') # => []
1023
+ # FileUtils.ln(['tmp0/t.txt', 'tmp2/t.dat'], 'tmp4/') # => ["tmp0/t.txt", "tmp2/t.dat"]
1024
+ # Dir.children('tmp4/') # => ["t.dat", "t.txt"]
1025
+ #
1026
+ # Keyword arguments:
1027
+ #
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:
1031
+ #
1032
+ # FileUtils.ln('tmp0/t.txt', 'tmp1/t.lnk', verbose: true)
1033
+ # FileUtils.ln('tmp2/t.dat', 'tmp3', verbose: true)
1034
+ # FileUtils.ln(['tmp0/t.txt', 'tmp2/t.dat'], 'tmp4/', verbose: true)
1035
+ #
1036
+ # Output:
1037
+ #
1038
+ # ln tmp0/t.txt tmp1/t.lnk
1039
+ # ln tmp2/t.dat tmp3
1040
+ # ln tmp0/t.txt tmp2/t.dat tmp4/
1041
+ #
1042
+ # Raises an exception if `dest` is the path to an existing file and keyword
1043
+ # argument `force` is not `true`.
1044
+ #
1045
+ # Related: FileUtils.link_entry (has different options).
1046
+ #
1047
+ def self?.ln: (pathlist src, ::path dest, ?force: boolish, ?noop: boolish, ?verbose: boolish) -> void
1048
+
1049
+ # <!--
1050
+ # rdoc-file=lib/fileutils.rb
1051
+ # - link(src, dest, force: nil, noop: nil, verbose: nil)
1052
+ # -->
1053
+ #
1054
+ alias self.link self.ln
1055
+
1056
+ # <!--
1057
+ # rdoc-file=lib/fileutils.rb
1058
+ # - link(src, dest, force: nil, noop: nil, verbose: nil)
1059
+ # -->
1060
+ #
1061
+ alias link ln
1062
+
1063
+ # <!--
1064
+ # rdoc-file=lib/fileutils.rb
1065
+ # - ln_s(src, dest, force: nil, relative: false, target_directory: true, noop: nil, verbose: nil)
1066
+ # -->
1067
+ # Creates [symbolic links](https://en.wikipedia.org/wiki/Symbolic_link).
1068
+ #
1069
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
1070
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
1071
+ #
1072
+ # If `src` is the path to an existing file:
1073
+ #
1074
+ # * When `dest` is the path to a non-existent file, creates a symbolic link at
1075
+ # `dest` pointing to `src`:
1076
+ #
1077
+ # FileUtils.touch('src0.txt')
1078
+ # File.exist?('dest0.txt') # => false
1079
+ # FileUtils.ln_s('src0.txt', 'dest0.txt')
1080
+ # File.symlink?('dest0.txt') # => true
1081
+ #
1082
+ # * When `dest` is the path to an existing file, creates a symbolic link at
1083
+ # `dest` pointing to `src` if and only if keyword argument <code>force:
1084
+ # true</code> is given (raises an exception otherwise):
1085
+ #
1086
+ # FileUtils.touch('src1.txt')
1087
+ # FileUtils.touch('dest1.txt')
1088
+ # FileUtils.ln_s('src1.txt', 'dest1.txt', force: true)
1089
+ # FileTest.symlink?('dest1.txt') # => true
1090
+ #
1091
+ # FileUtils.ln_s('src1.txt', 'dest1.txt') # Raises Errno::EEXIST.
1092
+ #
1093
+ # If `dest` is the path to a directory, creates a symbolic link at
1094
+ # <code>dest/src</code> pointing to `src`:
1095
+ #
1096
+ # FileUtils.touch('src2.txt')
1097
+ # FileUtils.mkdir('destdir2')
1098
+ # FileUtils.ln_s('src2.txt', 'destdir2')
1099
+ # File.symlink?('destdir2/src2.txt') # => true
1100
+ #
1101
+ # If `src` is an array of paths to existing files and `dest` is a directory, for
1102
+ # each child `child` in `src` creates a symbolic link <code>dest/child</code>
1103
+ # pointing to `child`:
1104
+ #
1105
+ # FileUtils.mkdir('srcdir3')
1106
+ # FileUtils.touch('srcdir3/src0.txt')
1107
+ # FileUtils.touch('srcdir3/src1.txt')
1108
+ # FileUtils.mkdir('destdir3')
1109
+ # FileUtils.ln_s(['srcdir3/src0.txt', 'srcdir3/src1.txt'], 'destdir3')
1110
+ # File.symlink?('destdir3/src0.txt') # => true
1111
+ # File.symlink?('destdir3/src1.txt') # => true
1112
+ #
1113
+ # Keyword arguments:
1114
+ #
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:
1119
+ #
1120
+ # FileUtils.ln_s('src0.txt', 'dest0.txt', noop: true, verbose: true)
1121
+ # FileUtils.ln_s('src1.txt', 'destdir1', noop: true, verbose: true)
1122
+ # FileUtils.ln_s('src2.txt', 'dest2.txt', force: true, noop: true, verbose: true)
1123
+ # FileUtils.ln_s(['srcdir3/src0.txt', 'srcdir3/src1.txt'], 'destdir3', noop: true, verbose: true)
1124
+ #
1125
+ # Output:
1126
+ #
1127
+ # ln -s src0.txt dest0.txt
1128
+ # ln -s src1.txt destdir1
1129
+ # ln -sf src2.txt dest2.txt
1130
+ # ln -s srcdir3/src0.txt srcdir3/src1.txt destdir3
1131
+ #
1132
+ # Related: FileUtils.ln_sf.
1133
+ #
1134
+ def self?.ln_s: (pathlist src, ::path dest, ?force: boolish, ?relative: boolish, ?target_directory: boolish, ?noop: boolish, ?verbose: boolish) -> void
1135
+
1136
+ # <!--
1137
+ # rdoc-file=lib/fileutils.rb
1138
+ # - symlink(src, dest, force: nil, relative: false, target_directory: true, noop: nil, verbose: nil)
1139
+ # -->
1140
+ #
1141
+ alias self.symlink self.ln_s
1142
+
1143
+ # <!--
1144
+ # rdoc-file=lib/fileutils.rb
1145
+ # - symlink(src, dest, force: nil, relative: false, target_directory: true, noop: nil, verbose: nil)
1146
+ # -->
1147
+ #
1148
+ alias symlink ln_s
1149
+
1150
+ # <!--
1151
+ # rdoc-file=lib/fileutils.rb
1152
+ # - ln_sf(src, dest, noop: nil, verbose: nil)
1153
+ # -->
1154
+ # Like FileUtils.ln_s, but always with keyword argument <code>force: true</code>
1155
+ # given.
1156
+ #
1157
+ def self?.ln_sf: (pathlist src, ::path dest, ?noop: boolish, ?verbose: boolish) -> void
1158
+
1159
+ # <!--
1160
+ # rdoc-file=lib/fileutils.rb
1161
+ # - ln_sr(src, dest, target_directory: true, force: nil, noop: nil, verbose: nil)
1162
+ # -->
1163
+ # Like FileUtils.ln_s, but create links relative to `dest`.
1164
+ #
1165
+ def self?.ln_sr: (pathlist src, ::path dest, ?target_directory: boolish, ?noop: boolish, ?verbose: boolish) -> void
1166
+
1167
+ # <!--
1168
+ # rdoc-file=lib/fileutils.rb
1169
+ # - mkdir(list, mode: nil, noop: nil, verbose: nil)
1170
+ # -->
1171
+ # Creates directories at the paths in the given `list` (a single path or an
1172
+ # array of paths); returns `list` if it is an array, <code>[list]</code>
1173
+ # otherwise.
1174
+ #
1175
+ # Argument `list` or its elements should be [interpretable as
1176
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1177
+ #
1178
+ # With no keyword arguments, creates a directory at each `path` in `list` by
1179
+ # calling: <code>Dir.mkdir(path, mode)</code>; see
1180
+ # [Dir.mkdir](rdoc-ref:Dir.mkdir):
1181
+ #
1182
+ # FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
1183
+ # FileUtils.mkdir('tmp4') # => ["tmp4"]
1184
+ #
1185
+ # Keyword arguments:
1186
+ #
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:
1191
+ #
1192
+ # FileUtils.mkdir(%w[tmp0 tmp1], verbose: true)
1193
+ # FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)
1194
+ #
1195
+ # Output:
1196
+ #
1197
+ # mkdir tmp0 tmp1
1198
+ # mkdir -m 700 tmp2 tmp3
1199
+ #
1200
+ # Raises an exception if any path points to an existing file or directory, or if
1201
+ # for any reason a directory cannot be created.
1202
+ #
1203
+ # Related: FileUtils.mkdir_p.
1204
+ #
1205
+ def self?.mkdir: (pathlist list, ?mode: Integer?, ?noop: boolish, ?verbose: boolish) -> void
1206
+
1207
+ # <!--
1208
+ # rdoc-file=lib/fileutils.rb
1209
+ # - mkdir_p(list, mode: nil, noop: nil, verbose: nil)
1210
+ # -->
1211
+ # Creates directories at the paths in the given `list` (a single path or an
1212
+ # array of paths), also creating ancestor directories as needed; returns `list`
1213
+ # if it is an array, <code>[list]</code> otherwise.
1214
+ #
1215
+ # Argument `list` or its elements should be [interpretable as
1216
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1217
+ #
1218
+ # With no keyword arguments, creates a directory at each `path` in `list`, along
1219
+ # with any needed ancestor directories, by calling: <code>Dir.mkdir(path,
1220
+ # mode)</code>; see [Dir.mkdir](rdoc-ref:Dir.mkdir):
1221
+ #
1222
+ # FileUtils.mkdir_p(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
1223
+ # FileUtils.mkdir_p('tmp4/tmp5') # => ["tmp4/tmp5"]
1224
+ #
1225
+ # Keyword arguments:
1226
+ #
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:
1231
+ #
1232
+ # FileUtils.mkdir_p(%w[tmp0 tmp1], verbose: true)
1233
+ # FileUtils.mkdir_p(%w[tmp2 tmp3], mode: 0700, verbose: true)
1234
+ #
1235
+ # Output:
1236
+ #
1237
+ # mkdir -p tmp0 tmp1
1238
+ # mkdir -p -m 700 tmp2 tmp3
1239
+ #
1240
+ # Raises an exception if for any reason a directory cannot be created.
1241
+ #
1242
+ # FileUtils.mkpath and FileUtils.makedirs are aliases for FileUtils.mkdir_p.
1243
+ #
1244
+ # Related: FileUtils.mkdir.
1245
+ #
1246
+ def self?.mkdir_p: (pathlist list, ?mode: mode?, ?noop: boolish, ?verbose: boolish) -> void
1247
+
1248
+ # <!--
1249
+ # rdoc-file=lib/fileutils.rb
1250
+ # - makedirs(list, mode: nil, noop: nil, verbose: nil)
1251
+ # -->
1252
+ #
1253
+ alias self.makedirs self.mkdir_p
1254
+
1255
+ # <!--
1256
+ # rdoc-file=lib/fileutils.rb
1257
+ # - makedirs(list, mode: nil, noop: nil, verbose: nil)
1258
+ # -->
1259
+ #
1260
+ alias makedirs mkdir_p
1261
+
1262
+ # <!--
1263
+ # rdoc-file=lib/fileutils.rb
1264
+ # - mkpath(list, mode: nil, noop: nil, verbose: nil)
1265
+ # -->
1266
+ #
1267
+ alias self.mkpath self.mkdir_p
1268
+
1269
+ # <!--
1270
+ # rdoc-file=lib/fileutils.rb
1271
+ # - mkpath(list, mode: nil, noop: nil, verbose: nil)
1272
+ # -->
1273
+ #
1274
+ alias mkpath mkdir_p
1275
+
1276
+ # <!--
1277
+ # rdoc-file=lib/fileutils.rb
1278
+ # - mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
1279
+ # -->
1280
+ # Moves entries.
1281
+ #
1282
+ # Arguments `src` (a single path or an array of paths) and `dest` (a single
1283
+ # path) should be [interpretable as paths](rdoc-ref:FileUtils@Path+Arguments).
1284
+ #
1285
+ # If `src` and `dest` are on different file systems, first copies, then removes
1286
+ # `src`.
1287
+ #
1288
+ # May cause a local vulnerability if not called with keyword argument
1289
+ # <code>secure: true</code>; see [Avoiding the TOCTTOU
1290
+ # Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
1291
+ #
1292
+ # If `src` is the path to a single file or directory and `dest` does not exist,
1293
+ # moves `src` to `dest`:
1294
+ #
1295
+ # tree('src0')
1296
+ # # => src0
1297
+ # # |-- src0.txt
1298
+ # # `-- src1.txt
1299
+ # File.exist?('dest0') # => false
1300
+ # FileUtils.mv('src0', 'dest0')
1301
+ # File.exist?('src0') # => false
1302
+ # tree('dest0')
1303
+ # # => dest0
1304
+ # # |-- src0.txt
1305
+ # # `-- src1.txt
1306
+ #
1307
+ # If `src` is an array of paths to files and directories and `dest` is the path
1308
+ # to a directory, copies from each path in the array to `dest`:
1309
+ #
1310
+ # File.file?('src1.txt') # => true
1311
+ # tree('src1')
1312
+ # # => src1
1313
+ # # |-- src.dat
1314
+ # # `-- src.txt
1315
+ # Dir.empty?('dest1') # => true
1316
+ # FileUtils.mv(['src1.txt', 'src1'], 'dest1')
1317
+ # tree('dest1')
1318
+ # # => dest1
1319
+ # # |-- src1
1320
+ # # | |-- src.dat
1321
+ # # | `-- src.txt
1322
+ # # `-- src1.txt
1323
+ #
1324
+ # Keyword arguments:
1325
+ #
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
1331
+ # FileUtils.remove_entry_secure.
1332
+ # * <code>verbose: true</code> - prints an equivalent command:
1333
+ #
1334
+ # FileUtils.mv('src0', 'dest0', noop: true, verbose: true)
1335
+ # FileUtils.mv(['src1.txt', 'src1'], 'dest1', noop: true, verbose: true)
1336
+ #
1337
+ # Output:
1338
+ #
1339
+ # mv src0 dest0
1340
+ # mv src1.txt src1 dest1
1341
+ #
1342
+ def self?.mv: (pathlist src, ::path dest, ?force: boolish, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
1343
+
1344
+ # <!--
1345
+ # rdoc-file=lib/fileutils.rb
1346
+ # - move(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
1347
+ # -->
1348
+ #
1349
+ alias self.move self.mv
1350
+
1351
+ # <!--
1352
+ # rdoc-file=lib/fileutils.rb
1353
+ # - move(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
1354
+ # -->
1355
+ #
1356
+ alias move mv
1357
+
1358
+ # <!--
1359
+ # rdoc-file=lib/fileutils.rb
1360
+ # - options()
1361
+ # -->
1362
+ # Returns an array of the string keyword names:
1363
+ #
1364
+ # FileUtils.options.take(3) # => ["noop", "verbose", "force"]
1365
+ #
1366
+ def self.options: () -> Array[String]
1367
+
1368
+ # <!--
1369
+ # rdoc-file=lib/fileutils.rb
1370
+ # - options_of(mid)
1371
+ # -->
1372
+ # Returns an array of the string keyword name for method `mid`; the argument may
1373
+ # be a string or a symbol:
1374
+ #
1375
+ # FileUtils.options_of(:rm) # => ["force", "noop", "verbose"]
1376
+ # FileUtils.options_of('mv') # => ["force", "noop", "verbose", "secure"]
1377
+ #
1378
+ def self.options_of: (Symbol mid) -> Array[String]
1379
+
1380
+ # <!--
1381
+ # rdoc-file=lib/fileutils.rb
1382
+ # - pwd()
1383
+ # -->
1384
+ # Returns a string containing the path to the current directory:
1385
+ #
1386
+ # FileUtils.pwd # => "/rdoc/fileutils"
1387
+ #
1388
+ # Related: FileUtils.cd.
1389
+ #
1390
+ def self?.pwd: () -> String
1391
+
1392
+ # <!--
1393
+ # rdoc-file=lib/fileutils.rb
1394
+ # - getwd()
1395
+ # -->
1396
+ #
1397
+ alias self.getwd self.pwd
1398
+
1399
+ # <!--
1400
+ # rdoc-file=lib/fileutils.rb
1401
+ # - getwd()
1402
+ # -->
1403
+ #
1404
+ alias getwd pwd
1405
+
1406
+ # <!--
1407
+ # rdoc-file=lib/fileutils.rb
1408
+ # - remove_dir(path, force = false)
1409
+ # -->
1410
+ # Recursively removes the directory entry given by `path`, which should be the
1411
+ # entry for a regular file, a symbolic link, or a directory.
1412
+ #
1413
+ # Argument `path` should be [interpretable as a
1414
+ # path](rdoc-ref:FileUtils@Path+Arguments).
1415
+ #
1416
+ # Optional argument `force` specifies whether to ignore raised exceptions of
1417
+ # StandardError and its descendants.
1418
+ #
1419
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1420
+ #
1421
+ def self?.remove_dir: (::path path, ?boolish force) -> void
1422
+
1423
+ # <!--
1424
+ # rdoc-file=lib/fileutils.rb
1425
+ # - remove_entry(path, force = false)
1426
+ # -->
1427
+ # Removes the entry given by `path`, which should be the entry for a regular
1428
+ # file, a symbolic link, or a directory.
1429
+ #
1430
+ # Argument `path` should be [interpretable as a
1431
+ # path](rdoc-ref:FileUtils@Path+Arguments).
1432
+ #
1433
+ # Optional argument `force` specifies whether to ignore raised exceptions of
1434
+ # StandardError and its descendants.
1435
+ #
1436
+ # Related: FileUtils.remove_entry_secure.
1437
+ #
1438
+ def self?.remove_entry: (::path path, ?boolish force) -> void
1439
+
1440
+ # <!--
1441
+ # rdoc-file=lib/fileutils.rb
1442
+ # - remove_entry_secure(path, force = false)
1443
+ # -->
1444
+ # Securely removes the entry given by `path`, which should be the entry for a
1445
+ # regular file, a symbolic link, or a directory.
1446
+ #
1447
+ # Argument `path` should be [interpretable as a
1448
+ # path](rdoc-ref:FileUtils@Path+Arguments).
1449
+ #
1450
+ # Avoids a local vulnerability that can exist in certain circumstances; see
1451
+ # [Avoiding the TOCTTOU
1452
+ # Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
1453
+ #
1454
+ # Optional argument `force` specifies whether to ignore raised exceptions of
1455
+ # StandardError and its descendants.
1456
+ #
1457
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1458
+ #
1459
+ def self?.remove_entry_secure: (::path path, ?boolish force) -> void
1460
+
1461
+ # <!--
1462
+ # rdoc-file=lib/fileutils.rb
1463
+ # - remove_file(path, force = false)
1464
+ # -->
1465
+ # Removes the file entry given by `path`, which should be the entry for a
1466
+ # regular file or a symbolic link.
1467
+ #
1468
+ # Argument `path` should be [interpretable as a
1469
+ # path](rdoc-ref:FileUtils@Path+Arguments).
1470
+ #
1471
+ # Optional argument `force` specifies whether to ignore raised exceptions of
1472
+ # StandardError and its descendants.
1473
+ #
1474
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1475
+ #
1476
+ def self?.remove_file: (::path path, ?boolish force) -> void
1477
+
1478
+ # <!--
1479
+ # rdoc-file=lib/fileutils.rb
1480
+ # - rm(list, force: nil, noop: nil, verbose: nil)
1481
+ # -->
1482
+ # Removes entries at the paths in the given `list` (a single path or an array of
1483
+ # paths) returns `list`, if it is an array, <code>[list]</code> otherwise.
1484
+ #
1485
+ # Argument `list` or its elements should be [interpretable as
1486
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1487
+ #
1488
+ # With no keyword arguments, removes files at the paths given in `list`:
1489
+ #
1490
+ # FileUtils.touch(['src0.txt', 'src0.dat'])
1491
+ # FileUtils.rm(['src0.dat', 'src0.txt']) # => ["src0.dat", "src0.txt"]
1492
+ #
1493
+ # Keyword arguments:
1494
+ #
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:
1499
+ #
1500
+ # FileUtils.rm(['src0.dat', 'src0.txt'], noop: true, verbose: true)
1501
+ #
1502
+ # Output:
1503
+ #
1504
+ # rm src0.dat src0.txt
1505
+ #
1506
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1507
+ #
1508
+ def self?.rm: (pathlist list, ?force: boolish, ?noop: boolish, ?verbose: boolish) -> void
1509
+
1510
+ # <!--
1511
+ # rdoc-file=lib/fileutils.rb
1512
+ # - remove(list, force: nil, noop: nil, verbose: nil)
1513
+ # -->
1514
+ #
1515
+ alias self.remove self.rm
1516
+
1517
+ # <!--
1518
+ # rdoc-file=lib/fileutils.rb
1519
+ # - remove(list, force: nil, noop: nil, verbose: nil)
1520
+ # -->
1521
+ #
1522
+ alias remove rm
1523
+
1524
+ # <!--
1525
+ # rdoc-file=lib/fileutils.rb
1526
+ # - rm_f(list, noop: nil, verbose: nil)
1527
+ # -->
1528
+ # Equivalent to:
1529
+ #
1530
+ # FileUtils.rm(list, force: true, **kwargs)
1531
+ #
1532
+ # Argument `list` (a single path or an array of paths) should be [interpretable
1533
+ # as paths](rdoc-ref:FileUtils@Path+Arguments).
1534
+ #
1535
+ # See FileUtils.rm for keyword arguments.
1536
+ #
1537
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1538
+ #
1539
+ def self?.rm_f: (pathlist list, ?noop: boolish, ?verbose: boolish) -> void
1540
+
1541
+ # <!--
1542
+ # rdoc-file=lib/fileutils.rb
1543
+ # - safe_unlink(list, noop: nil, verbose: nil)
1544
+ # -->
1545
+ #
1546
+ alias self.safe_unlink self.rm_f
1547
+
1548
+ # <!--
1549
+ # rdoc-file=lib/fileutils.rb
1550
+ # - safe_unlink(list, noop: nil, verbose: nil)
1551
+ # -->
1552
+ #
1553
+ alias safe_unlink rm_f
1554
+
1555
+ # <!--
1556
+ # rdoc-file=lib/fileutils.rb
1557
+ # - rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
1558
+ # -->
1559
+ # Removes entries at the paths in the given `list` (a single path or an array of
1560
+ # paths); returns `list`, if it is an array, <code>[list]</code> otherwise.
1561
+ #
1562
+ # Argument `list` or its elements should be [interpretable as
1563
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1564
+ #
1565
+ # May cause a local vulnerability if not called with keyword argument
1566
+ # <code>secure: true</code>; see [Avoiding the TOCTTOU
1567
+ # Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
1568
+ #
1569
+ # For each file path, removes the file at that path:
1570
+ #
1571
+ # FileUtils.touch(['src0.txt', 'src0.dat'])
1572
+ # FileUtils.rm_r(['src0.dat', 'src0.txt'])
1573
+ # File.exist?('src0.txt') # => false
1574
+ # File.exist?('src0.dat') # => false
1575
+ #
1576
+ # For each directory path, recursively removes files and directories:
1577
+ #
1578
+ # tree('src1')
1579
+ # # => src1
1580
+ # # |-- dir0
1581
+ # # | |-- src0.txt
1582
+ # # | `-- src1.txt
1583
+ # # `-- dir1
1584
+ # # |-- src2.txt
1585
+ # # `-- src3.txt
1586
+ # FileUtils.rm_r('src1')
1587
+ # File.exist?('src1') # => false
1588
+ #
1589
+ # Keyword arguments:
1590
+ #
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
1595
+ # FileUtils.remove_entry_secure.
1596
+ # * <code>verbose: true</code> - prints an equivalent command:
1597
+ #
1598
+ # FileUtils.rm_r(['src0.dat', 'src0.txt'], noop: true, verbose: true)
1599
+ # FileUtils.rm_r('src1', noop: true, verbose: true)
1600
+ #
1601
+ # Output:
1602
+ #
1603
+ # rm -r src0.dat src0.txt
1604
+ # rm -r src1
1605
+ #
1606
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1607
+ #
1608
+ def self?.rm_r: (pathlist list, ?force: boolish, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
1609
+
1610
+ # <!--
1611
+ # rdoc-file=lib/fileutils.rb
1612
+ # - rm_rf(list, noop: nil, verbose: nil, secure: nil)
1613
+ # -->
1614
+ # Equivalent to:
1615
+ #
1616
+ # FileUtils.rm_r(list, force: true, **kwargs)
1617
+ #
1618
+ # Argument `list` or its elements should be [interpretable as
1619
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1620
+ #
1621
+ # May cause a local vulnerability if not called with keyword argument
1622
+ # <code>secure: true</code>; see [Avoiding the TOCTTOU
1623
+ # Vulnerability](rdoc-ref:FileUtils@Avoiding+the+TOCTTOU+Vulnerability).
1624
+ #
1625
+ # See FileUtils.rm_r for keyword arguments.
1626
+ #
1627
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1628
+ #
1629
+ def self?.rm_rf: (pathlist list, ?noop: boolish, ?verbose: boolish, ?secure: boolish) -> void
1630
+
1631
+ # <!--
1632
+ # rdoc-file=lib/fileutils.rb
1633
+ # - rmtree(list, noop: nil, verbose: nil, secure: nil)
1634
+ # -->
1635
+ #
1636
+ alias self.rmtree self.rm_rf
1637
+
1638
+ # <!--
1639
+ # rdoc-file=lib/fileutils.rb
1640
+ # - rmtree(list, noop: nil, verbose: nil, secure: nil)
1641
+ # -->
1642
+ #
1643
+ alias rmtree rm_rf
1644
+
1645
+ # <!--
1646
+ # rdoc-file=lib/fileutils.rb
1647
+ # - rmdir(list, parents: nil, noop: nil, verbose: nil)
1648
+ # -->
1649
+ # Removes directories at the paths in the given `list` (a single path or an
1650
+ # array of paths); returns `list`, if it is an array, <code>[list]</code>
1651
+ # otherwise.
1652
+ #
1653
+ # Argument `list` or its elements should be [interpretable as
1654
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1655
+ #
1656
+ # With no keyword arguments, removes the directory at each `path` in `list`, by
1657
+ # calling: <code>Dir.rmdir(path)</code>; see [Dir.rmdir](rdoc-ref:Dir.rmdir):
1658
+ #
1659
+ # FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3]) # => ["tmp0/tmp1", "tmp2/tmp3"]
1660
+ # FileUtils.rmdir('tmp4/tmp5') # => ["tmp4/tmp5"]
1661
+ #
1662
+ # Keyword arguments:
1663
+ #
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:
1668
+ #
1669
+ # FileUtils.rmdir(%w[tmp0/tmp1 tmp2/tmp3], parents: true, verbose: true)
1670
+ # FileUtils.rmdir('tmp4/tmp5', parents: true, verbose: true)
1671
+ #
1672
+ # Output:
1673
+ #
1674
+ # rmdir -p tmp0/tmp1 tmp2/tmp3
1675
+ # rmdir -p tmp4/tmp5
1676
+ #
1677
+ # Raises an exception if a directory does not exist or if for any reason a
1678
+ # directory cannot be removed.
1679
+ #
1680
+ # Related: [methods for deleting](rdoc-ref:FileUtils@Deleting).
1681
+ #
1682
+ def self?.rmdir: (pathlist list, ?parents: boolish, ?noop: boolish, ?verbose: boolish) -> void
1683
+
1684
+ # <!--
1685
+ # rdoc-file=lib/fileutils.rb
1686
+ # - touch(list, noop: nil, verbose: nil, mtime: nil, nocreate: nil)
1687
+ # -->
1688
+ # Updates modification times (mtime) and access times (atime) of the entries
1689
+ # given by the paths in `list` (a single path or an array of paths); returns
1690
+ # `list` if it is an array, <code>[list]</code> otherwise.
1691
+ #
1692
+ # By default, creates an empty file for any path to a non-existent entry; use
1693
+ # keyword argument `nocreate` to raise an exception instead.
1694
+ #
1695
+ # Argument `list` or its elements should be [interpretable as
1696
+ # paths](rdoc-ref:FileUtils@Path+Arguments).
1697
+ #
1698
+ # Examples:
1699
+ #
1700
+ # # Single path.
1701
+ # f = File.new('src0.txt') # Existing file.
1702
+ # f.atime # => 2022-06-10 11:11:21.200277 -0700
1703
+ # f.mtime # => 2022-06-10 11:11:21.200277 -0700
1704
+ # FileUtils.touch('src0.txt')
1705
+ # f = File.new('src0.txt')
1706
+ # f.atime # => 2022-06-11 08:28:09.8185343 -0700
1707
+ # f.mtime # => 2022-06-11 08:28:09.8185343 -0700
1708
+ #
1709
+ # # Array of paths.
1710
+ # FileUtils.touch(['src0.txt', 'src0.dat'])
1711
+ #
1712
+ # Keyword arguments:
1713
+ #
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:
1720
+ #
1721
+ # FileUtils.touch('src0.txt', noop: true, verbose: true)
1722
+ # FileUtils.touch(['src0.txt', 'src0.dat'], noop: true, verbose: true)
1723
+ # FileUtils.touch(path, noop: true, verbose: true)
1724
+ #
1725
+ # Output:
1726
+ #
1727
+ # touch src0.txt
1728
+ # touch src0.txt src0.dat
1729
+ # touch src0.txt
1730
+ #
1731
+ # Related: FileUtils.uptodate?.
1732
+ #
1733
+ def self?.touch: (pathlist list, ?noop: boolish, ?verbose: boolish, ?mtime: (Time | Numeric)?, ?nocreate: boolish) -> void
1734
+
1735
+ # <!--
1736
+ # rdoc-file=lib/fileutils.rb
1737
+ # - uptodate?(new, old_list)
1738
+ # -->
1739
+ # Returns `true` if the file at path `new` is newer than all the files at paths
1740
+ # in array `old_list`; `false` otherwise.
1741
+ #
1742
+ # Argument `new` and the elements of `old_list` should be [interpretable as
1743
+ # paths](rdoc-ref:FileUtils@Path+Arguments):
1744
+ #
1745
+ # FileUtils.uptodate?('Rakefile', ['Gemfile', 'README.md']) # => true
1746
+ # FileUtils.uptodate?('Gemfile', ['Rakefile', 'README.md']) # => false
1747
+ #
1748
+ # A non-existent file is considered to be infinitely old.
1749
+ #
1750
+ # Related: FileUtils.touch.
1751
+ #
1752
+ def self?.uptodate?: (::path new, _Each[::path] old_list) -> bool
1753
+ end