rufus-scheduler 3.1.8 → 3.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe6be00fcf61f4df224dfe810d39b370cd34dc70
4
- data.tar.gz: 92527aec3d327a51f57f53bda26e369e247a33bf
3
+ metadata.gz: 03122e92f3b47a4af3d12b06762f5f4caa604341
4
+ data.tar.gz: 8db6b1570347d1ffa1871fe9d90163729fbf7516
5
5
  SHA512:
6
- metadata.gz: 48531b28fdb9af27e37fd8f94188f0144d8542294e039df27c8c0476bfadb8a82f3623cf915e6ff1fe0e114675cd640697a4ad43e50cc9e423e70afe3626f6a9
7
- data.tar.gz: 2bdaacf21eec775ce0a76208e8b1a1dc009c77717144d4897d79af8875915585dcf0d565363524dc27932388e12ac1de5c000f9e6775b511fe044d5d14f2b022
6
+ metadata.gz: 0bf2d0ab22e975dc6832fc651dd415708a998960b4b9503865fe560c9b78284b54ac2b5957d8c912d1415776898e211eb6fe6a56c456613df85f5b4afcf35e0f
7
+ data.tar.gz: 52b001210ccea2c628e4a95e2bde023725cbb1ce9ee78bd635cfedddafcbed9851abda8eb0edb46e5816ba7ddc80e55dae256588a6caf079f9ebd126d5dbd3c7
@@ -2,6 +2,12 @@
2
2
  = rufus-scheduler CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-scheduler - 3.1.9 released 2015-11-12
6
+
7
+ - fix potential RuntimeError in CronLine#prev_second,
8
+ by Alexandru https://github.com/alexandru-calinoiu
9
+
10
+
5
11
  == rufus-scheduler - 3.1.8 released 2015-11-10
6
12
 
7
13
  - stop jumping eagerly out of DST, fix for one hour jump when leaving DST
@@ -4,6 +4,7 @@
4
4
 
5
5
  == Contributors
6
6
 
7
+ - Calinoiu Alexandru Nicolae (https://github.com/alexandru-calinoiu) CronLine#prev_second fix
7
8
  - Alyssa Pohahau (https://github.com/alyssa) out of DST transition specs
8
9
  - Claude Vessaz (https://github.com/claudeatsafe) ack #unscheduled_at in #scheduled?
9
10
  - 김성식 (https://github.com/kssminus) job id uniqueness effort
@@ -39,7 +39,7 @@ module Rufus
39
39
  require 'rufus/scheduler/job_array'
40
40
  require 'rufus/scheduler/locks'
41
41
 
42
- VERSION = '3.1.8'
42
+ VERSION = '3.1.9'
43
43
 
44
44
  #
45
45
  # A common error class for rufus-scheduler
@@ -286,6 +286,8 @@ class Rufus::Scheduler
286
286
 
287
287
  secs = toa(@seconds)
288
288
 
289
+ return time.sec + 60 - secs.last if time.sec < secs.first
290
+
289
291
  secs.pop while time.sec < secs.last
290
292
 
291
293
  time.sec - secs.last
@@ -46,6 +46,9 @@ describe Rufus::Scheduler::CronLine do
46
46
  def ns(cronline, now)
47
47
  Rufus::Scheduler::CronLine.new(cronline).next_second(now)
48
48
  end
49
+ def ps(cronline, now)
50
+ Rufus::Scheduler::CronLine.new(cronline).prev_second(now)
51
+ end
49
52
 
50
53
  def match(line, time)
51
54
  expect(cl(line).matches?(time)).to eq(true)
@@ -472,6 +475,26 @@ describe Rufus::Scheduler::CronLine do
472
475
  end
473
476
  end
474
477
 
478
+ describe '#prev_second' do
479
+
480
+ it 'returns the time to the closest previous second' do
481
+
482
+ t = local(1970, 1, 1, 1, 1, 42)
483
+
484
+ expect(ps('35,44 * * * * *', t)).to eq(7)
485
+ end
486
+
487
+ context 'when time sec is lower then all cron seconds (gh-177)' do
488
+
489
+ it 'returns the time to the last second a minute before' do
490
+
491
+ t = local(1970, 1, 1, 1, 1, 42)
492
+
493
+ expect(ps('43,44 * * * * *', t)).to eq(58)
494
+ end
495
+ end
496
+ end
497
+
475
498
  describe '#previous_time' do
476
499
 
477
500
  it 'returns the previous time the cron should have triggered' do
@@ -489,6 +512,27 @@ describe Rufus::Scheduler::CronLine do
489
512
  pt('* * * * * sun', lo(1970, 1, 1))).to eq(lo(1969, 12, 28, 23, 59, 59))
490
513
  end
491
514
 
515
+ it 'jumps to the previous minute if necessary (gh-177)' do
516
+
517
+ t = local(1970, 12, 31, 1, 1, 0) # vanilla
518
+ expect(pt('43,44 * * * * *', t)).to eq(lo(1970, 12, 31, 1, 0, 44))
519
+
520
+ t = local(1970, 12, 31, 1, 1, 30) # 30 < 43 <---- here!
521
+ expect(pt('43,44 * * * * *', t)).to eq(lo(1970, 12, 31, 1, 0, 44))
522
+
523
+ t = local(1970, 12, 31, 1, 1, 43) # 43 <= 43 < 44
524
+ expect(pt('43,44 * * * * *', t)).to eq(lo(1970, 12, 31, 1, 0, 44))
525
+
526
+ t = local(1970, 12, 31, 1, 1, 44) # 44 <= 44
527
+ expect(pt('43,44 * * * * *', t)).to eq(lo(1970, 12, 31, 1, 1, 43))
528
+
529
+ t = local(1970, 12, 31, 1, 1, 59) # 44 < 59
530
+ expect(pt('43,44 * * * * *', t)).to eq(lo(1970, 12, 31, 1, 1, 44))
531
+
532
+ t = local(1970, 12, 31, 1, 1, 30) # a bigger jump
533
+ expect(pt('43,44 10 * * * *', t)).to eq(lo(1970, 12, 31, 0, 10, 44))
534
+ end
535
+
492
536
  # New York EST: UTC-5
493
537
  # summer (dst) EDT: UTC-4
494
538
 
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-scheduler
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.8
4
+ version: 3.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.13.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.13.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: chronic
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: tzinfo
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: job scheduler for Ruby (at, cron, in and every jobs).
@@ -73,7 +73,14 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - CHANGELOG.txt
77
+ - CREDITS.txt
78
+ - LICENSE.txt
79
+ - README.md
76
80
  - Rakefile
81
+ - TODO.txt
82
+ - lib/rufus-scheduler.rb
83
+ - lib/rufus/scheduler.rb
77
84
  - lib/rufus/scheduler/cronline.rb
78
85
  - lib/rufus/scheduler/job_array.rb
79
86
  - lib/rufus/scheduler/jobs.rb
@@ -81,8 +88,7 @@ files:
81
88
  - lib/rufus/scheduler/util.rb
82
89
  - lib/rufus/scheduler/zones.rb
83
90
  - lib/rufus/scheduler/zotime.rb
84
- - lib/rufus/scheduler.rb
85
- - lib/rufus-scheduler.rb
91
+ - rufus-scheduler.gemspec
86
92
  - spec/basics_spec.rb
87
93
  - spec/cronline_spec.rb
88
94
  - spec/error_spec.rb
@@ -108,13 +114,7 @@ files:
108
114
  - spec/spec_helper.rb
109
115
  - spec/threads_spec.rb
110
116
  - spec/zotime_spec.rb
111
- - rufus-scheduler.gemspec
112
- - CHANGELOG.txt
113
- - CREDITS.txt
114
- - LICENSE.txt
115
117
  - t.txt
116
- - TODO.txt
117
- - README.md
118
118
  homepage: http://github.com/jmettraux/rufus-scheduler
119
119
  licenses:
120
120
  - MIT
@@ -125,17 +125,17 @@ require_paths:
125
125
  - lib
126
126
  required_ruby_version: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project: rufus
138
- rubygems_version: 2.0.14
138
+ rubygems_version: 2.2.2
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: job scheduler for Ruby (at, cron, in and every jobs)