ruby.rb 752 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class SystemReport::Plugin::Ruby < SystemReport::Plugin
  3. DESCRIPTION = __('Ruby information (version and installed gems)').freeze
  4. def fetch
  5. {
  6. interpreter: interpreter,
  7. gems: gems,
  8. }.deep_symbolize_keys
  9. end
  10. private
  11. def interpreter
  12. {
  13. platform: RUBY_PLATFORM,
  14. version: RUBY_VERSION,
  15. engine: RUBY_ENGINE,
  16. patchlevel: RUBY_PATCHLEVEL,
  17. description: RUBY_DESCRIPTION,
  18. release_date: RUBY_RELEASE_DATE,
  19. }
  20. end
  21. def gems
  22. gems = Bundler.load.specs.reject { |s| s.name == 'bundler' }
  23. gems.sort_by(&:name).to_h { |s| [s.name, s.version.to_s || s.git_version.to_s] }
  24. end
  25. end