fixed conflict

This commit is contained in:
Javan Makhmali 2010-10-19 17:50:40 -04:00
commit 2effe0b32d
3 changed files with 7 additions and 18 deletions

View File

@ -1,3 +1,8 @@
job_type :command, ":task :output" job_type :command, ":task :output"
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task --silent :output" job_type :rake, "cd :path && RAILS_ENV=:environment rake :task --silent :output"
if File.exists?(File.join(Whenever.path, 'script', 'rails'))
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
else
job_type :runner, "cd :path && script/runner -e :environment ':task' :output"
end

View File

@ -1,11 +0,0 @@
# Determine if this is a Rails 3 app by looking for a script/rails file.
# If it is, preserve the Rails 2 runner job as rails2_runner and then
# define a new job for Rails 3 as the default runner.
if File.exists?(File.join(Whenever.path, 'script', 'rails'))
class_eval do
alias_method(:rails2_runner, :runner) if defined?(:runner)
end
job_type :runner, "cd :path && script/rails runner -e :environment ':task' :output"
end

View File

@ -55,13 +55,12 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
context "A runner for a Rails 3 app" do context "A runner for a Rails 3 app" do
setup do setup do
Whenever.stubs(:path).returns('/my/path') Whenever.expects(:path).at_least_once.returns('/my/path')
File.expects(:exists?).with('/my/path/script/rails').returns(true) File.expects(:exists?).with('/my/path/script/rails').returns(true)
@output = Whenever.cron \ @output = Whenever.cron \
<<-file <<-file
every 2.hours do every 2.hours do
runner 'blahblah' runner 'blahblah'
rails2_runner 'blahblah'
end end
file file
end end
@ -69,10 +68,6 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase
should "use the Rails 3 runner job by default" do should "use the Rails 3 runner job by default" do
assert_match two_hours + %( cd /my/path && script/rails runner -e production 'blahblah'), @output assert_match two_hours + %( cd /my/path && script/rails runner -e production 'blahblah'), @output
end end
should "have the Rails 2 runner job redefined as rails2_runner" do
assert_match two_hours + %( cd /my/path && script/runner -e production 'blahblah'), @output
end
end end
# rake # rake