Skip to content

Commit a1c75ba

Browse files
authored
Merge pull request #9593 from ruby/remove-tool-versions-from-env
Remove external tool version checks from `bundle env`
2 parents 62b9f60 + c7a1ee0 commit a1c75ba

3 files changed

Lines changed: 14 additions & 30 deletions

File tree

bundler/lib/bundler/env.rb

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ def self.git_version
7878
"not installed"
7979
end
8080

81-
def self.version_of(script)
82-
return "not installed" unless Bundler.which(script)
83-
`#{script} --version`.chomp
84-
end
85-
86-
def self.chruby_version
87-
return "not installed" unless Bundler.which("chruby-exec")
88-
`chruby-exec -- chruby --version`.
89-
sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1')
90-
end
91-
9281
def self.environment
9382
out = []
9483

@@ -110,16 +99,8 @@ def self.environment
11099
out << [" Cert File", OpenSSL::X509::DEFAULT_CERT_FILE] if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
111100
out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
112101
end
113-
out << ["Tools"]
114-
out << [" Git", git_version]
115-
out << [" RVM", ENV.fetch("rvm_version") { version_of("rvm") }]
116-
out << [" rbenv", version_of("rbenv")]
117-
out << [" chruby", chruby_version]
118-
119-
%w[rubygems-bundler open_gem].each do |name|
120-
specs = Bundler.rubygems.find_name(name)
121-
out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
122-
end
102+
out << ["Git", git_version]
103+
123104
if (exe = caller_locations.last.absolute_path)&.match? %r{(exe|bin)/bundler?\z}
124105
shebang = File.read(exe).lines.first
125106
shebang.sub!(/^#!\s*/, "")
@@ -143,6 +124,6 @@ def self.append_formatted_table(title, pairs, out)
143124
out << "```\n"
144125
end
145126

146-
private_class_method :read_file, :ruby_version, :git_version, :append_formatted_table, :version_of, :chruby_version
127+
private_class_method :read_file, :ruby_version, :git_version, :append_formatted_table
147128
end
148129
end

doc/TROUBLESHOOTING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ If these instructions don't work, or you can't find any appropriate instructions
5959
# Remove the saved resolve of the Gemfile
6060
rm -rf Gemfile.lock
6161

62-
# Uninstall the rubygems-bundler and open_gem gems
62+
# Check whether the known-problematic rubygems-bundler and open_gem gems are installed
63+
gem list rubygems-bundler open_gem
64+
65+
# Uninstall them if present
6366
rvm gemset use global # if using rvm
6467
gem uninstall rubygems-bundler open_gem
6568

spec/bundler/env_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,16 @@ def with_clear_paths(env_var, env_value)
222222
and_return(["git version 1.2.3 (Apple Git-BS)", "", status])
223223
expect(Bundler::Source::Git::GitProxy).to receive(:new).and_return(git_proxy_stub)
224224

225-
expect(described_class.report).to include("Git 1.2.3 (Apple Git-BS)")
225+
expect(described_class.report).to include("Git 1.2.3 (Apple Git-BS)")
226226
end
227227
end
228-
end
229-
230-
describe ".version_of" do
231-
let(:parsed_version) { described_class.send(:version_of, "ruby") }
232228

233-
it "strips version of new line characters" do
234-
expect(parsed_version).to_not end_with("\n")
229+
it "no longer reports the Tools section or external tool versions" do
230+
report = described_class.report
231+
expect(report).not_to include("Tools")
232+
["rbenv", "RVM", "chruby"].each do |tool|
233+
expect(report).not_to include(tool)
234+
end
235235
end
236236
end
237237
end

0 commit comments

Comments
 (0)