From 3b62e468c31f7a4799b542ce57b5d473e8b20c20 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 6 Feb 2026 17:56:30 +0900 Subject: [PATCH 1/2] Revert "Cleaned up bundler .gem and .gemspec files in ensure block." This reverts commit dce4ef87bb704ad13da368999173fda1aaa904cb. --- bundler/spec/commands/clean_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bundler/spec/commands/clean_spec.rb b/bundler/spec/commands/clean_spec.rb index 48a5dba4aa9d..793aacf5c2b5 100644 --- a/bundler/spec/commands/clean_spec.rb +++ b/bundler/spec/commands/clean_spec.rb @@ -934,11 +934,5 @@ def should_not_have_gems(*gems) bundle :clean should_have_gems "bundler-#{version}" - ensure - ["bundler-#{version}.gem", "bundler-#{version}.gemspec"].each do |filename| - Pathname(vendored_gems(filename)).tap do |path| - FileUtils.rm_rf(path.basename) - end - end end end From 725f4ff2f43b7a5a93374e6257f08c731e265581 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 6 Feb 2026 18:05:26 +0900 Subject: [PATCH 2/2] Do not create unnecessary directories The method `Spec::Path#vendored_gems` creates the directory containing the path. It makes no sense to create a directory with the same name as its basename in the current working directory. --- bundler/spec/commands/clean_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/bundler/spec/commands/clean_spec.rb b/bundler/spec/commands/clean_spec.rb index 793aacf5c2b5..81209388ae97 100644 --- a/bundler/spec/commands/clean_spec.rb +++ b/bundler/spec/commands/clean_spec.rb @@ -913,12 +913,10 @@ def should_not_have_gems(*gems) # Simulate that the locked bundler version is installed in the bundle path # by creating the gem directory and gemspec (as would happen after bundle install with that version) Pathname(vendored_gems("cache/bundler-#{version}.gem")).tap do |path| - path.basename.mkpath FileUtils.touch(path) end FileUtils.touch(vendored_gems("gems/bundler-#{version}")) Pathname(vendored_gems("specifications/bundler-#{version}.gemspec")).tap do |path| - path.basename.mkpath path.write(<<~GEMSPEC) Gem::Specification.new do |s| s.name = "bundler"