summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2025-11-25 14:17:03 -0500
committergit <svn-admin@ruby-lang.org>2025-12-15 01:15:06 +0000
commit58940377e6f27f39d5c3baa0faa15655fa873f2c (patch)
tree1df5973278e53886703cee4b1fc05e53bfe7f0d6 /test/ruby
parente7cf07ba3e6758e3e6d34754422505c75fdf9c80 (diff)
[ruby/rubygems] Write gem files atomically
This change updates `write_binary` to use a new class, `AtomicFileWriter.open` to write the gem's files. This implementation is borrowed from Active Support's [`atomic_write`](https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/file/atomic.rb). Atomic write will write the files to a temporary file and then once created, sets permissions and renames the file. If the file is corrupted - ie on failed download, an error occurs, or for some other reason, the real file will not be created. The changes made here make `verify_gz` obsolete, we don't need to verify it if we have successfully created the file atomically. If it exists, it is not corrupt. If it is corrupt, the file won't exist on disk. While writing tests for this functionality I replaced the `RemoteFetcher` stub with `FakeFetcher` except for where we really do need to overwrite the `RemoteFetcher`. The new test implementation is much clearer on what it's trying to accomplish versus the prior test implementation. https://github.com/ruby/rubygems/commit/0cd4b54291
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions