From 8ebaa9c0a9983ca5551263e808336a313bc234cd Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 31 Dec 2014 09:50:21 -0500 Subject: [PATCH] Handle newer ruby versions correctly in config output Since Ruby 2.1, patch releases take the form "2.x.y" rather than "2.x.y-pnum". --- Library/Homebrew/cmd/config.rb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index 9d8835e413..7d4d8cfc32 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -94,6 +94,21 @@ module Homebrew @ponk.join(", ") unless @ponk.empty? end + def describe_system_ruby + s = "" + case RUBY_VERSION + when /^1\.[89]/, /^2\.0/ + s << "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" + else + s << RUBY_VERSION + end + + if RUBY_PATH.to_s !~ %r[^/System/Library/Frameworks/Ruby.framework/Versions/[12]\.[089]/usr/bin/ruby] + s << " => #{RUBY_PATH}" + end + s + end + def dump_verbose_config(f=$stdout) f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}" f.puts "ORIGIN: #{origin}" @@ -111,7 +126,7 @@ module Homebrew f.puts "Clang: #{clang ? "#{clang} build #{clang_build}" : "N/A"}" f.puts "MacPorts/Fink: #{macports_or_fink}" if macports_or_fink f.puts "X11: #{describe_x11}" - f.puts "System Ruby: #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}" + f.puts "System Ruby: #{describe_system_ruby}" f.puts "Perl: #{describe_perl}" f.puts "Python: #{describe_python}" f.puts "Ruby: #{describe_ruby}"