Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions bundler/lib/bundler/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand All @@ -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]

Comment on lines +102 to +103
if (exe = caller_locations.last.absolute_path)&.match? %r{(exe|bin)/bundler?\z}
shebang = File.read(exe).lines.first
shebang.sub!(/^#!\s*/, "")
Expand All @@ -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
5 changes: 4 additions & 1 deletion doc/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions spec/bundler/env_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +225 to 226
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
Loading