rufus-scheduler 2.0.12 → 2.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +5 -0
- data/CREDITS.txt +1 -0
- data/lib/rufus/sc/cronline.rb +7 -6
- data/lib/rufus/sc/version.rb +1 -1
- data/release.txt +11 -2
- data/spec/cronline_spec.rb +10 -0
- metadata +4 -4
data/CHANGELOG.txt
CHANGED
data/CREDITS.txt
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
== Contributors
|
6
6
|
|
7
|
+
- Anthony Lewis (https://github.com/anthonylewis) cron lines and 09 issue
|
7
8
|
- concept47 (https://github.com/concept47) every and :discard_past
|
8
9
|
- Chris Kampemeier (http://github.com/chrisk) rspec 2.0 refinements
|
9
10
|
- Tanzeeb Khalili (http://github.com/tanzeeb) cron and timezones
|
data/lib/rufus/sc/cronline.rb
CHANGED
@@ -190,6 +190,7 @@ module Rufus
|
|
190
190
|
) if it.index('-')
|
191
191
|
|
192
192
|
(monthdays ||= []) << it
|
193
|
+
|
193
194
|
else
|
194
195
|
|
195
196
|
WEEKDAYS.each_with_index { |a, i| it.gsub!(/#{a}/, i.to_s) }
|
@@ -212,7 +213,7 @@ module Rufus
|
|
212
213
|
return parse_list(item, min, max) if item.index(',')
|
213
214
|
return parse_range(item, min, max) if item.index('*') or item.index('-')
|
214
215
|
|
215
|
-
i =
|
216
|
+
i = item.to_i
|
216
217
|
|
217
218
|
i = min if i < min
|
218
219
|
i = max if i > max
|
@@ -234,19 +235,19 @@ module Rufus
|
|
234
235
|
|
235
236
|
return item.to_i if (not i and not j)
|
236
237
|
|
237
|
-
inc = j ?
|
238
|
+
inc = j ? item[j + 1..-1].to_i : 1
|
238
239
|
|
239
240
|
istart = -1
|
240
241
|
iend = -1
|
241
242
|
|
242
243
|
if i
|
243
244
|
|
244
|
-
istart =
|
245
|
+
istart = item[0..i - 1].to_i
|
245
246
|
|
246
|
-
if j
|
247
|
-
|
247
|
+
iend = if j
|
248
|
+
item[i + 1..j - 1].to_i
|
248
249
|
else
|
249
|
-
|
250
|
+
item[i + 1..-1].to_i
|
250
251
|
end
|
251
252
|
|
252
253
|
else # case */x
|
data/lib/rufus/sc/version.rb
CHANGED
data/release.txt
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
Rufus-scheduler is a thread-based scheduler written in Ruby. It lets you write code like
|
2
2
|
|
3
3
|
[sourcecode language="ruby"]
|
4
|
-
Rufus::Scheduler.
|
4
|
+
s = Rufus::Scheduler.start_new
|
5
5
|
|
6
|
-
|
6
|
+
s.every '10m' do
|
7
|
+
puts 'open the window for the cat'
|
8
|
+
end
|
9
|
+
|
10
|
+
s.at '2012-01-01 12:00' do
|
11
|
+
puts 'reminder: wife's birthday'
|
12
|
+
end
|
13
|
+
|
14
|
+
s.cron '0 22 * * 1-5' do
|
15
|
+
puts 'activate the security system'
|
7
16
|
end
|
8
17
|
[/sourcecode]
|
9
18
|
|
data/spec/cronline_spec.rb
CHANGED
@@ -84,6 +84,16 @@ describe Rufus::CronLine do
|
|
84
84
|
Rufus::CronLine.new('* * * * sun#1-sun#2')
|
85
85
|
}.should raise_error(ArgumentError)
|
86
86
|
end
|
87
|
+
|
88
|
+
it 'accepts items with initial 0' do
|
89
|
+
|
90
|
+
to_a '09 * * * *', [ [0], [9], nil, nil, nil, nil, nil, nil ]
|
91
|
+
to_a '09-12 * * * *', [ [0], [9, 10, 11, 12], nil, nil, nil, nil, nil, nil ]
|
92
|
+
to_a '07-08 * * * *', [ [0], [7, 8], nil, nil, nil, nil, nil, nil ]
|
93
|
+
to_a '* */08 * * *', [ [0], nil, [0, 8, 16, 24], nil, nil, nil, nil, nil ]
|
94
|
+
to_a '* 01-09/04 * * *', [ [0], nil, [1, 5, 9], nil, nil, nil, nil, nil ]
|
95
|
+
to_a '* * * * 06', [ [0], nil, nil, nil, nil, [6], nil, nil ]
|
96
|
+
end
|
87
97
|
end
|
88
98
|
|
89
99
|
describe '#next_time' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 13
|
10
|
+
version: 2.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Mettraux
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-11-14 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|