Skip to content

Commit

Permalink
[rubygems/rubygems] [rebuild_command] Use temporary directory instead…
Browse files Browse the repository at this point in the history
… of the working directory.

rubygems/rubygems@f2e4e5b56f
  • Loading branch information
duckinator authored and matzbot committed Mar 29, 2024
1 parent a28087a commit 54e0b80
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/rubygems/commands/rebuild_command.rb
Expand Up @@ -3,6 +3,7 @@
require "date"
require "digest"
require "fileutils"
require "tmpdir"
require_relative "../package"

class Gem::Commands::RebuildCommand < Gem::Command
Expand Down Expand Up @@ -167,14 +168,10 @@ def compare(source_date_epoch, old_file, new_file)
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)

Expand Down

0 comments on commit 54e0b80

Please sign in to comment.