Skip to content

Commit 85cb212

Browse files
hsbtclaude
andcommitted
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. #9528 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e56a55d commit 85cb212

2 files changed

Lines changed: 4 additions & 31 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

spec/bundler/env_spec.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,8 @@ 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
228228
end
229-
230-
describe ".version_of" do
231-
let(:parsed_version) { described_class.send(:version_of, "ruby") }
232-
233-
it "strips version of new line characters" do
234-
expect(parsed_version).to_not end_with("\n")
235-
end
236-
end
237229
end

0 commit comments

Comments
 (0)