don't worry about preserving the Rails 2 runner job_type if this is a Rails 3 app
This commit is contained in:
parent
4e0c357f4d
commit
ff0d68af55
@ -1,3 +1,8 @@
|
|||||||
job_type :command, ":task"
|
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"
|
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
|
||||||
|
@ -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'"
|
|
||||||
end
|
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user