summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-09-13 17:32:49 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-09-13 17:32:49 -0500
commit7378255261a0e33cbb14c94471a516b7aa7ef611 (patch)
treea99274647796411a9fdab87bff562de25c29d5eb
parentd07e39e8baee88ca8b82cc1fee263dcb68bd2179 (diff)
downloadbundler-7378255261a0e33cbb14c94471a516b7aa7ef611.tar.gz
[Env] Ensure output is platform-appropriate
Also, that everything is properly indented etc
-rw-r--r--lib/bundler/env.rb11
-rw-r--r--spec/bundler/env_spec.rb2
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/bundler/env.rb b/lib/bundler/env.rb
index d42240247c..437dafc65f 100644
--- a/lib/bundler/env.rb
+++ b/lib/bundler/env.rb
@@ -88,12 +88,13 @@ module Bundler
def self.version_of(script)
return "not installed" unless Bundler.which(script)
- %x"#{script} --version"
+ `#{script} --version`
end
def self.chruby_version
return "not installed" unless Bundler.which("chruby-exec")
- %x"chruby-exec -- chruby --version".lines.grep(/^chruby:/).first
+ `chruby-exec -- chruby --version`.
+ sub(/.*^chruby: (#{Gem::Version::VERSION_PATTERN}).*/m, '\1')
end
def self.environment
@@ -106,7 +107,7 @@ module Bundler
out << [" Config Dir", Gem::ConfigFile::SYSTEM_CONFIG_PATH]
out << ["RubyGems", Gem::VERSION]
out << [" Gem Home", ENV.fetch("GEM_HOME") { Gem.dir }]
- out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(":") }]
+ out << [" Gem Path", ENV.fetch("GEM_PATH") { Gem.path.join(File::PATH_SEPARATOR) }]
out << [" User Path", Gem.user_dir]
out << [" Bin Dir", Gem.bindir]
out << ["OpenSSL"] if defined?(OpenSSL)
@@ -116,13 +117,13 @@ module Bundler
out << [" Cert Dir", OpenSSL::X509::DEFAULT_CERT_DIR] if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
out << ["Tools"]
out << [" Git", git_version]
- out << [" RVM", ENV.fetch("rvm_version"){ version_of("rvm") }]
+ 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?
+ out << [" #{name}", "(#{specs.map(&:version).join(",")})"] unless specs.empty?
end
if (exe = caller.last.split(":").first) && exe =~ %r{(exe|bin)/bundler?\z}
shebang = File.read(exe).lines.first
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index fbb7ec3c22..83c03e67d5 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -136,7 +136,7 @@ RSpec.describe Bundler::Env do
and_return("git version 1.2.3 (Apple Git-BS)")
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