From 79bf9591e9548ee16fe770a70679a126d8c36f31 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sat, 7 Feb 2009 12:30:45 -0800 Subject: [PATCH] Require ruby-prof >= 0.7.3. Tighten rescue clause. --- init.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/init.rb b/init.rb index 5254a09..d3d6674 100644 --- a/init.rb +++ b/init.rb @@ -1,14 +1,17 @@ begin - require 'action_profiler' - class ActionController::Base - include ActionController::ActionProfiler - logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind." - end -rescue LoadError + gem 'ruby-prof', '>= 0.7.3' +rescue Gem::LoadError class ActionController::Base def action_profiler(*args) logger.info "`gem install ruby-prof` to enable action profiling." yield end + logger.info "Action profiling disabled. `gem install ruby-prof` to enable." + end +else + require 'action_profiler' + class ActionController::Base + include ActionController::ActionProfiler + logger.info "Action profiling enabled. Add around_filter :action_profiler to ApplicationController then append ?profile=process_time to any URL to profile the page load and download a calltree file. Open it with kcachegrind." end end