summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2023-03-13 14:28:27 +0100
committerHiroshi SHIBATA <[email protected]>2025-06-19 10:23:36 +0900
commit4245d522b2af5c17a08b3555ffed011a5aa508b2 (patch)
treef0aa298b62193b2181453e7bb40bd075a0c6c79e /lib
parentaf0b184e83995b7184bb432e126f0e713cec17fb (diff)
[rubygems/rubygems] Allow enabling "Bundler 3 mode" more easily
Currently to test Bundler 3 mode we have to actually edit the version file to simulate we're running a future version. This is inconvenient. Instead, allow passing an environment variable, `BUNDLER_3_MODE`, to set the "working mode" Bundler should use. This can now be set easily by end users to enable them to try out the changes in the future version and give us feedback. It's unclear how version auto-switching should work when this environment variable is set, so the auto-switching feature will be disabled in that case. https://github.com/rubygems/rubygems/commit/4e92e9b209
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/environment_preserver.rb1
-rw-r--r--lib/bundler/self_manager.rb1
-rw-r--r--lib/bundler/version.rb2
3 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/environment_preserver.rb b/lib/bundler/environment_preserver.rb
index 444ab6fd37..5e9a44ab5d 100644
--- a/lib/bundler/environment_preserver.rb
+++ b/lib/bundler/environment_preserver.rb
@@ -6,6 +6,7 @@ module Bundler
BUNDLER_KEYS = %w[
BUNDLE_BIN_PATH
BUNDLE_GEMFILE
+ BUNDLER_3_MODE
BUNDLER_VERSION
BUNDLER_SETUP
GEM_HOME
diff --git a/lib/bundler/self_manager.rb b/lib/bundler/self_manager.rb
index 72bcb264ab..0ee111f23e 100644
--- a/lib/bundler/self_manager.rb
+++ b/lib/bundler/self_manager.rb
@@ -105,6 +105,7 @@ module Bundler
def autoswitching_applies?
ENV["BUNDLER_VERSION"].nil? &&
+ ENV["BUNDLER_3_MODE"].nil? &&
ruby_can_restart_with_same_arguments? &&
lockfile_version
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index fa24b4966e..8ac9588fb7 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.7.0.dev".freeze
+ VERSION = (ENV["BUNDLER_3_MODE"] == "true" ? "3.0.0" : "2.7.0.dev").freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i