lib/tasks/statistics.rake in picky-1.5.2 vs lib/tasks/statistics.rake in picky-1.5.3

- old
+ new

@@ -1,13 +1,21 @@ -namespace :statistics do - - # desc "start the server" - # task :start => :application do - # Statistics.start unless PICKY_ENVIRONMENT == 'test' - # end - - # desc "stop the server" - # task :stop => :application do - # Statistics.stop unless PICKY_ENVIRONMENT == 'test' - # end - +# Statistics tasks. +# +namespace :stats do + task :prepare => :application do + require File.expand_path('../../picky/statistics', __FILE__) + statistics = Statistics.instance + end + task :app => :prepare do + Statistics.instance.application + puts Statistics.instance + end + task :analyze => :prepare do + begin + Statistics.instance.analyze + rescue StandardError + puts "\n\033[31mNote: rake analyze needs prepared indexes. Run rake index first.\033[m\n\n" + raise + end + puts Statistics.instance + end end \ No newline at end of file