[rubygems/rubygems] [rebuild_command] Use temporary directory instead of the working directory.

https://github.com/rubygems/rubygems/commit/f2e4e5b56f
This commit is contained in:
Ellen Marie Dash 2024-01-30 23:12:04 -05:00 committed by git
parent a28087affc
commit 54e0b8073b

View File

@ -3,6 +3,7 @@
require "date"
require "digest"
require "fileutils"
require "tmpdir"
require_relative "../package"
class Gem::Commands::RebuildCommand < Gem::Command
@ -167,14 +168,10 @@ An example of reproducing a gem build:
end
def prep_dirs
rebuild_dir = File.expand_path("rebuild")
rebuild_dir = Dir.mktmpdir("gem_rebuild")
old_dir = File.join(rebuild_dir, "old")
new_dir = File.join(rebuild_dir, "new")
if File.directory?(rebuild_dir)
FileUtils.remove_dir(rebuild_dir)
end
FileUtils.mkdir_p(old_dir)
FileUtils.mkdir_p(new_dir)