Move building of stats from the template to the Rakefile