Skip to content

Commit e7cc891

Browse files
committed
RUBY_DESCRIPTION, minor formatting, width
1 parent eab2d8c commit e7cc891

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

check.rb

+26-12
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@
3535
ssl_version = ARGV.shift
3636
verify_mode = ARGV.any? ? OpenSSL::SSL.const_get(ARGV.shift) : OpenSSL::SSL::VERIFY_PEER
3737

38-
ruby_version = RUBY_VERSION.dup
39-
ruby_version << "p#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL)
40-
ruby_version << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION})"
41-
ruby_version << " [#{RUBY_PLATFORM}]"
38+
if defined?(RUBY_DESCRIPTION)
39+
ruby_version = RUBY_DESCRIPTION
40+
else
41+
ruby_version = RUBY_VERSION.dup
42+
ruby_version << "p#{RUBY_PATCHLEVEL}" if defined?(RUBY_PATCHLEVEL)
43+
ruby_version << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION})"
44+
ruby_version << " [#{RUBY_PLATFORM}]"
45+
end
4246

43-
puts "Here's your Ruby and OpenSSL environment:"
47+
puts "", "Here's your Ruby and OpenSSL environment:"
4448
puts
4549
puts "Ruby: %s" % ruby_version
4650
puts "RubyGems: %s" % Gem::VERSION if defined?(Gem::VERSION)
@@ -110,14 +114,14 @@ def error_reason(error)
110114
case error.message
111115
# Check for certificate errors
112116
when /certificate verify failed/
113-
abort "Your Ruby can't connect to #{host} because you are missing the certificate " \
117+
abort "Your Ruby can't connect to #{host} because you are missing the certificate\n" \
114118
"files OpenSSL needs to verify you are connecting to the genuine #{host} servers."
115119
# Check for TLS version errors
116120
when /read server hello A/, /tlsv1 alert protocol version/
117121
if ssl_version == "TLSv1_3"
118122
abort "Your Ruby can't connect to #{host} because #{ssl_version} isn't supported yet."
119123
else
120-
abort "Your Ruby can't connect to #{host} because your version of OpenSSL is too old. " \
124+
abort "Your Ruby can't connect to #{host} because your version of OpenSSL is too old.\n" \
121125
"You'll need to upgrade your OpenSSL install and/or recompile Ruby to use a newer OpenSSL."
122126
end
123127
else
@@ -138,13 +142,23 @@ def error_reason(error)
138142
guide_url = "http://ruby.to/ssl-check-failed"
139143
if bundler_status =~ /success/ && rubygems_status =~ /success/
140144
# Whoa, it seems like it's working!
141-
puts "Hooray! This Ruby can connect to #{host}. You are all set to use Bundler and RubyGems. 👌"
145+
puts "Hooray! This Ruby can connect to #{host}.",
146+
"You are all set to use Bundler and RubyGems. 👌", ""
142147
elsif rubygems_status !~ /success/
143-
puts "It looks like Ruby and Bundler can connect to #{host}, but RubyGems itself cannot. You can likely solve this by manually downloading and installing a RubyGems update. Visit #{guide_url} for instructions on how to manually upgrade RubyGems. 💎"
148+
puts "It looks like Ruby and Bundler can connect to #{host}, but RubyGems itself",
149+
"cannot. You can likely solve this by manually downloading and installing a",
150+
"RubyGems update. Visit #{guide_url} for instructions on how to manually upgrade RubyGems. 💎"
144151
elsif bundler_status !~ /success/
145-
puts "Although your Ruby installation and RubyGems can both connect to #{host}, Bundler is having trouble. The most likely way to fix this is to upgrade Bundler by running `gem install bundler`. Run this script again after doing that to make sure everything is all set. If you're still having trouble, check out the troubleshooting guide at #{guide_url} 📦"
152+
puts "Although your Ruby installation and RubyGems can both connect to #{host},",
153+
"Bundler is having trouble. The most likely way to fix this is to upgrade",
154+
"Bundler by running `gem install bundler`. Run this script again after doing",
155+
"that to make sure everything is all set. If you're still having trouble,",
156+
"check out the troubleshooting guide at #{guide_url} 📦"
146157
else
147-
puts "For some reason, your Ruby installation can connect to #{host}, but neither RubyGems nor Bundler can. The most likely fix is to manually upgrade RubyGems by following the instructions at #{guide_url}. After you've done that, run `gem install bundler` to upgrade Bundler, and then run this script again to make sure everything worked. ❣️"
158+
puts "For some reason, your Ruby installation can connect to #{host}, but neither",
159+
"RubyGems nor Bundler can. The most likely fix is to manually upgrade RubyGems by",
160+
"following the instructions at #{guide_url}. After you've done that, run `gem install",
161+
"bundler` to upgrade Bundler, and then run this script again to make sure everything worked. ❣️"
148162
end
149163

150164
def tls12_supported?
@@ -162,7 +176,7 @@ def tls12_supported?
162176
unless tls12_supported?
163177
puts
164178
puts "WARNING: Although your Ruby can connect to #{host} today, your OpenSSL is very old! 👴"
165-
puts "WARNING: You will need to upgrade OpenSSL before January 2018 in order to keep using #{host}."
179+
puts "WARNING: You will need to upgrade OpenSSL to use #{host}."
166180
abort
167181
end
168182

0 commit comments

Comments
 (0)