summaryrefslogtreecommitdiff
path: root/lib/fileutils.rb
AgeCommit message (Collapse)Author
2024-11-01[ruby/fileutils] Bump up v1.7.3Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/c138e67613
2024-02-21[ruby/fileutils] [DOC] FileUtils::VERSIONNobuyoshi Nakada
https://github.com/ruby/fileutils/commit/48742e2921
2024-02-21[ruby/fileutils] [DOC] nodoc for private methods and moduleNobuyoshi Nakada
https://github.com/ruby/fileutils/commit/75c6010aab
2024-02-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2023-11-07[ruby/fileutils] Bump up 1.7.2Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/577fd38f15
2023-04-03[ruby/fileutils] Bump up v1.7.1Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/7138d85156
2023-03-06s/mjit/rjit/Takashi Kokubun
Notes: Merged: https://github.com/ruby/ruby/pull/7462
2023-02-19[ruby/fileutils] Remove (newly unneeded) remarks about aliasesBurdette Lamar
(https://github.com/ruby/fileutils/pull/108) https://github.com/ruby/fileutils/commit/bbe595cfa5
2023-02-10[ruby/fileutils] Add mkdir_p to FileUtils.installSatadru Pramanik, DO, MPH, MEng
(https://github.com/ruby/fileutils/pull/104) * Add mkdir_p to FileUtils.install * Adjust raise message. * adjust raise language * handle trailing slash in dest * simplify * Add tests
2022-12-05[ruby/fileutils] Bump version to 1.7.0Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/213e6a3d1f
2022-11-25[ruby/fileutils] [Feature #18925] Add `ln_sr` method and `relative:` option ↵Nobuyoshi Nakada
to `ln_s` https://github.com/ruby/fileutils/commit/5116088d5c
2022-11-07[ruby/fileutils] Revert "FileUtils.rm* methods swallows only Errno::ENOENT ↵Yusuke Endoh
when force is true" This reverts commit https://github.com/ruby/fileutils/commit/fa65d676ece9. This caused some incompatibility problems in real-world cases. https://bugs.ruby-lang.org/issues/18784#change-98927 https://bugs.ruby-lang.org/issues/18784#change-98967 https://github.com/ruby/fileutils/commit/42983c2553
2022-10-12[DOC] Replace the external URIs to docs with rdoc-refNobuyoshi Nakada
2022-08-23[ruby/fileutils] FileUtils.rm* methods swallows only Errno::ENOENT when ↵Yusuke Endoh
force is true ... instead of any StandardError. To behave like the standard `rm` command, it should only ignore exceptions about not existing files, not every exception. This should make debugging some errors easier, because the expectation is that `rm -rf` will succeed if and only if, all given files (previously existent or not) are removed. However, due to this exception swallowing, this is not always the case. From the `rm` man page > COMPATIBILITY > > The rm utility differs from historical implementations in that the -f > option only masks attempts to remove non-existent files instead of > masking a large variety of errors. https://github.com/ruby/fileutils/commit/fa65d676ec Co-Authored-By: David Rodríguez <[email protected]>
2022-08-23[ruby/fileutils] Narrow the scope of ensureYusuke Endoh
The ensure in postorder_traverse was added for [Bug #6756]. The intention was to try to delete the parent directory if it failed to get the children. (It may be possible to delete the directory if it is empty.) However, the ensure region rescue'ed not only "failure to get children" but also "failure to delete each child". Thus, the following raised Errno::ENOTEMPTY, but we expect it to raise Errno::EACCES. ``` $ mkdir foo $ touch foo/bar $ chmod 555 foo $ ruby -rfileutils -e 'FileUtils.rm_rf("foo")' ``` This changeset narrows the ensure region so that it rescues only "failure to get children". https://github.com/ruby/fileutils/commit/ec5d3b84ea
2022-08-22[ruby/fileutils] Fix mkdir_p hanging on Windows when trying to create a file ↵David Rodríguez
on a offline drive https://github.com/ruby/fileutils/commit/9cc6a082d7
2022-07-29Merge ruby/fileutils from ↵Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/332025bc0299254f97a06d64e580f60fea4e7125 Notes: Merged: https://github.com/ruby/ruby/pull/6200
2022-06-29[ruby/fileutils] [DOC] Changes to examples ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/96) * Changes to examples https://github.com/ruby/fileutils/commit/346a71b2cb
2022-06-22[ruby/fileutils] Clarify difference between cp_r and install ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/95) https://github.com/ruby/fileutils/commit/94a599e69f
2022-06-21[ruby/fileutils] Correct method references for secure removal ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/93) https://github.com/ruby/fileutils/commit/42c9685826
2022-06-21[ruby/fileutils] [DOC] Adding 'Related' ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/92) https://github.com/ruby/fileutils/commit/fc3cc28397
2022-06-17[ruby/fileutils] [DOC] Revisions for module-level doc ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/90) * Revisions for module-level doc https://github.com/ruby/fileutils/commit/dcbad90a1f
2022-06-16[ruby/fileutils] [DOC] Small tweaks (https://github.com/ruby/fileutils/pull/89)Burdette Lamar
https://github.com/ruby/fileutils/commit/13ab96439b
2022-06-16[ruby/fileutils] [DOC] More on paths and lists ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/88) https://github.com/ruby/fileutils/commit/ba3ae2430d
2022-06-15[ruby/fileutils] [DOC] More on cp_r (https://github.com/ruby/fileutils/pull/87)Burdette Lamar
* More on cp_r https://github.com/ruby/fileutils/commit/82a2b62578
2022-06-14[ruby/fileutils] [DOC] More on paths and lists ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/86) * More on paths and lists https://github.com/ruby/fileutils/commit/c3d92d34f4
2022-06-14[ruby/fileutils] [DOC] Clarify path arguments ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/85) https://github.com/ruby/fileutils/commit/5f9ef9ddc8
2022-06-13[ruby/fileutils] [DOC] Enhanced Rdoc (https://github.com/ruby/fileutils/pull/84)Burdette Lamar
Treats: ::chown_R ::touch ::commands ::options ::have_option? ::options_of ::collect_method https://github.com/ruby/fileutils/commit/5df0324f52
2022-06-11[ruby/fileutils] Enhanced RDoc (https://github.com/ruby/fileutils/pull/83)Burdette Lamar
Treats ::chmod_R and ::chown. https://github.com/ruby/fileutils/commit/df4ac84bef
2022-06-10[ruby/fileutils] Enhanced RDoc (https://github.com/ruby/fileutils/pull/82)Burdette Lamar
Treats ::chmod; adds Pathname usage to ::install. https://github.com/ruby/fileutils/commit/9db4cb129c
2022-06-09[ruby/fileutils] [DOC] Enhanced RDoc (https://github.com/ruby/fileutils/pull/81)Burdette Lamar
https://github.com/ruby/fileutils/commit/b9d5a79e38
2022-06-08[ruby/fileutils] File trees (https://github.com/ruby/fileutils/pull/80)Burdette Lamar
Adds a note about file tree examples. https://github.com/ruby/fileutils/commit/65ac65067a
2022-06-07[ruby/fileutils] [DOC] Enhanced RDoc for FileUtils ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/78) Treats: ::rm ::rm_f ::rm_r ::rm_rf ::remove_entry_secure https://github.com/ruby/fileutils/commit/ce2a438d75
2022-05-31[ruby/fileutils] [DOC] Enhanced RDoc (https://github.com/ruby/fileutils/pull/77)Burdette Lamar
Treats: ::copy_entry ::copy_file ::copy_stream ::mv https://github.com/ruby/fileutils/commit/d6d7e5330d
2022-05-26[ruby/fileutils] [DOC] Enhanced RDoc for copy_entry ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/76) https://github.com/ruby/fileutils/commit/27a3c376c7
2022-05-25[ruby/fileutils] [DOC] Enhanced RDoc for ::cp_r ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/75) https://github.com/ruby/fileutils/commit/a4da433443
2022-05-24[ruby/fileutils] [DOC] Enhanced RDoc for ::cp ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/74) https://github.com/ruby/fileutils/commit/956b345ceb
2022-05-24[ruby/fileutils] Enhanced RDoc for ::ln_sf and ::link_entry ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/73) https://github.com/ruby/fileutils/commit/ff49055f8a
2022-05-23[ruby/fileutils] [DOC] Enhanced RDoc for ::ln_s ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/72) https://github.com/ruby/fileutils/commit/db612c5e22
2022-05-21[ruby/fileutils] Enhanced RDoc for #cp_lr ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/71) https://github.com/ruby/fileutils/commit/39772bccca
2022-05-14[ruby/fileutils] [DOC] Enhanced RDoc for #ln ↵Burdette Lamar
(https://github.com/ruby/fileutils/pull/69) Enhanced RDoc for #ln https://github.com/ruby/fileutils/commit/79fc67f03f Co-authored-by: Peter Zhu <[email protected]>
2022-05-12[ruby/fileutils] Update lib/fileutils.rbBurdette Lamar
https://github.com/ruby/fileutils/commit/4771925fee Co-authored-by: Peter Zhu <[email protected]>
2022-05-12[ruby/fileutils] Enhanced RDoc for FileUtilsBurdetteLamar
https://github.com/ruby/fileutils/commit/a0ea474214
2022-05-11[ruby/fileutils] Enhanced RDoc for FileUtilsBurdetteLamar
https://github.com/ruby/fileutils/commit/c38fd02372
2022-05-11[ruby/fileutils] Enhanced RDoc for FileUtilsBurdetteLamar
https://github.com/ruby/fileutils/commit/7b60f2d63b
2021-10-21[ruby/fileutils] Bump up fileutils version to 1.6.0Hiroshi SHIBATA
https://github.com/ruby/fileutils/commit/918d19e4f2
2021-10-14[ruby/fileutils] Remove counterproductive optimizationDavid Rodríguez
I think it's debatable which is the most common usage of `FileUtils.mkdir_p`, but even assuming the most common use case is creating a folder when it doesn't previously exist but the parent does, this optimization doesn't seem to have a noticiable effect there while harming other use cases. For benchmarks, I created this script ```ruby require "benchmark/ips" Benchmark.ips do |x| x.report("old mkdir_p - exists") do FileUtils.mkdir_p "/tmp" end x.report("new_mkdir_p - exists") do FileUtils.mkdir_p_new "/tmp" end x.compare! end FileUtils.rm_rf "/tmp/foo" Benchmark.ips do |x| x.report("old mkdir_p - doesnt exist, parent exists") do FileUtils.mkdir_p "/tmp/foo" FileUtils.rm_rf "/tmp/foo" end x.report("new_mkdir_p - doesnt exist, parent exists") do FileUtils.mkdir_p_new "/tmp/foo" FileUtils.rm_rf "/tmp/foo" end x.compare! end Benchmark.ips do |x| x.report("old mkdir_p - doesnt exist, parent either") do FileUtils.mkdir_p "/tmp/foo/bar" FileUtils.rm_rf "/tmp/foo" end x.report("new_mkdir_p - doesnt exist, parent either") do FileUtils.mkdir_p_new "/tmp/foo/bar" FileUtils.rm_rf "/tmp/foo" end x.compare! end Benchmark.ips do |x| x.report("old mkdir_p - more levels") do FileUtils.mkdir_p "/tmp/foo/bar/baz" FileUtils.rm_rf "/tmp/foo" end x.report("new_mkdir_p - more levels") do FileUtils.mkdir_p_new "/tmp/foo/bar/baz" FileUtils.rm_rf "/tmp/foo" end x.compare! end ``` and copied the method with the "optimization" removed as `FileUtils.mkdir_p_new`. The results are as below: ``` Warming up -------------------------------------- old mkdir_p - exists 15.914k i/100ms new_mkdir_p - exists 46.512k i/100ms Calculating ------------------------------------- old mkdir_p - exists 161.461k (± 3.2%) i/s - 811.614k in 5.032315s new_mkdir_p - exists 468.192k (± 2.9%) i/s - 2.372M in 5.071225s Comparison: new_mkdir_p - exists: 468192.1 i/s old mkdir_p - exists: 161461.0 i/s - 2.90x (± 0.00) slower Warming up -------------------------------------- old mkdir_p - doesnt exist, parent exists 2.142k i/100ms new_mkdir_p - doesnt exist, parent exists 1.961k i/100ms Calculating ------------------------------------- old mkdir_p - doesnt exist, parent exists 21.242k (± 6.7%) i/s - 107.100k in 5.069206s new_mkdir_p - doesnt exist, parent exists 19.682k (± 4.2%) i/s - 100.011k in 5.091961s Comparison: old mkdir_p - doesnt exist, parent exists: 21241.7 i/s new_mkdir_p - doesnt exist, parent exists: 19681.7 i/s - same-ish: difference falls within error Warming up -------------------------------------- old mkdir_p - doesnt exist, parent either 945.000 i/100ms new_mkdir_p - doesnt exist, parent either 1.002k i/100ms Calculating ------------------------------------- old mkdir_p - doesnt exist, parent either 9.689k (± 4.4%) i/s - 49.140k in 5.084342s new_mkdir_p - doesnt exist, parent either 10.806k (± 4.6%) i/s - 54.108k in 5.020714s Comparison: new_mkdir_p - doesnt exist, parent either: 10806.3 i/s old mkdir_p - doesnt exist, parent either: 9689.3 i/s - 1.12x (± 0.00) slower Warming up -------------------------------------- old mkdir_p - more levels 702.000 i/100ms new_mkdir_p - more levels 775.000 i/100ms Calculating ------------------------------------- old mkdir_p - more levels 7.046k (± 3.5%) i/s - 35.802k in 5.087548s new_mkdir_p - more levels 7.685k (± 5.5%) i/s - 38.750k in 5.061351s Comparison: new_mkdir_p - more levels: 7685.1 i/s old mkdir_p - more levels: 7046.4 i/s - same-ish: difference falls within error ``` I think it's better to keep the code simpler is the optimization is not so clear like in this case. https://github.com/ruby/fileutils/commit/e842a0e70e
2021-10-14[ruby/fileutils] Simplify loop to find out segments to be createdDavid Rodríguez
Doing it this way is simpler and it doesn't end up adding "/" to the list of folders, so it doesn't need to be removed later. https://github.com/ruby/fileutils/commit/df08e124ce
2021-01-17[ruby/fileutils] Removed code for dead versionsNobuyoshi Nakada
https://github.com/ruby/fileutils/commit/1f707d8cc6
2020-12-22Update library versions of the default gems.Hiroshi SHIBATA
They are followed up with https://github.com/ruby/ruby/commit/8fb02b7a97317090e3946e6f2d4a7d034f9699f1