moneypools-whenever 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/whenever/job_list.rb +1 -1
- data/lib/whenever/job_sequence.rb +4 -1
- data/moneypools-whenever.gemspec +1 -1
- data/test/in_sequence_test.rb +18 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/whenever/job_list.rb
CHANGED
@@ -5,12 +5,15 @@ module Whenever
|
|
5
5
|
def initialize(options={}, size=0, obj=nil)
|
6
6
|
super(size, obj)
|
7
7
|
|
8
|
+
@options = options
|
8
9
|
@dependent = options.fetch(:dependent, true)
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_single_job
|
12
13
|
concatenation = @dependent ? " && " : "; "
|
13
|
-
|
14
|
+
task = map(&:output).join(concatenation)
|
15
|
+
|
16
|
+
Job::Default.new(@options.merge(:task => task))
|
14
17
|
end
|
15
18
|
end
|
16
19
|
end
|
data/moneypools-whenever.gemspec
CHANGED
data/test/in_sequence_test.rb
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/test_helper")
|
2
2
|
|
3
3
|
class InSequenceTest < Test::Unit::TestCase
|
4
|
+
context "A single task in a sequence" do
|
5
|
+
setup do
|
6
|
+
@output = Whenever.cron \
|
7
|
+
<<-file
|
8
|
+
set :path, '/my/path'
|
9
|
+
every 1.day, :at => "20:15" do
|
10
|
+
in_sequence do
|
11
|
+
rake "only_task"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
file
|
15
|
+
end
|
16
|
+
|
17
|
+
should "produce an unaltered task using options from every block" do
|
18
|
+
assert_match '15 20 * * * cd /my/path && RAILS_ENV=production /usr/bin/env rake only_task', @output
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
4
22
|
context "A pair of tasks in the same time block that should be executed in a dependent sequence" do
|
5
23
|
setup do
|
6
24
|
@output = Whenever.cron \
|