rufus-scheduler 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +11 -0
- data/CREDITS.txt +1 -0
- data/README.txt +30 -2
- data/lib/rufus/cronline.rb +304 -0
- data/lib/rufus/otime.rb +14 -0
- data/lib/rufus/scheduler.rb +194 -447
- data/test/cronline_test.rb +0 -1
- data/test/scheduler_0_test.rb +7 -5
- data/test/scheduler_1_test.rb +3 -5
- data/test/scheduler_3_test.rb +1 -1
- data/test/scheduler_4_test.rb +1 -1
- data/test/scheduler_7_test.rb +51 -0
- data/test/test.rb +1 -0
- metadata +5 -3
data/test/cronline_test.rb
CHANGED
data/test/scheduler_0_test.rb
CHANGED
@@ -62,7 +62,7 @@ class Scheduler0Test < Test::Unit::TestCase
|
|
62
62
|
scheduler = Rufus::Scheduler.new
|
63
63
|
scheduler.start
|
64
64
|
|
65
|
-
sid = scheduler.
|
65
|
+
sid = scheduler.in('1s') do
|
66
66
|
$var = "ok..1"
|
67
67
|
end
|
68
68
|
|
@@ -144,7 +144,7 @@ class Scheduler0Test < Test::Unit::TestCase
|
|
144
144
|
|
145
145
|
es = EverySchedulable.new
|
146
146
|
|
147
|
-
job_id = scheduler.
|
147
|
+
job_id = scheduler.every "500", es
|
148
148
|
|
149
149
|
#puts "1 job_id : " + job_id.to_s
|
150
150
|
|
@@ -160,6 +160,9 @@ class Scheduler0Test < Test::Unit::TestCase
|
|
160
160
|
|
161
161
|
assert_equal 6, es.count
|
162
162
|
|
163
|
+
assert_nil scheduler.get_job(job_id)
|
164
|
+
assert_equal 1, scheduler.every_job_count # one left from before
|
165
|
+
|
163
166
|
# done
|
164
167
|
|
165
168
|
scheduler.sstop
|
@@ -265,12 +268,11 @@ class Scheduler0Test < Test::Unit::TestCase
|
|
265
268
|
#
|
266
269
|
def test_8b
|
267
270
|
|
268
|
-
scheduler = Rufus::Scheduler.
|
269
|
-
scheduler.start
|
271
|
+
scheduler = Rufus::Scheduler.start_new
|
270
272
|
|
271
273
|
var = nil
|
272
274
|
|
273
|
-
job_id = scheduler.
|
275
|
+
job_id = scheduler.at(Time.now.to_s, :discard_past => true) do
|
274
276
|
var = "something"
|
275
277
|
end
|
276
278
|
|
data/test/scheduler_1_test.rb
CHANGED
@@ -47,8 +47,7 @@ class Scheduler1Test < Test::Unit::TestCase
|
|
47
47
|
|
48
48
|
def test_1
|
49
49
|
|
50
|
-
scheduler = Rufus::Scheduler.
|
51
|
-
scheduler.start
|
50
|
+
scheduler = Rufus::Scheduler.start_new
|
52
51
|
|
53
52
|
job_id = scheduler.schedule_every "500", :tags => "Avery" do
|
54
53
|
# don't do a thing
|
@@ -59,8 +58,8 @@ class Scheduler1Test < Test::Unit::TestCase
|
|
59
58
|
count = 1
|
60
59
|
|
61
60
|
200_000.times do
|
62
|
-
#assert_equal 1, scheduler.find_jobs("Avery").size
|
63
61
|
count = scheduler.find_jobs("Avery").size
|
62
|
+
#p scheduler.instance_variable_get(:@non_cron_jobs).keys if count != 1
|
64
63
|
break if count != 1
|
65
64
|
end
|
66
65
|
|
@@ -74,8 +73,7 @@ class Scheduler1Test < Test::Unit::TestCase
|
|
74
73
|
#
|
75
74
|
def _test_2
|
76
75
|
|
77
|
-
scheduler = Rufus::Scheduler.
|
78
|
-
scheduler.start
|
76
|
+
scheduler = Rufus::Scheduler.start_new
|
79
77
|
last = nil
|
80
78
|
job_id = scheduler.schedule_every "1s" do
|
81
79
|
t = Time.now
|
data/test/scheduler_3_test.rb
CHANGED
@@ -41,7 +41,7 @@ class Scheduler3Test < Test::Unit::TestCase
|
|
41
41
|
scheduler.schedule "* * * * *", :tags => "fish" do
|
42
42
|
value = "cron-fish"
|
43
43
|
end
|
44
|
-
scheduler.
|
44
|
+
scheduler.cron "* * * * *", :tags => "vegetable" do
|
45
45
|
value = "daikon"
|
46
46
|
end
|
47
47
|
|
data/test/scheduler_4_test.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# Testing the 'rufus-scheduler'
|
4
|
+
#
|
5
|
+
# John Mettraux at openwfe.org
|
6
|
+
#
|
7
|
+
# Sun Jul 13 19:20:27 JST 2008
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'test/unit'
|
11
|
+
require 'rufus/scheduler'
|
12
|
+
|
13
|
+
|
14
|
+
#
|
15
|
+
# checking if bug #20893 got fixed
|
16
|
+
#
|
17
|
+
|
18
|
+
class Scheduler7Test < Test::Unit::TestCase
|
19
|
+
|
20
|
+
#def setup
|
21
|
+
#end
|
22
|
+
|
23
|
+
#def teardown
|
24
|
+
#end
|
25
|
+
|
26
|
+
def test_0
|
27
|
+
|
28
|
+
count = 0
|
29
|
+
|
30
|
+
s = Rufus::Scheduler.start_new
|
31
|
+
|
32
|
+
job_id = s.schedule_every('5s') do |job_id, at, params|
|
33
|
+
count += 1
|
34
|
+
sleep 3
|
35
|
+
end
|
36
|
+
|
37
|
+
sleep 6
|
38
|
+
|
39
|
+
assert_equal 1, s.every_job_count
|
40
|
+
|
41
|
+
s.unschedule job_id
|
42
|
+
|
43
|
+
sleep 6
|
44
|
+
|
45
|
+
s.stop
|
46
|
+
|
47
|
+
assert_equal 0, s.every_job_count
|
48
|
+
assert_equal 1, count
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/test/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-07-18 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/openwfe/util
|
29
29
|
- lib/openwfe/util/scheduler.rb
|
30
30
|
- lib/rufus
|
31
|
+
- lib/rufus/cronline.rb
|
31
32
|
- lib/rufus/otime.rb
|
32
33
|
- lib/rufus/scheduler.rb
|
33
34
|
- test/cron_test.rb
|
@@ -40,6 +41,7 @@ files:
|
|
40
41
|
- test/scheduler_4_test.rb
|
41
42
|
- test/scheduler_5_test.rb
|
42
43
|
- test/scheduler_6_test.rb
|
44
|
+
- test/scheduler_7_test.rb
|
43
45
|
- test/scheduler_name_test.rb
|
44
46
|
- test/test.rb
|
45
47
|
- test/time_0_test.rb
|
@@ -69,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
71
|
requirements: []
|
70
72
|
|
71
73
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.2.0
|
73
75
|
signing_key:
|
74
76
|
specification_version: 2
|
75
77
|
summary: scheduler for Ruby (at, cron and every jobs), formerly known as 'openwferu-scheduler'
|