rufus-scheduler 3.1.9 → 3.1.10

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: 03122e92f3b47a4af3d12b06762f5f4caa604341
4
- data.tar.gz: 8db6b1570347d1ffa1871fe9d90163729fbf7516
3
+ metadata.gz: 5b6294bd5d0ba45b0ae97cd681c4a915d3f4f15d
4
+ data.tar.gz: 1670414782d681e46791acd641524cde44aa8063
5
5
  SHA512:
6
- metadata.gz: 0bf2d0ab22e975dc6832fc651dd415708a998960b4b9503865fe560c9b78284b54ac2b5957d8c912d1415776898e211eb6fe6a56c456613df85f5b4afcf35e0f
7
- data.tar.gz: 52b001210ccea2c628e4a95e2bde023725cbb1ce9ee78bd635cfedddafcbed9851abda8eb0edb46e5816ba7ddc80e55dae256588a6caf079f9ebd126d5dbd3c7
6
+ metadata.gz: 769cdd5e8e86acb0f4a7dfac068710a0cc12210604604cd7423ea896b9ce2bd68b4f7bd16932c9122577d1121ebc05db7e15af76403e63ff404a60e35d6c96f6
7
+ data.tar.gz: cf3b2a402f6bad0411cdba7e9ce8a62021de7cd90bbfb4db321cd3b11b19af28dee9a87c3d1d481957f73a766cd84200a4eaccceb804365003f276876fb798b9
@@ -2,6 +2,13 @@
2
2
  = rufus-scheduler CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-scheduler - 3.1.10 released 2015-11-18
6
+
7
+ - allow for :first_in => 0, gh-179 by https://github.com/JonMcPherson
8
+ for https://github.com/Shopify/dashing/commit/ea3730fa4
9
+ - stop shipping specs in gem
10
+
11
+
5
12
  == rufus-scheduler - 3.1.9 released 2015-11-12
6
13
 
7
14
  - fix potential RuntimeError in CronLine#prev_second,
@@ -4,6 +4,7 @@
4
4
 
5
5
  == Contributors
6
6
 
7
+ - Jon McPherson (https://github.com/JonMcPherson) :first_in => 0 back
7
8
  - Calinoiu Alexandru Nicolae (https://github.com/alexandru-calinoiu) CronLine#prev_second fix
8
9
  - Alyssa Pohahau (https://github.com/alyssa) out of DST transition specs
9
10
  - Claude Vessaz (https://github.com/claudeatsafe) ack #unscheduled_at in #scheduled?
data/README.md CHANGED
@@ -123,7 +123,6 @@ Yes, issues can be reported in [rufus-scheduler issues](https://github.com/jmett
123
123
  * [I want a refund](http://blog.nodejitsu.com/getting-refunds-on-open-source-projects)
124
124
  * [Passenger and rufus-scheduler](http://stackoverflow.com/questions/18108719/debugging-rufus-scheduler/18156180#18156180)
125
125
  * [Passenger and rufus-scheduler (2)](http://stackoverflow.com/questions/21861387/rufus-cron-job-not-working-in-apache-passenger#answer-21868555)
126
- * [Unicorn and rufus-scheduler](https://jkraemer.net/running-rufus-scheduler-in-a-unicorn-rails-app)
127
126
 
128
127
 
129
128
  ## scheduling
@@ -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.9'
42
+ VERSION = '3.1.10'
43
43
 
44
44
  #
45
45
  # A common error class for rufus-scheduler
@@ -629,7 +629,7 @@ module Rufus
629
629
 
630
630
  job = job_class.new(self, t, opts, block || callable)
631
631
 
632
- raise ArgumentError.new(
632
+ fail ArgumentError.new(
633
633
  "job frequency (#{job.frequency}) is higher than " +
634
634
  "scheduler frequency (#{@frequency})"
635
635
  ) if job.respond_to?(:frequency) && job.frequency < @frequency
@@ -48,7 +48,7 @@ class Rufus::Scheduler
48
48
 
49
49
  def initialize(line)
50
50
 
51
- raise ArgumentError.new(
51
+ fail ArgumentError.new(
52
52
  "not a string: #{line.inspect}"
53
53
  ) unless line.is_a?(String)
54
54
 
@@ -58,7 +58,7 @@ class Rufus::Scheduler
58
58
 
59
59
  @timezone = items.pop if ZoTime.is_timezone?(items.last)
60
60
 
61
- raise ArgumentError.new(
61
+ fail ArgumentError.new(
62
62
  "not a valid cronline : '#{line}'"
63
63
  ) unless items.length == 5 or items.length == 6
64
64
 
@@ -73,7 +73,7 @@ class Rufus::Scheduler
73
73
 
74
74
  [ @seconds, @minutes, @hours, @months ].each do |es|
75
75
 
76
- raise ArgumentError.new(
76
+ fail ArgumentError.new(
77
77
  "invalid cronline: '#{line}'"
78
78
  ) if es && es.find { |e| ! e.is_a?(Fixnum) }
79
79
  end
@@ -327,7 +327,7 @@ class Rufus::Scheduler
327
327
 
328
328
  if m = it.match(/^(.+)#(l|-?[12345])$/)
329
329
 
330
- raise ArgumentError.new(
330
+ fail ArgumentError.new(
331
331
  "ranges are not supported for monthdays (#{it})"
332
332
  ) if m[1].index('-')
333
333
 
@@ -340,7 +340,7 @@ class Rufus::Scheduler
340
340
  expr = it.dup
341
341
  WEEKDAYS.each_with_index { |a, i| expr.gsub!(/#{a}/, i.to_s) }
342
342
 
343
- raise ArgumentError.new(
343
+ fail ArgumentError.new(
344
344
  "invalid weekday expression (#{it})"
345
345
  ) if expr !~ /^0*[0-7](-0*[0-7])?$/
346
346
 
@@ -362,7 +362,7 @@ class Rufus::Scheduler
362
362
 
363
363
  r = item.split(',').map { |i| parse_range(i.strip, min, max) }.flatten
364
364
 
365
- raise ArgumentError.new(
365
+ fail ArgumentError.new(
366
366
  "found duplicates in #{item.inspect}"
367
367
  ) if r.uniq.size < r.size
368
368
 
@@ -381,7 +381,7 @@ class Rufus::Scheduler
381
381
 
382
382
  m = item.match(RANGE_REGEX)
383
383
 
384
- raise ArgumentError.new(
384
+ fail ArgumentError.new(
385
385
  "cannot parse #{item.inspect}"
386
386
  ) unless m
387
387
 
@@ -395,7 +395,7 @@ class Rufus::Scheduler
395
395
  inc = m[3]
396
396
  inc = inc ? inc.to_i : 1
397
397
 
398
- raise ArgumentError.new(
398
+ fail ArgumentError.new(
399
399
  "#{item.inspect} is not in range #{min}..#{max}"
400
400
  ) if sta < min || edn > max
401
401
 
@@ -91,7 +91,7 @@ module Rufus
91
91
 
92
92
  @id = determine_id
93
93
 
94
- raise(
94
+ fail(
95
95
  ArgumentError,
96
96
  'missing block or callable to schedule',
97
97
  caller[2..-1]
@@ -235,7 +235,7 @@ module Rufus
235
235
 
236
236
  rescue StandardError => se
237
237
 
238
- raise se unless do_rescue
238
+ fail se unless do_rescue
239
239
 
240
240
  return if se.is_a?(KillSignal) # discard
241
241
 
@@ -402,7 +402,7 @@ module Rufus
402
402
 
403
403
  @times = opts[:times]
404
404
 
405
- raise ArgumentError.new(
405
+ fail ArgumentError.new(
406
406
  "cannot accept :times => #{@times.inspect}, not nil or an int"
407
407
  ) unless @times == nil || @times.is_a?(Fixnum)
408
408
 
@@ -416,27 +416,34 @@ module Rufus
416
416
 
417
417
  def first_at=(first)
418
418
 
419
- return @first_at = nil if first == nil
419
+ return (@first_at = nil) if first == nil
420
420
 
421
- n = Time.now
422
- first = n + 0.003 if first == :now || first == :immediately
421
+ n0 = Time.now
422
+ n1 = n0 + 0.003
423
+
424
+ first = n0 if first == :now || first == :immediately || first == 0
423
425
 
424
426
  @first_at = Rufus::Scheduler.parse_to_time(first)
427
+ @first_at = n1 if @first_at >= n0 && @first_at < n1
425
428
 
426
- raise ArgumentError.new(
429
+ fail ArgumentError.new(
427
430
  "cannot set first[_at|_in] in the past: " +
428
431
  "#{first.inspect} -> #{@first_at.inspect}"
429
- ) if first != 0 && @first_at < n
432
+ ) if @first_at < n0
433
+
434
+ @first_at
430
435
  end
431
436
 
432
437
  def last_at=(last)
433
438
 
434
439
  @last_at = last ? Rufus::Scheduler.parse_to_time(last) : nil
435
440
 
436
- raise ArgumentError.new(
441
+ fail ArgumentError.new(
437
442
  "cannot set last[_at|_in] in the past: " +
438
443
  "#{last.inspect} -> #{@last_at.inspect}"
439
444
  ) if last && @last_at < Time.now
445
+
446
+ @last_at
440
447
  end
441
448
 
442
449
  def trigger(time)
@@ -522,7 +529,7 @@ module Rufus
522
529
 
523
530
  @frequency = Rufus::Scheduler.parse_in(@original)
524
531
 
525
- raise ArgumentError.new(
532
+ fail ArgumentError.new(
526
533
  "cannot schedule #{self.class} with a frequency " +
527
534
  "of #{@frequency.inspect} (#{@original.inspect})"
528
535
  ) if @frequency <= 0
@@ -560,7 +567,7 @@ module Rufus
560
567
 
561
568
  @interval = Rufus::Scheduler.parse_in(@original)
562
569
 
563
- raise ArgumentError.new(
570
+ fail ArgumentError.new(
564
571
  "cannot schedule #{self.class} with an interval " +
565
572
  "of #{@interval.inspect} (#{@original.inspect})"
566
573
  ) if @interval <= 0
@@ -38,7 +38,7 @@ module Rufus
38
38
  parse_cron(o, opts) ||
39
39
  parse_in(o, opts) || # covers 'every' schedule strings
40
40
  parse_at(o, opts) ||
41
- raise(ArgumentError.new("couldn't parse \"#{o}\""))
41
+ fail(ArgumentError.new("couldn't parse \"#{o}\""))
42
42
  end
43
43
 
44
44
  def self.parse_in(o, opts={})
@@ -53,7 +53,7 @@ module Rufus
53
53
  rescue StandardError => se
54
54
 
55
55
  return nil if opts[:no_error]
56
- raise se
56
+ fail se
57
57
  end
58
58
 
59
59
  def self.parse_cron(o, opts)
@@ -63,7 +63,7 @@ module Rufus
63
63
  rescue ArgumentError => ae
64
64
 
65
65
  return nil if opts[:no_error]
66
- raise ae
66
+ fail ae
67
67
  end
68
68
 
69
69
  def self.parse_to_time(o)
@@ -72,7 +72,7 @@ module Rufus
72
72
  t = parse(t) if t.is_a?(String)
73
73
  t = Time.now + t if t.is_a?(Numeric)
74
74
 
75
- raise ArgumentError.new(
75
+ fail ArgumentError.new(
76
76
  "cannot turn #{o.inspect} to a point in time, doesn't make sense"
77
77
  ) unless t.is_a?(Time)
78
78
 
@@ -132,7 +132,7 @@ module Rufus
132
132
  m = string.match(/^(-?)([\d\.#{DURATION_LETTERS}]+)$/)
133
133
 
134
134
  return nil if m.nil? && opts[:no_error]
135
- raise ArgumentError.new("cannot parse '#{string}'") if m.nil?
135
+ fail ArgumentError.new("cannot parse '#{string}'") if m.nil?
136
136
 
137
137
  mod = m[1] == '-' ? -1.0 : 1.0
138
138
  val = 0.0
@@ -150,9 +150,7 @@ module Rufus
150
150
  elsif opts[:no_error]
151
151
  return nil
152
152
  else
153
- raise ArgumentError.new(
154
- "cannot parse '#{string}' (especially '#{s}')"
155
- )
153
+ fail ArgumentError.new("cannot parse '#{string}' (especially '#{s}')")
156
154
  end
157
155
  break unless m && m[3]
158
156
  s = m[3]
@@ -101,7 +101,7 @@ class Rufus::Scheduler
101
101
  begin
102
102
  DateTime.parse(str)
103
103
  rescue
104
- raise ArgumentError, "no time information in #{o.inspect}"
104
+ fail ArgumentError, "no time information in #{o.inspect}"
105
105
  end if RUBY_VERSION < '1.9.0'
106
106
 
107
107
  zone = nil
@@ -22,7 +22,7 @@ job scheduler for Ruby (at, cron, in and every jobs).
22
22
  #s.files = `git ls-files`.split("\n")
23
23
  s.files = Dir[
24
24
  'Rakefile',
25
- 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb',
25
+ 'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb',
26
26
  '*.gemspec', '*.txt', '*.rdoc', '*.md'
27
27
  ]
28
28
 
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.9
4
+ version: 3.1.10
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-11 00:00:00.000000000 Z
11
+ date: 2015-11-17 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,14 +73,7 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - CHANGELOG.txt
77
- - CREDITS.txt
78
- - LICENSE.txt
79
- - README.md
80
76
  - Rakefile
81
- - TODO.txt
82
- - lib/rufus-scheduler.rb
83
- - lib/rufus/scheduler.rb
84
77
  - lib/rufus/scheduler/cronline.rb
85
78
  - lib/rufus/scheduler/job_array.rb
86
79
  - lib/rufus/scheduler/jobs.rb
@@ -88,33 +81,15 @@ files:
88
81
  - lib/rufus/scheduler/util.rb
89
82
  - lib/rufus/scheduler/zones.rb
90
83
  - lib/rufus/scheduler/zotime.rb
84
+ - lib/rufus/scheduler.rb
85
+ - lib/rufus-scheduler.rb
91
86
  - rufus-scheduler.gemspec
92
- - spec/basics_spec.rb
93
- - spec/cronline_spec.rb
94
- - spec/error_spec.rb
95
- - spec/job_array_spec.rb
96
- - spec/job_at_spec.rb
97
- - spec/job_cron_spec.rb
98
- - spec/job_every_spec.rb
99
- - spec/job_in_spec.rb
100
- - spec/job_interval_spec.rb
101
- - spec/job_repeat_spec.rb
102
- - spec/job_spec.rb
103
- - spec/lock_custom_spec.rb
104
- - spec/lock_flock_spec.rb
105
- - spec/lock_lockfile_spec.rb
106
- - spec/lock_spec.rb
107
- - spec/parse_spec.rb
108
- - spec/schedule_at_spec.rb
109
- - spec/schedule_cron_spec.rb
110
- - spec/schedule_every_spec.rb
111
- - spec/schedule_in_spec.rb
112
- - spec/schedule_interval_spec.rb
113
- - spec/scheduler_spec.rb
114
- - spec/spec_helper.rb
115
- - spec/threads_spec.rb
116
- - spec/zotime_spec.rb
87
+ - CHANGELOG.txt
88
+ - CREDITS.txt
89
+ - LICENSE.txt
117
90
  - t.txt
91
+ - TODO.txt
92
+ - README.md
118
93
  homepage: http://github.com/jmettraux/rufus-scheduler
119
94
  licenses:
120
95
  - MIT
@@ -125,17 +100,17 @@ require_paths:
125
100
  - lib
126
101
  required_ruby_version: !ruby/object:Gem::Requirement
127
102
  requirements:
128
- - - ">="
103
+ - - '>='
129
104
  - !ruby/object:Gem::Version
130
105
  version: '0'
131
106
  required_rubygems_version: !ruby/object:Gem::Requirement
132
107
  requirements:
133
- - - ">="
108
+ - - '>='
134
109
  - !ruby/object:Gem::Version
135
110
  version: '0'
136
111
  requirements: []
137
112
  rubyforge_project: rufus
138
- rubygems_version: 2.2.2
113
+ rubygems_version: 2.0.14
139
114
  signing_key:
140
115
  specification_version: 4
141
116
  summary: job scheduler for Ruby (at, cron, in and every jobs)
@@ -1,54 +0,0 @@
1
-
2
- #
3
- # Specifying rufus-scheduler
4
- #
5
- # Sun Jun 1 05:52:24 JST 2014
6
- #
7
-
8
- require 'spec_helper'
9
-
10
-
11
- describe 'basics' do
12
-
13
- def tts(time)
14
-
15
- time.strftime('%Y-%m-%d %H:%M:%S %z') + (time.dst? ? ' dst' : '')
16
- end
17
-
18
- describe 'Time.new' do
19
-
20
- it 'accepts a timezone final argument' do
21
-
22
- if jruby? or ruby18?
23
-
24
- expect(true).to be(true)
25
-
26
- else
27
-
28
- expect(
29
- tts(Time.new(2014, 1, 1, 1, 0, 0, '+01:00'))
30
- ).to eq('2014-01-01 01:00:00 +0100')
31
- expect(
32
- tts(Time.new(2014, 8, 1, 1, 0, 0, '+01:00'))
33
- ).to eq('2014-08-01 01:00:00 +0100')
34
- expect(
35
- tts(Time.new(2014, 8, 1, 1, 0, 0, '+01:00'))
36
- ).to eq('2014-08-01 01:00:00 +0100')
37
- end
38
- end
39
- end
40
-
41
- describe 'Time.local' do
42
-
43
- it 'works as expected' do
44
-
45
- expect(
46
- tts(in_zone('Europe/Berlin') { Time.local(2014, 1, 1, 1, 0, 0) })
47
- ).to eq('2014-01-01 01:00:00 +0100')
48
- expect(
49
- tts(in_zone('Europe/Berlin') { Time.local(2014, 8, 1, 1, 0, 0) })
50
- ).to eq('2014-08-01 01:00:00 +0200 dst')
51
- end
52
- end
53
- end
54
-