From 5d48a55fffd1a75d6e8240bfea9982a43b103741 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Mon, 4 Jun 2012 22:33:49 +0100 Subject: Fix admin debug method > 10) admin debug (https://secure.mysociety.org/admin/foi/debug) - "you > are" - sentence that isn't finished > > 11) admin debug (https://secure.mysociety.org/admin/foi/debug) - > versioning incorrect & URLs to github malformed: > Alaveteli version: 0.5.2-297-g4ec7f6e > Alaveteli branch: (no > Alaveteli commit: 4ec7f6edbf2c00abc8464eafc889047f43533f90 --- app/controllers/admin_general_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/controllers/admin_general_controller.rb') diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb index c83ae0f37..cbe92a5ad 100644 --- a/app/controllers/admin_general_controller.rb +++ b/app/controllers/admin_general_controller.rb @@ -79,11 +79,12 @@ class AdminGeneralController < AdminController end def debug + @http_auth_user = admin_http_auth_user @current_commit = `git log -1 --format="%H"` - @current_branch = `git branch | grep "\*" | awk '{print $2}'` + @current_branch = `git branch | perl -ne 'print $1 if /^\* (.*)/'` @current_version = `git describe --always --tags` - repo = `git remote show origin -n | grep Fetch | awk '{print $3}' | sed -re 's/.*:(.*).git/\\1/'` - @github_origin = "https://github.com/#{repo.strip}/tree/" + repo = `git remote show origin -n | perl -ne 'print $1 if m{Fetch URL: .*github\.com[:/](.*)\.git}'` + @github_origin = "https://github.com/#{repo}/tree/" @request_env = request.env end end -- cgit v1.2.3 From 767890465df14263df0f8965e1b536fdefa84868 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Mon, 4 Jun 2012 22:41:59 +0100 Subject: Silly syntax bug Backslashes are interpreted twice inside backticks, once by Ruby and a second time by the shell, so you need twice as many as you think you do. --- app/controllers/admin_general_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers/admin_general_controller.rb') diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb index cbe92a5ad..2c961dfc5 100644 --- a/app/controllers/admin_general_controller.rb +++ b/app/controllers/admin_general_controller.rb @@ -81,9 +81,9 @@ class AdminGeneralController < AdminController def debug @http_auth_user = admin_http_auth_user @current_commit = `git log -1 --format="%H"` - @current_branch = `git branch | perl -ne 'print $1 if /^\* (.*)/'` + @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}'` + repo = `git remote show origin -n | perl -ne 'print $1 if m{Fetch URL: .*github\\.com[:/](.*)\\.git}'` @github_origin = "https://github.com/#{repo}/tree/" @request_env = request.env end -- cgit v1.2.3