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/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 diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb index 259b4ee9dc2f..2b7dbde217d8 100644 --- a/spec/bundler/env_spec.rb +++ b/spec/bundler/env_spec.rb @@ -222,16 +222,16 @@ 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") + 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