Skip to content

Commit

Permalink
Fix reported Ruby version in diagnose report (#803)
Browse files Browse the repository at this point in the history
Use the RbConfig `RUBY_PROGRAM_VERSION` that reports the full patch
version. The `ruby_version` field only reported the first major release.

Fixes appsignal/support#183
  • Loading branch information
tombruijn authored Jan 11, 2022
1 parent 591cb9e commit c9000ee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changesets/fix-reported-ruby-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix reported Ruby version in diagnose report. It would report only the first major release of the series, e.g. 2.6.0 for 2.6.1.
2 changes: 1 addition & 1 deletion ext/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def report
},
"language" => {
"name" => "ruby",
"version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
"version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
},
"download" => {
"checksum" => "unverified",
Expand Down
2 changes: 1 addition & 1 deletion lib/appsignal/cli/diagnose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def host_information
save :os, os
puts_value "Operating System", os_label

language_version = "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"
language_version = "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
save :language_version, language_version
puts_format "Ruby version", language_version

Expand Down
6 changes: 3 additions & 3 deletions spec/lib/appsignal/cli/diagnose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def dont_accept_prompt_to_send_diagnostics_report
},
"language" => {
"name" => "ruby",
"version" => "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}",
"version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}",
"implementation" => jruby ? "jruby" : "ruby"
},
"download" => {
Expand Down Expand Up @@ -295,7 +295,7 @@ def dont_accept_prompt_to_send_diagnostics_report
" Status: success",
"Language details",
" Implementation: \"#{jruby ? "jruby" : "ruby"}\"",
" Ruby version: \"#{"#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
" Ruby version: \"#{"#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"}\"",
"Download details",
" Download URL: \"https://",
" Checksum: \"verified\"",
Expand Down Expand Up @@ -604,7 +604,7 @@ def dont_accept_prompt_to_send_diagnostics_report

describe "host information" do
let(:rbconfig) { RbConfig::CONFIG }
let(:language_version) { "#{rbconfig["ruby_version"]}-p#{rbconfig["PATCHLEVEL"]}" }
let(:language_version) { "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}" }

it "outputs host information" do
run
Expand Down

0 comments on commit c9000ee

Please sign in to comment.