From 4a9a9f2b89faab2caa0ed343d8cd56f525fa85d9 Mon Sep 17 00:00:00 2001 From: Konstantin Gredeskoul Date: Mon, 13 May 2024 13:05:25 -0700 Subject: [PATCH] Add app revision and link to the footer --- .version | 2 +- app/views/layouts/application.html.haml | 15 +++++++-------- config/application.rb | 13 +++++++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.version b/.version index 7dea76ed..6d7de6e6 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.0.1 +1.0.2 diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 3c8b4866..d821ad88 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -48,12 +48,11 @@ Crafted with ♡ in San Francisco — © CFAEA 2010-#{Date.current.strftime('%Y')} All rights reserved. %br - App Version #{TicketBooth::Application::VERSION}, - Rails - = Rails.version - , Ruby - = RUBY_VERSION - , In - = Rails.env - mode + App Version #{TicketBooth::Application::VERSION} + | Revision + %a{href: "https://github.com/fnf-org/TicketBooth/commit/#{TicketBooth::Application::REVISION}", target: "_blank" } + = TicketBooth::Application::REVISION + | Rails #{Rails.version} + | Ruby #{RUBY_VERSION} + | #{Rails.env.to_s.capitalize} Env diff --git a/config/application.rb b/config/application.rb index cd28c38d..9026fa7f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -35,7 +35,16 @@ def xmlschema; end module TicketBooth class Application < Rails::Application # Application Version - VERSION = File.read('.version').freeze + VERSION = File.read('.version').freeze + + # Read the latest revision + REVISION = if File.exist?('REVISION') + File.read('REVISION').strip + elsif Dir.exist?('.git') + `git rev-parse --short HEAD`.strip + else + VERSION + end # Initialize configuration defaults for originally generated Rails version. config.load_defaults 7.1 @@ -76,6 +85,6 @@ class Application < Rails::Application config.active_job.queue_adapter = ActiveJob::QueueAdapters::AsyncAdapter.new \ min_threads: 1, max_threads: 3, - idletime: 30.seconds + idletime: 30.seconds end end