rufus-scheduler 2.0.12 → 2.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.txt CHANGED
@@ -2,6 +2,11 @@
2
2
  = rufus-scheduler CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-scheduler - 2.0.13 released 2011/11/14
6
+
7
+ - cron lines now OK with "09". Thanks Anthony Lewis
8
+
9
+
5
10
  == rufus-scheduler - 2.0.12 released 2011/10/28
6
11
 
7
12
  - hardened exception handling. Thanks Sam Gibson
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
@@ -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 = Integer(item)
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 ? Integer(item[j+1..-1]) : 1
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 = Integer(item[0..i - 1])
245
+ istart = item[0..i - 1].to_i
245
246
 
246
- if j
247
- iend = Integer(item[i + 1..j - 1])
247
+ iend = if j
248
+ item[i + 1..j - 1].to_i
248
249
  else
249
- iend = Integer(item[i + 1..-1])
250
+ item[i + 1..-1].to_i
250
251
  end
251
252
 
252
253
  else # case */x
@@ -26,7 +26,7 @@
26
26
  module Rufus
27
27
  module Scheduler
28
28
 
29
- VERSION = '2.0.12'
29
+ VERSION = '2.0.13'
30
30
  end
31
31
  end
32
32
 
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.start
4
+ s = Rufus::Scheduler.start_new
5
5
 
6
- Rufus::Scheduler.every '10m' do
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
 
@@ -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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 12
10
- version: 2.0.12
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-10-28 00:00:00 +09:00
18
+ date: 2011-11-14 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency