Sha256: 250d0f30e3ce703fefd0e0a2f28a8d597c3a38c14e226ff54d994278a640d8a4

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

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 --abbrev=7;`.strip
        git_datetime = `cd #{Rails.root}; git log -1 --format=%cd;`.strip
        git = { 'Root Git' => "#{git_tag} (#{git_datetime})" }.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

    def self.db_schema
        Database.db_schema
    rescue StandardError => e
        error(e.message)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marty-14.0.0 lib/marty/diagnostic/version.rb
marty-13.0.2 lib/marty/diagnostic/version.rb