aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/admin_general_controller.rb2
-rw-r--r--app/controllers/application_controller.rb4
-rw-r--r--app/controllers/general_controller.rb9
-rw-r--r--config/routes.rb1
4 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index b64fcac3e..ec5f95eda 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -134,7 +134,7 @@ class AdminGeneralController < AdminController
def debug
@admin_current_user = admin_current_user
- @current_commit = `git log -1 --format="%H"`
+ @current_commit = alaveteli_git_commit
@current_branch = `git branch | perl -ne 'print $1 if /^\\* (.*)/'`
@current_version = `git describe --always --tags`
repo = `git remote show origin -n | perl -ne 'print $1 if m{Fetch URL: .*github\\.com[:/](.*)\\.git}'`
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 535f893f0..88b107861 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -545,6 +545,10 @@ class ApplicationController < ActionController::Base
return country
end
+ def alaveteli_git_commit
+ `git log -1 --format="%H"`.strip
+ end
+
# URL generating functions are needed by all controllers (for redirects),
# views (for links) and mailers (for use in emails), so include them into
# all of all.
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 15f5df840..939dd1739 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -214,5 +214,14 @@ class GeneralController < ApplicationController
raise RouteNotFound
end
+ def version
+ respond_to do |format|
+ format.json { render :json => {
+ :alaveteli_git_commit => alaveteli_git_commit,
+ :alaveteli_version => ALAVETELI_VERSION,
+ :ruby_version => RUBY_VERSION
+ }}
+ end
+ end
end
diff --git a/config/routes.rb b/config/routes.rb
index 062973e37..5af94768c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -23,6 +23,7 @@ Alaveteli::Application.routes.draw do
match '/search/*combined/all' => 'general#search', :as => :search_general, :view => 'all'
match '/search(/*combined)' => 'general#search', :as => :search_general
match '/advancedsearch' => 'general#search_redirect', :as => :advanced_search, :advanced => true
+ match '/version.:format' => 'general#version', :as => :version
#####
##### Request controller