aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-02-24 10:56:00 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-02-24 10:56:00 +1100
commit4f62bb900996dba5fa1c71ad688ffb2839983662 (patch)
tree3f4fe87b3c36235e6c6d33884d03b9c650c77505
parent0d78ef90a85d11a0bd5d9c092292c829968470ab (diff)
Add publicly accesible json api to query alaveteli and ruby version. Implements #834
-rw-r--r--app/controllers/general_controller.rb10
-rw-r--r--config/routes.rb1
2 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index a8bbc22ff..626c4ad87 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -230,6 +230,14 @@ class GeneralController < ApplicationController
render(:layout => false, :content_type => 'text/css')
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 3512b4cd4..8d6704a9e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -32,6 +32,7 @@ ActionController::Routing::Routes.draw do |map|
general.advanced_search '/advancedsearch', :action => 'search_redirect', :advanced => true
general.random_request '/random', :action => 'random_request'
+ general.version '/version.:format', :action => 'version'
end
map.with_options :controller => 'request' do |request|