rufus-scheduler 3.1.9 → 3.2.0

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,20 @@
2
2
  = rufus-scheduler CHANGELOG.txt
3
3
 
4
4
 
5
+ == rufus-scheduler - 3.2.0 released 2015-12-28
6
+
7
+ - cache CronLine#brute_frequency results, gh-188 and gh-89
8
+ - "every" shift prevention by https://github.com/Korrigan
9
+ - Ruby warnings silenced by https://github.com/vivitar
10
+
11
+
12
+ == rufus-scheduler - 3.1.10 released 2015-11-18
13
+
14
+ - allow for :first_in => 0, gh-179 by https://github.com/JonMcPherson
15
+ for https://github.com/Shopify/dashing/commit/ea3730fa4
16
+ - stop shipping specs in gem
17
+
18
+
5
19
  == rufus-scheduler - 3.1.9 released 2015-11-12
6
20
 
7
21
  - fix potential RuntimeError in CronLine#prev_second,
data/CREDITS.txt CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  == Contributors
6
6
 
7
+ - Balasankar C (https://github.com/balasankarc) fix CronJob spec vs December
8
+ - Matthieu Rosinski (https://github.com/Korrigan) prevent "every" shifts
9
+ - vivitar (https://github.com/vivitar) silenced a set of Ruby warnings
10
+ - Jon McPherson (https://github.com/JonMcPherson) :first_in => 0 back
7
11
  - Calinoiu Alexandru Nicolae (https://github.com/alexandru-calinoiu) CronLine#prev_second fix
8
12
  - Alyssa Pohahau (https://github.com/alyssa) out of DST transition specs
9
13
  - Claude Vessaz (https://github.com/claudeatsafe) ack #unscheduled_at in #scheduled?
@@ -42,6 +46,7 @@
42
46
 
43
47
  == Feedback
44
48
 
49
+ - Eduardo Maia - https://github.com/emaiax - rufus and the Rails console
45
50
  - Suisea - https://github.com/suisea - readme rewording
46
51
  - Radek - http://stackoverflow.com/users/250422 - gh-166
47
52
  - Patrik Ragnarsson - https://github.com/dentarg - timeout vs nil, gh-156
data/README.md CHANGED
@@ -123,7 +123,8 @@ 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)
126
+ * [The scheduler comes up when running the Rails console](https://github.com/jmettraux/rufus-scheduler#avoid-scheduling-when-running-the-ruby-on-rails-console)
127
+ * [I don't get any of this, I just want it to work in my Rails application](#so-rails)
127
128
 
128
129
 
129
130
  ## scheduling
@@ -1428,6 +1429,34 @@ The rufus-scheduler singleton is instantiated in the ```config/initializers/sche
1428
1429
 
1429
1430
  *Warning*: this works well with single-process Ruby servers like Webrick and Thin. Using rufus-scheduler with Passenger or Unicorn requires a bit more knowledge and tuning, gently provided by a bit of googling and reading, see [Faq](#faq) above.
1430
1431
 
1432
+ ### avoid scheduling when running the Ruby on Rails console
1433
+
1434
+ (Written in reply to https://github.com/jmettraux/rufus-scheduler/issues/186 )
1435
+
1436
+ If you don't want rufus-scheduler to kick in when running the Ruby on Rails console, you can wrap your initializer in a conditional:
1437
+
1438
+ ```ruby
1439
+ #
1440
+ # config/initializers/scheduler.rb
1441
+
1442
+ require 'rufus-scheduler'
1443
+
1444
+ s = Rufus::Scheduler.singleton
1445
+
1446
+
1447
+ unless defined?(Rails::Console)
1448
+ # only schedule when not running from the Rails on Rails console
1449
+
1450
+ s.every '1m' do
1451
+
1452
+ Rails.logger.info "hello, it's #{Time.now}"
1453
+ Rails.logger.flush
1454
+ end
1455
+ end
1456
+ ```
1457
+
1458
+ It should work for Ruby on Rails 3 and 4.
1459
+
1431
1460
  ### rails server -d
1432
1461
 
1433
1462
  (Written in reply to https://github.com/jmettraux/rufus-scheduler/issues/165 )
@@ -42,13 +42,13 @@ class Rufus::Scheduler
42
42
  attr_reader :hours
43
43
  attr_reader :days
44
44
  attr_reader :months
45
+ #attr_reader :monthdays # reader defined below
45
46
  attr_reader :weekdays
46
- attr_reader :monthdays
47
47
  attr_reader :timezone
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
@@ -223,6 +223,10 @@ class Rufus::Scheduler
223
223
  }[1]
224
224
  end
225
225
 
226
+ # Caching facility. Currently only used for brute frequencies.
227
+ #
228
+ @cache = {}; class << self; attr_reader :cache; end
229
+
226
230
  # Returns the shortest delta between two potential occurences of the
227
231
  # schedule described by this cronline.
228
232
  #
@@ -239,16 +243,13 @@ class Rufus::Scheduler
239
243
  # Of course, this method can get VERY slow if you call on it a second-
240
244
  # based cronline...
241
245
  #
242
- # Since it's a rarely used method, I haven't taken the time to make it
243
- # smarter/faster.
244
- #
245
- # One obvious improvement would be to cache the result once computed...
246
- #
247
- # See https://github.com/jmettraux/rufus-scheduler/issues/89
248
- # for a discussion about this method.
249
- #
250
246
  def brute_frequency
251
247
 
248
+ key = "brute_frequency:#{@original}"
249
+
250
+ delta = self.class.cache[key]
251
+ return delta if delta
252
+
252
253
  delta = 366 * DAY_S
253
254
 
254
255
  t0 = previous_time(Time.local(2000, 1, 1))
@@ -268,7 +269,7 @@ class Rufus::Scheduler
268
269
  t0 = t1
269
270
  end
270
271
 
271
- delta
272
+ self.class.cache[key] = delta
272
273
  end
273
274
 
274
275
  def next_second(time)
@@ -327,7 +328,7 @@ class Rufus::Scheduler
327
328
 
328
329
  if m = it.match(/^(.+)#(l|-?[12345])$/)
329
330
 
330
- raise ArgumentError.new(
331
+ fail ArgumentError.new(
331
332
  "ranges are not supported for monthdays (#{it})"
332
333
  ) if m[1].index('-')
333
334
 
@@ -340,7 +341,7 @@ class Rufus::Scheduler
340
341
  expr = it.dup
341
342
  WEEKDAYS.each_with_index { |a, i| expr.gsub!(/#{a}/, i.to_s) }
342
343
 
343
- raise ArgumentError.new(
344
+ fail ArgumentError.new(
344
345
  "invalid weekday expression (#{it})"
345
346
  ) if expr !~ /^0*[0-7](-0*[0-7])?$/
346
347
 
@@ -362,7 +363,7 @@ class Rufus::Scheduler
362
363
 
363
364
  r = item.split(',').map { |i| parse_range(i.strip, min, max) }.flatten
364
365
 
365
- raise ArgumentError.new(
366
+ fail ArgumentError.new(
366
367
  "found duplicates in #{item.inspect}"
367
368
  ) if r.uniq.size < r.size
368
369
 
@@ -377,11 +378,11 @@ class Rufus::Scheduler
377
378
 
378
379
  return %w[ L ] if item == 'L'
379
380
 
380
- item = '*' + item if item.match(/^\//)
381
+ item = '*' + item if item[0, 1] == '/'
381
382
 
382
383
  m = item.match(RANGE_REGEX)
383
384
 
384
- raise ArgumentError.new(
385
+ fail ArgumentError.new(
385
386
  "cannot parse #{item.inspect}"
386
387
  ) unless m
387
388
 
@@ -395,7 +396,7 @@ class Rufus::Scheduler
395
396
  inc = m[3]
396
397
  inc = inc ? inc.to_i : 1
397
398
 
398
- raise ArgumentError.new(
399
+ fail ArgumentError.new(
399
400
  "#{item.inspect} is not in range #{min}..#{max}"
400
401
  ) if sta < min || edn > max
401
402
 
@@ -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
 
@@ -391,7 +391,7 @@ module Rufus
391
391
  attr_reader :paused_at
392
392
 
393
393
  attr_reader :first_at
394
- attr_accessor :last_at
394
+ attr_reader :last_at
395
395
  attr_accessor :times
396
396
 
397
397
  def initialize(scheduler, duration, opts, block)
@@ -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
@@ -536,9 +543,12 @@ module Rufus
536
543
 
537
544
  return if is_post
538
545
 
546
+ n = Time.now
547
+
539
548
  @next_time =
540
- if @first_at == nil || @first_at < Time.now
541
- (trigger_time || Time.now) + @frequency
549
+ if @first_at == nil || @first_at < n
550
+ nt = (@next_time || trigger_time || n) + @frequency
551
+ nt > n ? nt : (trigger_time || n) + @frequency
542
552
  else
543
553
  @first_at
544
554
  end
@@ -560,7 +570,7 @@ module Rufus
560
570
 
561
571
  @interval = Rufus::Scheduler.parse_in(@original)
562
572
 
563
- raise ArgumentError.new(
573
+ fail ArgumentError.new(
564
574
  "cannot schedule #{self.class} with an interval " +
565
575
  "of #{@interval.inspect} (#{@original.inspect})"
566
576
  ) 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
@@ -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.2.0'
43
43
 
44
44
  #
45
45
  # A common error class for rufus-scheduler
@@ -385,7 +385,7 @@ module Rufus
385
385
  #
386
386
  def scheduled?(job_or_job_id)
387
387
 
388
- job, job_id = fetch(job_or_job_id)
388
+ job, _ = fetch(job_or_job_id)
389
389
 
390
390
  !! (job && job.unscheduled_at.nil? && job.next_time != nil)
391
391
  end
@@ -441,7 +441,7 @@ module Rufus
441
441
  if format == :timeline
442
442
  a = []
443
443
  h.each { |j, ts| ts.each { |t| a << [ t, j ] } }
444
- a.sort_by { |(t, j)| t }
444
+ a.sort_by { |(t, _)| t }
445
445
  else
446
446
  h
447
447
  end
@@ -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
@@ -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,78 @@
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.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - John Mettraux
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
12
+ date: 2015-12-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rake
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: 2.13.0
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: 2.13.0
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: chronic
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: tzinfo
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: job scheduler for Ruby (at, cron, in and every jobs).
@@ -73,14 +82,7 @@ executables: []
73
82
  extensions: []
74
83
  extra_rdoc_files: []
75
84
  files:
76
- - CHANGELOG.txt
77
- - CREDITS.txt
78
- - LICENSE.txt
79
- - README.md
80
85
  - Rakefile
81
- - TODO.txt
82
- - lib/rufus-scheduler.rb
83
- - lib/rufus/scheduler.rb
84
86
  - lib/rufus/scheduler/cronline.rb
85
87
  - lib/rufus/scheduler/job_array.rb
86
88
  - lib/rufus/scheduler/jobs.rb
@@ -88,55 +90,37 @@ files:
88
90
  - lib/rufus/scheduler/util.rb
89
91
  - lib/rufus/scheduler/zones.rb
90
92
  - lib/rufus/scheduler/zotime.rb
93
+ - lib/rufus/scheduler.rb
94
+ - lib/rufus-scheduler.rb
91
95
  - 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
117
- - t.txt
96
+ - CHANGELOG.txt
97
+ - CREDITS.txt
98
+ - LICENSE.txt
99
+ - TODO.txt
100
+ - README.md
118
101
  homepage: http://github.com/jmettraux/rufus-scheduler
119
102
  licenses:
120
103
  - MIT
121
- metadata: {}
122
104
  post_install_message:
123
105
  rdoc_options: []
124
106
  require_paths:
125
107
  - lib
126
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
127
110
  requirements:
128
- - - ">="
111
+ - - ! '>='
129
112
  - !ruby/object:Gem::Version
130
113
  version: '0'
131
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
132
116
  requirements:
133
- - - ">="
117
+ - - ! '>='
134
118
  - !ruby/object:Gem::Version
135
119
  version: '0'
136
120
  requirements: []
137
121
  rubyforge_project: rufus
138
- rubygems_version: 2.2.2
122
+ rubygems_version: 1.8.23.2
139
123
  signing_key:
140
- specification_version: 4
124
+ specification_version: 3
141
125
  summary: job scheduler for Ruby (at, cron, in and every jobs)
142
126
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 03122e92f3b47a4af3d12b06762f5f4caa604341
4
- data.tar.gz: 8db6b1570347d1ffa1871fe9d90163729fbf7516
5
- SHA512:
6
- metadata.gz: 0bf2d0ab22e975dc6832fc651dd415708a998960b4b9503865fe560c9b78284b54ac2b5957d8c912d1415776898e211eb6fe6a56c456613df85f5b4afcf35e0f
7
- data.tar.gz: 52b001210ccea2c628e4a95e2bde023725cbb1ce9ee78bd635cfedddafcbed9851abda8eb0edb46e5816ba7ddc80e55dae256588a6caf079f9ebd126d5dbd3c7
data/spec/basics_spec.rb DELETED
@@ -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
-