From 85cb212067aeb9e43b7cc6bf3eae446202006746 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 4 Jun 2026 10:52:25 +0900 Subject: [PATCH 1/3] Remove external tool version checks from `bundle env` Keeping up with each version manager's invocation convention is not worth the maintenance cost. chruby in particular is wrapped as a shell function and cannot be run as `chruby --version` at all, so the line always reported a missing version. https://github.com/ruby/rubygems/issues/9528 Co-Authored-By: Claude Opus 4.8 (1M context) --- bundler/lib/bundler/env.rb | 25 +++---------------------- spec/bundler/env_spec.rb | 10 +--------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/bundler/lib/bundler/env.rb b/bundler/lib/bundler/env.rb index 074bef6edcf0..2b2970506098 100644 --- a/bundler/lib/bundler/env.rb +++ b/bundler/lib/bundler/env.rb @@ -78,17 +78,6 @@ def self.git_version "not installed" end - def self.version_of(script) - return "not installed" unless Bundler.which(script) - `#{script} --version`.chomp - end - - def self.chruby_version - return "not installed" unless Bundler.which("chruby-exec") - `chruby-exec -- chruby --version`. - sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1') - end - def self.environment out = [] @@ -110,16 +99,8 @@ def self.environment out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE) out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR) end - out << ["Tools"] - out << [" Git", git_version] - out << [" RVM", ENV.fetch("rvm_version") { version_of("rvm") }] - out << [" rbenv", version_of("rbenv")] - out << [" chruby", chruby_version] - - %w[rubygems-bundler open_gem].each do |name| - specs = Bundler.rubygems.find_name(name) - out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty? - end + out << ["Git", git_version] + if (exe = caller_locations.last.absolute_path)&.match? %r{(exe|bin)/bundler?\z} shebang = File.read(exe).lines.first shebang.sub!(/^#!\s*/, "") @@ -143,6 +124,6 @@ def self.append_formatted_table(title, pairs, out) out << "```\n" end - private_class_method :read_file, :ruby_version, :git_version, :append_formatted_table, :version_of, :chruby_version + private_class_method :read_file, :ruby_version, :git_version, :append_formatted_table end end diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 259b4ee9dc2f..320944d4b9d8 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -222,16 +222,8 @@ def with_clear_paths(env_var, env_value) and_return(["git version 1.2.3 (Apple Git-BS)", "", status]) expect(Bundler::Source::Git::GitProxy).to receive(:new).and_return(git_proxy_stub) - expect(described_class.report).to include("Git 1.2.3 (Apple Git-BS)") + expect(described_class.report).to include("Git 1.2.3 (Apple Git-BS)") end end end - - describe ".version_of" do - let(:parsed_version) { described_class.send(:version_of, "ruby") } - - it "strips version of new line characters" do - expect(parsed_version).to_not end_with("\n") - end - end end From 3060a5498a7d6c79a57a31eae3c3a45eda5941ee Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 4 Jun 2026 12:06:35 +0900 Subject: [PATCH 2/3] Assert the Tools section is gone from `bundle env` Guards against accidentally reintroducing the removed external tool version output. Co-Authored-By: Claude Opus 4.8 (1M context) --- spec/bundler/env_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 320944d4b9d8..2b7dbde217d8 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -225,5 +225,13 @@ def with_clear_paths(env_var, env_value) expect(described_class.report).to include("Git 1.2.3 (Apple Git-BS)") end end + + it "no longer reports the Tools section or external tool versions" do + report = described_class.report + expect(report).not_to include("Tools") + ["rbenv", "RVM", "chruby"].each do |tool| + expect(report).not_to include(tool) + end + end end end From c7a1ee0d42b4003b10af704d7e9b5fb1197541c8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 4 Jun 2026 12:06:35 +0900 Subject: [PATCH 3/3] Document how to check for rubygems-bundler and open_gem `bundle env` no longer reports these gems, so add a `gem list` step before the uninstall instruction. Co-Authored-By: Claude Opus 4.8 (1M context) --- doc/TROUBLESHOOTING.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/TROUBLESHOOTING.md b/doc/TROUBLESHOOTING.md index b7b83ad1632d..68972ef219c1 100644 --- a/doc/TROUBLESHOOTING.md +++ b/doc/TROUBLESHOOTING.md @@ -59,7 +59,10 @@ If these instructions don't work, or you can't find any appropriate instructions # Remove the saved resolve of the Gemfile rm -rf Gemfile.lock - # Uninstall the rubygems-bundler and open_gem gems + # Check whether the known-problematic rubygems-bundler and open_gem gems are installed + gem list rubygems-bundler open_gem + + # Uninstall them if present rvm gemset use global # if using rvm gem uninstall rubygems-bundler open_gem