Skip to content

Commit

Permalink
Fix Ruby and JRuby versions in install report (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombruijn authored Jan 12, 2024
1 parent 307ac7a commit fe71d78
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "fix"
---

Fix reporting of the Ruby syntax version and JRuby version in install report better.
1 change: 1 addition & 0 deletions ext/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ task :default do

library_type = "dynamic"
report["language"]["implementation"] = "jruby"
report["language"]["implementation_version"] = JRUBY_VERSION
report["build"]["library_type"] = library_type
next unless check_architecture

Expand Down
5 changes: 4 additions & 1 deletion ext/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ def report
@report ||=
begin
rbconfig = RbConfig::CONFIG
patchlevel = rbconfig["PATCHLEVEL"]
patchlevel_label = "-p#{patchlevel}" if patchlevel
ruby_version = "#{RUBY_VERSION}#{patchlevel_label}"
{
"result" => {
"status" => "incomplete"
},
"language" => {
"name" => "ruby",
"version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}"
"version" => ruby_version
},
"download" => {
"checksum" => "unverified"
Expand Down
12 changes: 7 additions & 5 deletions spec/lib/appsignal/cli/diagnose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,17 @@ def dont_accept_prompt_to_send_diagnostics_report
it "adds the installation report to the diagnostics report" do
run
jruby = Appsignal::System.jruby?
language = {
"name" => "ruby",
"version" => "#{RUBY_VERSION}#{"-p#{rbconfig["PATCHLEVEL"]}" unless jruby}",
"implementation" => jruby ? "jruby" : "ruby"
}
language["implementation_version"] = JRUBY_VERSION if jruby
expect(received_report["installation"]).to match(
"result" => {
"status" => "success"
},
"language" => {
"name" => "ruby",
"version" => "#{rbconfig["RUBY_PROGRAM_VERSION"]}-p#{rbconfig["PATCHLEVEL"]}",
"implementation" => jruby ? "jruby" : "ruby"
},
"language" => language,
"download" => {
"download_url" => kind_of(String),
"checksum" => "verified",
Expand Down

0 comments on commit fe71d78

Please sign in to comment.