rufus-scheduler 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +7 -1
- data/CREDITS.txt +1 -0
- data/README.rdoc +34 -1
- data/lib/rufus/sc/jobs.rb +0 -1
- data/lib/rufus/sc/scheduler.rb +2 -2
- metadata +4 -4
data/CHANGELOG.txt
CHANGED
@@ -2,7 +2,13 @@
|
|
2
2
|
= rufus-scheduler CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
-
== rufus-scheduler - 2.0.
|
5
|
+
== rufus-scheduler - 2.0.3 not yet released
|
6
|
+
|
7
|
+
- made sure Schedulables with a call(job) method were OK when passed as second
|
8
|
+
parameter (thanks Nate Wiger)
|
9
|
+
|
10
|
+
|
11
|
+
== rufus-scheduler - 2.0.2 released 2009/10/31
|
6
12
|
|
7
13
|
- unified JobQueue and CronJobQueue, and handed @last_second management to the
|
8
14
|
latter
|
data/CREDITS.txt
CHANGED
data/README.rdoc
CHANGED
@@ -21,7 +21,7 @@ http://github.com/hpoydar/chronic_duration
|
|
21
21
|
|
22
22
|
== installation
|
23
23
|
|
24
|
-
sudo gem install rufus-scheduler
|
24
|
+
sudo gem install rufus-scheduler --source http://gemcutter.org
|
25
25
|
|
26
26
|
|
27
27
|
== usage
|
@@ -69,6 +69,29 @@ Note that is there is EventMachine present and running,
|
|
69
69
|
will return an instance of Rufus::Scheduler::EmScheduler (leveraging EventMachine).
|
70
70
|
|
71
71
|
|
72
|
+
== scheduler.join
|
73
|
+
|
74
|
+
Note that if you have a tiny script like this one :
|
75
|
+
|
76
|
+
require 'rubygems'; require 'rufus-scheduler'
|
77
|
+
|
78
|
+
scheduler = Rufus::Scheduler.start_new
|
79
|
+
|
80
|
+
scheduler.at 'Thu Mar 26 07:31:43 +0900 2009' do
|
81
|
+
puts 'order pizza'
|
82
|
+
end
|
83
|
+
|
84
|
+
And you run it, it will exit immediately.
|
85
|
+
|
86
|
+
If you place
|
87
|
+
|
88
|
+
scheduler.join
|
89
|
+
|
90
|
+
at then end of it will make the current (main) thread join the scheduler and prevent the Ruby runtime from exiting.
|
91
|
+
|
92
|
+
You shouldn't be exposed to this issue when using EventMachine, since while running EM, your runtime won't exit.
|
93
|
+
|
94
|
+
|
72
95
|
== block parameters
|
73
96
|
|
74
97
|
Scheduled blocks accept 0 or 1 parameter (this unique parameter is the job
|
@@ -179,6 +202,16 @@ Sometimes passing a block isn't that convenient :
|
|
179
202
|
|
180
203
|
rufus-scheduler accepts anything that responds to a call method with a unique parameter (it will pass the job) as a 'schedulable'.
|
181
204
|
|
205
|
+
For compatibility with older (1.x) versions, schedulables with a trigger methods are accepted :
|
206
|
+
|
207
|
+
class JobThing
|
208
|
+
def trigger (params)
|
209
|
+
job = params[:job]
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
The 'params' correspond to the scheduler job params, and the key :job points to the rufus-scheduler job for the schedulable that is passed to a 'call schedulable'.
|
214
|
+
|
182
215
|
|
183
216
|
== looking up jobs
|
184
217
|
|
data/lib/rufus/sc/jobs.rb
CHANGED
data/lib/rufus/sc/scheduler.rb
CHANGED
@@ -33,7 +33,7 @@ module Rufus::Scheduler
|
|
33
33
|
|
34
34
|
# This gem's version
|
35
35
|
#
|
36
|
-
VERSION = '2.0.
|
36
|
+
VERSION = '2.0.3'
|
37
37
|
|
38
38
|
#
|
39
39
|
# It's OK to pass an object responding to :trigger when scheduling a job
|
@@ -265,7 +265,7 @@ module Rufus::Scheduler
|
|
265
265
|
|
266
266
|
def combine_opts (schedulable, opts)
|
267
267
|
|
268
|
-
if schedulable.respond_to?(:trigger)
|
268
|
+
if schedulable.respond_to?(:trigger) || schedulable.respond_to?(:call)
|
269
269
|
|
270
270
|
opts[:schedulable] = schedulable
|
271
271
|
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -9,11 +9,11 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-05 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: "\n job scheduler for Ruby (at, cron, in and every jobs).\n\n By default uses a Ruby thread, if EventMachine is present, it will rely on it.\n "
|
17
17
|
email: jmettraux@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- TODO.txt
|
40
40
|
- README.rdoc
|
41
41
|
has_rdoc: true
|
42
|
-
homepage: http://
|
42
|
+
homepage: http://github.com/jmettraux/rufus-scheduler
|
43
43
|
licenses: []
|
44
44
|
|
45
45
|
post_install_message:
|