From 95fdaa5c3b0e722c1052b6141d26212e290491b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 24 Jul 2025 21:50:49 +0200 Subject: [PATCH] (Temporarily?) delay path changes and global cache changes There are several issues with these which I'm not sure I'll have time to address properly. I prefer to keep our default branch in a releasable state just in case. Once they are fixed, this can be reverted. --- lib/bundler/cli/common.rb | 2 +- lib/bundler/feature_flag.rb | 2 +- lib/bundler/settings.rb | 2 +- spec/bundler/commands/clean_spec.rb | 2 +- spec/bundler/commands/install_spec.rb | 9 +++++++++ spec/bundler/support/filters.rb | 4 ++-- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/bundler/cli/common.rb b/lib/bundler/cli/common.rb index be21ba8299..7608adf2ef 100644 --- a/lib/bundler/cli/common.rb +++ b/lib/bundler/cli/common.rb @@ -130,7 +130,7 @@ module Bundler def self.clean_after_install? clean = Bundler.settings[:clean] return clean unless clean.nil? - clean ||= Bundler.feature_flag.bundler_4_mode? && Bundler.settings[:path].nil? + clean ||= Bundler.feature_flag.bundler_5_mode? && Bundler.settings[:path].nil? clean &&= !Bundler.use_system_gems? clean end diff --git a/lib/bundler/feature_flag.rb b/lib/bundler/feature_flag.rb index a8fa2a1bde..2cf58eefd6 100644 --- a/lib/bundler/feature_flag.rb +++ b/lib/bundler/feature_flag.rb @@ -30,7 +30,7 @@ module Bundler settings_flag(:allow_offline_install) { bundler_4_mode? } settings_flag(:cache_all) { bundler_4_mode? } settings_flag(:forget_cli_options) { bundler_4_mode? } - settings_flag(:global_gem_cache) { bundler_4_mode? } + settings_flag(:global_gem_cache) { bundler_5_mode? } settings_flag(:lockfile_checksums) { bundler_4_mode? } settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") } settings_flag(:update_requires_all_flag) { bundler_5_mode? } diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index d036754a78..cc20598fd9 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -272,7 +272,7 @@ module Bundler def use_system_gems? return true if system_path return false if explicit_path - !Bundler.feature_flag.bundler_4_mode? + !Bundler.feature_flag.bundler_5_mode? end def base_path diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 672f0afed7..fd5a0fdbca 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -427,7 +427,7 @@ RSpec.describe "bundle clean" do should_not_have_gems "foo-1.0" end - it "automatically cleans when path has not been set", bundler: "4" do + it "automatically cleans when path has not been set", bundler: "5" do build_repo2 install_gemfile <<-G diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index 5cfb1b7cbd..e7c1f5e456 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -38,6 +38,15 @@ RSpec.describe "bundle install with gem sources" do expect(bundled_app(".bundle")).not_to exist end + it "will create a ./.bundle by default", bundler: "5" do + install_gemfile <<-G + source "https://gem.repo1" + gem "myrack" + G + + expect(bundled_app(".bundle")).to exist + end + it "does not create ./.bundle by default when installing to system gems" do install_gemfile <<-G, env: { "BUNDLE_PATH__SYSTEM" => "true" } source "https://gem.repo1" diff --git a/spec/bundler/support/filters.rb b/spec/bundler/support/filters.rb index 15b4adf62e..6e94b10e32 100644 --- a/spec/bundler/support/filters.rb +++ b/spec/bundler/support/filters.rb @@ -32,7 +32,7 @@ RSpec.configure do |config| config.filter_run_when_matching :focus unless ENV["CI"] - config.before(:each, bundler: "4") do - bundle "config simulate_version 4" + config.before(:each, :bundler) do |example| + bundle "config simulate_version #{example.metadata[:bundler]}" end end