Mercurial > hg > soundsoftware-site
changeset 980:9b4919de5317 cannam
Print out the results
author | Chris Cannam |
---|---|
date | Thu, 25 Oct 2012 14:19:42 +0100 |
parents | 56a38a9f6204 |
children | 3469444470cb 6edb748be064 |
files | extra/soundsoftware/get-apache-log-stats.rb |
diffstat | 1 files changed, 22 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/soundsoftware/get-apache-log-stats.rb Thu Oct 25 14:08:58 2012 +0100 +++ b/extra/soundsoftware/get-apache-log-stats.rb Thu Oct 25 14:19:42 2012 +0100 @@ -1,6 +1,6 @@ -# Read an Apache log file from the SoundSoftware site and produce some -# per-project stats. +# Read an Apache log file in SoundSoftware site format from stdin and +# produce some per-project stats. # # Invoke with e.g. # @@ -55,6 +55,12 @@ end end +def print_stats(h) + h.keys.sort { |a,b| h[b] <=> h[a] }.each do |p| + print h[p], " ", @projects[p].name, "\n" + end +end + STDIN.each do |line| record = parser.parse(line) @@ -131,7 +137,6 @@ next end - project = project.split("?")[0] hits[project] += 1 end @@ -146,11 +151,20 @@ pulls[project] -= 1 end -print clones, "\n" -print pulls, "\n" -print pushes, "\n" -print zips, "\n" -print hits, "\n" +print "\nMercurial clones:\n" +print_stats clones + +print "\nMercurial pulls (excluding clones):\n" +print_stats pulls + +print "\nMercurial pushes:\n" +print_stats pushes + +print "\nMercurial archive (zip file) downloads:\n" +print_stats zips + +print "\nProject page hits:\n" +print_stats hits print parseable, " parseable\n" print unparseable, " unparseable\n"