From 47f60085e9ed997e7f8b2b9d829094c94e26eb25 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Fri, 19 Sep 2014 10:33:13 +0200 Subject: Make it easier to get at version of taginfo running on a site. --- web/lib/ui/taginfo.rb | 13 ++++++++++++- web/views/taginfo/index.erb | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/web/lib/ui/taginfo.rb b/web/lib/ui/taginfo.rb index f0fb8f7..0f09122 100644 --- a/web/lib/ui/taginfo.rb +++ b/web/lib/ui/taginfo.rb @@ -34,15 +34,26 @@ class Taginfo < Sinatra::Base out end - get '/taginfo' do + def get_commit begin @commit = `git rev-parse HEAD`.chop + @commit_date = Time.parse(`git show -s --format=%ci HEAD`.chop).utc.iso8601 rescue @commit = 'unknown' + @commit_date = 'unknown' end + end + + get '/taginfo' do + get_commit erb :'taginfo/index' end + get '/taginfo/version' do + get_commit + "#{@commit} #{@commit_date}" + end + get '/taginfo/status' do content_type 'text/plain' age_in_days = DateTime.now() - DateTime.parse(@data_until) diff --git a/web/views/taginfo/index.erb b/web/views/taginfo/index.erb index 3139642..62099f6 100644 --- a/web/views/taginfo/index.erb +++ b/web/views/taginfo/index.erb @@ -12,7 +12,7 @@
  • Projects
  • Software Version

    -

    <%= @commit %>

    +

    <%= @commit_date %> (<%= @commit[0, 10] %>)

    Config Settings

    -- cgit v1.2.3
    VariableSetting