diff --git a/lib/whenever/job_types/runner.rb b/lib/whenever/job_types/runner.rb index 8b98bc8..edbb4f0 100644 --- a/lib/whenever/job_types/runner.rb +++ b/lib/whenever/job_types/runner.rb @@ -4,7 +4,7 @@ module Whenever def output path_required - %Q(#{File.join(@path, 'script', 'runner')} -e #{@environment} #{task.inspect}) + %Q(cd #{File.join(@path)} && script/runner -e #{@environment} #{task.inspect}) end end diff --git a/test/output_at_test.rb b/test/output_at_test.rb index c463bc1..4d84267 100644 --- a/test/output_at_test.rb +++ b/test/output_at_test.rb @@ -91,7 +91,7 @@ class OutputAtTest < Test::Unit::TestCase end should "output the runner using one entry because the times are aligned" do - assert_match '2 5,15 * * 1,3,5 /your/path/script/runner -e production "blahblah"', @output + assert_match '2 5,15 * * 1,3,5 cd /your/path && script/runner -e production "blahblah"', @output end end @@ -168,9 +168,9 @@ class OutputAtTest < Test::Unit::TestCase should "output all of the commands @daily" do assert_match '@daily cd /your/path && RAILS_ENV=production /usr/bin/env rake blah:blah', @output - assert_match '@daily /your/path/script/runner -e production "runner_1"', @output + assert_match '@daily cd /your/path && script/runner -e production "runner_1"', @output assert_match '@daily command_1', @output - assert_match '@daily /your/path/script/runner -e production "runner_2"', @output + assert_match '@daily cd /your/path && script/runner -e production "runner_2"', @output assert_match '@daily command_2', @output end end diff --git a/test/output_runner_test.rb b/test/output_runner_test.rb index b0e352c..ee02168 100644 --- a/test/output_runner_test.rb +++ b/test/output_runner_test.rb @@ -14,7 +14,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using that path" do - assert_match two_hours + ' /my/path/script/runner -e production "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e production "blahblah"', @output end end @@ -30,7 +30,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using that path" do - assert_match two_hours + ' /some/other/path/script/runner -e production "blahblah"', @output + assert_match two_hours + ' cd /some/other/path && script/runner -e production "blahblah"', @output end end @@ -47,7 +47,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using that path" do - assert_match two_hours + ' /my/path/script/runner -e production "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e production "blahblah"', @output end end @@ -65,7 +65,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "use the path" do - assert_match two_hours + ' /my/path/script/runner -e production "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e production "blahblah"', @output assert_no_match /\/rails\/path/, @output end end @@ -101,7 +101,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using that environment" do - assert_match two_hours + ' /my/path/script/runner -e silly "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e silly "blahblah"', @output end end @@ -118,7 +118,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using that environment" do - assert_match two_hours + ' /my/path/script/runner -e serious "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e serious "blahblah"', @output end end @@ -135,7 +135,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using the override environment" do - assert_match two_hours + ' /my/path/script/runner -e serious "blahblah"', @output + assert_match two_hours + ' cd /my/path && script/runner -e serious "blahblah"', @output end end @@ -152,7 +152,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using the overridden path and environment" do - assert_match two_hours + ' /serious/path/script/runner -e serious "blahblah"', @output + assert_match two_hours + ' cd /serious/path && script/runner -e serious "blahblah"', @output end end @@ -169,7 +169,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using the overridden path and environment" do - assert_match two_hours + ' /serious/path/script/runner -e serious "blahblah"', @output + assert_match two_hours + ' cd /serious/path && script/runner -e serious "blahblah"', @output end end @@ -186,7 +186,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using the original environmnet" do - assert_match two_hours + ' /silly/path/script/runner -e silly "blahblah"', @output + assert_match two_hours + ' cd /silly/path && script/runner -e silly "blahblah"', @output end end @@ -202,7 +202,7 @@ class OutputRunnerTest < Test::Unit::TestCase end should "output the runner using the original environmnet" do - assert_match two_hours + ' /my/path/script/runner -e production "Product.import(\"http://example.com/product.xml\")"', @output + assert_match two_hours + ' cd /my/path && script/runner -e production "Product.import(\"http://example.com/product.xml\")"', @output end end