lib/marty/diagnostic/version.rb in marty-8.0.0 vs lib/marty/diagnostic/version.rb in marty-8.2.0

- old
+ new

@@ -1,30 +1,40 @@ -module Marty::Diagnostic; class Version < Base - diagnostic_fn do - begin - message = `cd #{Rails.root}; git describe --tags --always;`.strip - rescue StandardError - message = error('Failed accessing git') +module Marty::Diagnostic + class Version < Base + diagnostic_fn do + begin + submodules = `cd #{Rails.root}; git submodule`.split("\n").map do |s| + sha, path, tag = s.split + name = File.basename(path) + { + "#{name}_sha".titleize => sha[0..7], + "#{name}_tag".titleize => tag, + } + end.reduce(&:merge) || {} + + git_tag = `cd #{Rails.root}; git describe --tags --always;`.strip + git = { 'Root Git' => git_tag }.merge(submodules) + rescue StandardError + git = { 'Root Git' => error('Failed accessing git') } + end + rbv = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_PLATFORM})" + { + 'Marty' => Marty::VERSION, + 'Delorean' => Delorean::VERSION, + 'Mcfly' => Mcfly::VERSION, + 'Rails' => Rails.version, + 'Netzke Core' => Netzke::Core::VERSION, + 'Netzke Basepack' => Netzke::Basepack::VERSION, + 'Ruby' => rbv, + 'RubyGems' => Gem::VERSION, + 'Database Schema Version' => db_schema, + 'Environment' => Rails.env, + }.merge(git) end - rbv = "#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_PLATFORM})" - { - 'Marty' => Marty::VERSION, - 'Delorean' => Delorean::VERSION, - 'Mcfly' => Mcfly::VERSION, - 'Git' => message, - 'Rails' => Rails.version, - 'Netzke Core' => Netzke::Core::VERSION, - 'Netzke Basepack' => Netzke::Basepack::VERSION, - 'Ruby' => rbv, - 'RubyGems' => Gem::VERSION, - 'Database Schema Version' => db_schema, - 'Environment' => Rails.env, - } - end - def self.db_schema - Database.db_schema - rescue StandardError => e - error(e.message) + def self.db_schema + Database.db_schema + rescue StandardError => e + error(e.message) + end end -end end