From 4e0c357f4d30344b11eeada3811bd887645dbb82 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Tue, 19 Oct 2010 09:19:34 -0400 Subject: [PATCH] check if runner is defined before aliasing it --- lib/whenever/job_types/rails3.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/whenever/job_types/rails3.rb b/lib/whenever/job_types/rails3.rb index c16c0c0..336f64e 100644 --- a/lib/whenever/job_types/rails3.rb +++ b/lib/whenever/job_types/rails3.rb @@ -3,6 +3,9 @@ # define a new job for Rails 3 as the default runner. if File.exists?(File.join(Whenever.path, 'script', 'rails')) - class_eval { alias_method :rails2_runner, :runner } + class_eval do + alias_method(:rails2_runner, :runner) if defined?(:runner) + end + job_type :runner, "cd :path && script/rails runner -e :environment ':task'" end \ No newline at end of file