Skip to content

Commit

Permalink
don't worry about preserving the Rails 2 runner job_type if this is a…
Browse files Browse the repository at this point in the history
… Rails 3 app
  • Loading branch information
javan committed Oct 19, 2010
1 parent 4e0c357 commit ff0d68a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
7 changes: 6 additions & 1 deletion lib/whenever/job_types/default.rb
@@ -1,3 +1,8 @@
job_type :command, ":task"
job_type :runner, "cd :path && script/runner -e :environment ':task'"
job_type :rake, "cd :path && RAILS_ENV=:environment rake :task --silent"

if File.exists?(File.join(Whenever.path, 'script', 'rails'))
job_type :runner, "cd :path && script/rails runner -e :environment ':task'"
else
job_type :runner, "cd :path && script/runner -e :environment ':task'"
end
11 changes: 0 additions & 11 deletions lib/whenever/job_types/rails3.rb

This file was deleted.

7 changes: 1 addition & 6 deletions test/functional/output_default_defined_jobs_test.rb
Expand Up @@ -55,24 +55,19 @@ class OutputDefaultDefinedJobsTest < Test::Unit::TestCase

context "A runner for a Rails 3 app" 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)
@output = Whenever.cron \
<<-file
every 2.hours do
runner 'blahblah'
rails2_runner 'blahblah'
end
file
end

should "use the Rails 3 runner job by default" do
assert_match two_hours + %( cd /my/path && script/rails runner -e production 'blahblah'), @output
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

# rake
Expand Down

0 comments on commit ff0d68a

Please sign in to comment.