rufus-scheduler 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.txt +9 -0
- data/CREDITS.txt +5 -0
- data/LICENSE.txt +1 -1
- data/Makefile +23 -0
- data/README.md +29 -13
- data/lib/rufus/scheduler.rb +2 -2
- data/lib/rufus/scheduler/cronline.rb +47 -22
- data/lib/rufus/scheduler/job_array.rb +1 -1
- data/lib/rufus/scheduler/jobs.rb +1 -1
- data/lib/rufus/scheduler/locks.rb +2 -2
- data/lib/rufus/scheduler/util.rb +14 -28
- data/lib/rufus/scheduler/zones.rb +1 -1
- data/lib/rufus/scheduler/zotime.rb +2 -2
- data/rufus-scheduler.gemspec +1 -2
- metadata +14 -38
- data/Rakefile +0 -83
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c40e276338f283e1d434b24ff0914bb4f9e4772c
|
4
|
+
data.tar.gz: 6f675ccf7f32737bd45e96119db3f0217a9294c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5a263aaebb6f8f434f7b1eeeb138e0e77d19dd11cb87dcb347be5543fd079e90ab4352aa3a3df297ea46fe8be76d2d25950dee02afbc427e49aab4d316fee385
|
7
|
+
data.tar.gz: 5037bcda9d0650d1404bc2c134cd3ad36e0b9fc90f95dfde27af416fb2a8794c844777ddfa42b24cbb5b07f0694c3a58b8006795321c2a3699404710c61d4860
|
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
= rufus-scheduler CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== rufus-scheduler - 3.2.1 released 2016-05-04
|
6
|
+
|
7
|
+
- accept '* * * * 5L' (last friday) (equivalent to '* * * * 5#-1')
|
8
|
+
- CronLine#to_a (#to_array aliasing to it)
|
9
|
+
- simplify .parse_duration (and trim input)
|
10
|
+
- raise on "*/0 * * * *", by https://github.com/simook
|
11
|
+
- introduce "days to end of month" in cron strings
|
12
|
+
|
13
|
+
|
5
14
|
== rufus-scheduler - 3.2.0 released 2015-12-28
|
6
15
|
|
7
16
|
- cache CronLine#brute_frequency results, gh-188 and gh-89
|
data/CREDITS.txt
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
== Contributors
|
6
6
|
|
7
|
+
- Kyle Simukka (https://githuc.om/simook) raise on "*/0 * * * *"
|
8
|
+
- Ryan McGeary (https://github.com/rmm5t) svg badges for the readme
|
7
9
|
- Balasankar C (https://github.com/balasankarc) fix CronJob spec vs December
|
8
10
|
- Matthieu Rosinski (https://github.com/Korrigan) prevent "every" shifts
|
9
11
|
- vivitar (https://github.com/vivitar) silenced a set of Ruby warnings
|
@@ -46,6 +48,9 @@
|
|
46
48
|
|
47
49
|
== Feedback
|
48
50
|
|
51
|
+
- Anjali Sharma - https://github.com/anjali-sharma - fix typographical error
|
52
|
+
- Jonathan Campos - https://github.com/jonbcampos - negative cron day idea
|
53
|
+
- Andrey Morskov - https://github.com/accessd - fix typographical error
|
49
54
|
- Eduardo Maia - https://github.com/emaiax - rufus and the Rails console
|
50
55
|
- Suisea - https://github.com/suisea - readme rewording
|
51
56
|
- Radek - http://stackoverflow.com/users/250422 - gh-166
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2005-
|
2
|
+
Copyright (c) 2005-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
NAME = \
|
3
|
+
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name")
|
4
|
+
VERSION = \
|
5
|
+
$(shell ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version")
|
6
|
+
|
7
|
+
|
8
|
+
gemspec_validate:
|
9
|
+
@echo "---"
|
10
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'].first)); p s.validate"
|
11
|
+
@echo "---"
|
12
|
+
|
13
|
+
name: gemspec_validate
|
14
|
+
@echo "$(NAME) $(VERSION)"
|
15
|
+
|
16
|
+
build: gemspec_validate
|
17
|
+
gem build $(NAME).gemspec
|
18
|
+
mkdir -p pkg
|
19
|
+
mv $(NAME)-$(VERSION).gem pkg/
|
20
|
+
|
21
|
+
push: build
|
22
|
+
gem push pkg/$(NAME)-$(VERSION).gem
|
23
|
+
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
# rufus-scheduler
|
3
3
|
|
4
|
-
[![Build Status](https://secure.travis-ci.org/jmettraux/rufus-scheduler.
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/rufus-scheduler.
|
4
|
+
[![Build Status](https://secure.travis-ci.org/jmettraux/rufus-scheduler.svg)](http://travis-ci.org/jmettraux/rufus-scheduler)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/rufus-scheduler.svg)](http://badge.fury.io/rb/rufus-scheduler)
|
6
6
|
|
7
7
|
Job scheduler for Ruby (at, cron, in and every jobs).
|
8
8
|
|
@@ -10,6 +10,8 @@ Job scheduler for Ruby (at, cron, in and every jobs).
|
|
10
10
|
|
11
11
|
Quickstart:
|
12
12
|
```ruby
|
13
|
+
# quickstart.rb
|
14
|
+
|
13
15
|
require 'rufus-scheduler'
|
14
16
|
|
15
17
|
scheduler = Rufus::Scheduler.new
|
@@ -21,6 +23,7 @@ end
|
|
21
23
|
scheduler.join
|
22
24
|
# let the current thread join the scheduler thread
|
23
25
|
```
|
26
|
+
(run with `ruby quickstart.rb`)
|
24
27
|
|
25
28
|
Various forms of scheduling are supported:
|
26
29
|
```ruby
|
@@ -59,9 +62,10 @@ It does not persist your schedules. When the process is gone and the scheduler i
|
|
59
62
|
|
60
63
|
## related and similar gems
|
61
64
|
|
62
|
-
* [
|
63
|
-
* [
|
64
|
-
* [
|
65
|
+
* [Whenever](https://github.com/javan/whenever) - let cron call back your Ruby code, trusted and reliable cron drives your schedule
|
66
|
+
* [Clockwork](https://github.com/tomykaira/clockwork) - rufus-scheduler inspired gem
|
67
|
+
* [Crono](https://github.com/plashchynski/crono) - an in-Rails cron scheduler
|
68
|
+
* [PerfectSched](https://github.com/treasure-data/perfectsched) - highly available distributed cron built on [Sequel](http://sequel.jeremyevans.net) and more
|
65
69
|
|
66
70
|
(please note: rufus-scheduler is not a cron replacement)
|
67
71
|
|
@@ -101,12 +105,6 @@ Go read [how to report bugs effectively](http://www.chiark.greenend.org.uk/~sgta
|
|
101
105
|
|
102
106
|
Update: [help_help.md](https://gist.github.com/jmettraux/310fed75f568fd731814) might help help you.
|
103
107
|
|
104
|
-
### on StackOverflow
|
105
|
-
|
106
|
-
Use this [form](http://stackoverflow.com/questions/ask?tags=rufus-scheduler+ruby). It'll create a question flagged "rufus-scheduler" and "ruby".
|
107
|
-
|
108
|
-
Here are the [questions tagged rufus-scheduler](http://stackoverflow.com/questions/tagged/rufus-scheduler).
|
109
|
-
|
110
108
|
### on IRC
|
111
109
|
|
112
110
|
I sometimes haunt #ruote on freenode.net. The channel is not dedicated to rufus-scheduler, so if you ask a question, first mention it's about rufus-scheduler.
|
@@ -123,6 +121,8 @@ Yes, issues can be reported in [rufus-scheduler issues](https://github.com/jmett
|
|
123
121
|
* [I want a refund](http://blog.nodejitsu.com/getting-refunds-on-open-source-projects)
|
124
122
|
* [Passenger and rufus-scheduler](http://stackoverflow.com/questions/18108719/debugging-rufus-scheduler/18156180#18156180)
|
125
123
|
* [Passenger and rufus-scheduler (2)](http://stackoverflow.com/questions/21861387/rufus-cron-job-not-working-in-apache-passenger#answer-21868555)
|
124
|
+
* [Passenger in-depth spawn methods](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/)
|
125
|
+
* [Passenger in-depth spawn methods (smart spawning)](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/#smart-spawning-hooks)
|
126
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
127
|
* [I don't get any of this, I just want it to work in my Rails application](#so-rails)
|
128
128
|
|
@@ -181,6 +181,8 @@ Interval jobs, trigger, execute and then trigger again after the interval elapse
|
|
181
181
|
|
182
182
|
Cron jobs are based on the venerable cron utility (```man 5 crontab```). They trigger following a pattern given in (almost) the same language cron uses.
|
183
183
|
|
184
|
+
####
|
185
|
+
|
184
186
|
### #schedule_x vs #x
|
185
187
|
|
186
188
|
schedule_in, schedule_at, schedule_cron, etc will return the new Job instance.
|
@@ -1348,7 +1350,6 @@ Rufus::Scheduler.parse('* * * * mon#1').next_time
|
|
1348
1350
|
L can be used in the "day" slot:
|
1349
1351
|
|
1350
1352
|
In this example, the cronline is supposed to trigger every last day of the month at noon:
|
1351
|
-
|
1352
1353
|
```ruby
|
1353
1354
|
require 'rufus-scheduler'
|
1354
1355
|
Time.now
|
@@ -1357,6 +1358,21 @@ Rufus::Scheduler.parse('00 12 L * *').next_time
|
|
1357
1358
|
# => 2013-10-31 12:00:00 +0900
|
1358
1359
|
```
|
1359
1360
|
|
1361
|
+
#### negative day (x days before the end of the month)
|
1362
|
+
|
1363
|
+
It's OK to pass negative values in the "day" slot:
|
1364
|
+
```ruby
|
1365
|
+
scheduler.cron '0 0 -5 * *' do
|
1366
|
+
# do it at 00h00 5 days before the end of the month...
|
1367
|
+
end
|
1368
|
+
```
|
1369
|
+
|
1370
|
+
Negative ranges (`-10--5-`: 10 days before the end of the month to 5 days before the end of the month) are OK, but mixed positive / negative ranges will raise an `ArgumentError`.
|
1371
|
+
|
1372
|
+
Negative ranges with increments (`-10---2/2`) are accepted as well.
|
1373
|
+
|
1374
|
+
Descending day ranges are not accepted (`10-8` or `-8--10` for example).
|
1375
|
+
|
1360
1376
|
|
1361
1377
|
## a note about timezones
|
1362
1378
|
|
@@ -1445,7 +1461,7 @@ s = Rufus::Scheduler.singleton
|
|
1445
1461
|
|
1446
1462
|
|
1447
1463
|
unless defined?(Rails::Console)
|
1448
|
-
# only schedule when not running from the
|
1464
|
+
# only schedule when not running from the Ruby on Rails console
|
1449
1465
|
|
1450
1466
|
s.every '1m' do
|
1451
1467
|
|
data/lib/rufus/scheduler.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -39,7 +39,7 @@ module Rufus
|
|
39
39
|
require 'rufus/scheduler/job_array'
|
40
40
|
require 'rufus/scheduler/locks'
|
41
41
|
|
42
|
-
VERSION = '3.2.
|
42
|
+
VERSION = '3.2.1'
|
43
43
|
|
44
44
|
#
|
45
45
|
# A common error class for rufus-scheduler
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -67,7 +67,7 @@ class Rufus::Scheduler
|
|
67
67
|
@seconds = offset == 1 ? parse_item(items[0], 0, 59) : [ 0 ]
|
68
68
|
@minutes = parse_item(items[0 + offset], 0, 59)
|
69
69
|
@hours = parse_item(items[1 + offset], 0, 24)
|
70
|
-
@days = parse_item(items[2 + offset],
|
70
|
+
@days = parse_item(items[2 + offset], -30, 31)
|
71
71
|
@months = parse_item(items[3 + offset], 1, 12)
|
72
72
|
@weekdays, @monthdays = parse_weekdays(items[4 + offset])
|
73
73
|
|
@@ -188,9 +188,9 @@ class Rufus::Scheduler
|
|
188
188
|
|
189
189
|
# Returns an array of 6 arrays (seconds, minutes, hours, days,
|
190
190
|
# months, weekdays).
|
191
|
-
# This method is used by the cronline
|
191
|
+
# This method is mostly used by the cronline specs.
|
192
192
|
#
|
193
|
-
def
|
193
|
+
def to_a
|
194
194
|
|
195
195
|
[
|
196
196
|
toa(@seconds),
|
@@ -203,6 +203,7 @@ class Rufus::Scheduler
|
|
203
203
|
@timezone
|
204
204
|
]
|
205
205
|
end
|
206
|
+
alias to_array to_a
|
206
207
|
|
207
208
|
# Returns a quickly computed approximation of the frequency for this
|
208
209
|
# cron line.
|
@@ -319,33 +320,33 @@ class Rufus::Scheduler
|
|
319
320
|
|
320
321
|
return nil if item == '*'
|
321
322
|
|
322
|
-
items = item.downcase.split(',')
|
323
|
-
|
324
323
|
weekdays = nil
|
325
324
|
monthdays = nil
|
326
325
|
|
327
|
-
|
326
|
+
item.downcase.split(',').each do |it|
|
327
|
+
|
328
|
+
WEEKDAYS.each_with_index { |a, i| it.gsub!(/#{a}/, i.to_s) }
|
329
|
+
|
330
|
+
it = it.gsub(/([^#])l/, '\1#-1')
|
331
|
+
# "5L" == "5#-1" == the last Friday
|
328
332
|
|
329
|
-
if m = it.match(
|
333
|
+
if m = it.match(/\A(.+)#(l|-?[12345])\z/)
|
330
334
|
|
331
335
|
fail ArgumentError.new(
|
332
336
|
"ranges are not supported for monthdays (#{it})"
|
333
337
|
) if m[1].index('-')
|
334
338
|
|
335
|
-
|
339
|
+
it = it.gsub(/#l/, '#-1')
|
336
340
|
|
337
|
-
(monthdays ||= []) <<
|
341
|
+
(monthdays ||= []) << it
|
338
342
|
|
339
343
|
else
|
340
344
|
|
341
|
-
expr = it.dup
|
342
|
-
WEEKDAYS.each_with_index { |a, i| expr.gsub!(/#{a}/, i.to_s) }
|
343
|
-
|
344
345
|
fail ArgumentError.new(
|
345
|
-
"invalid weekday expression (#{
|
346
|
-
) if
|
346
|
+
"invalid weekday expression (#{item})"
|
347
|
+
) if it !~ /\A0*[0-7](-0*[0-7])?\z/
|
347
348
|
|
348
|
-
its =
|
349
|
+
its = it.index('-') ? parse_range(it, 0, 7) : [ Integer(it) ]
|
349
350
|
its = its.collect { |i| i == 7 ? 0 : i }
|
350
351
|
|
351
352
|
(weekdays ||= []).concat(its)
|
@@ -372,7 +373,7 @@ class Rufus::Scheduler
|
|
372
373
|
Set.new(r)
|
373
374
|
end
|
374
375
|
|
375
|
-
RANGE_REGEX =
|
376
|
+
RANGE_REGEX = /\A(\*|-?\d{1,2})(?:-(-?\d{1,2}))?(?:\/(\d{1,2}))?\z/
|
376
377
|
|
377
378
|
def parse_range(item, min, max)
|
378
379
|
|
@@ -386,8 +387,10 @@ class Rufus::Scheduler
|
|
386
387
|
"cannot parse #{item.inspect}"
|
387
388
|
) unless m
|
388
389
|
|
390
|
+
mmin = min == -30 ? 1 : min # days
|
391
|
+
|
389
392
|
sta = m[1]
|
390
|
-
sta = sta == '*' ?
|
393
|
+
sta = sta == '*' ? mmin : sta.to_i
|
391
394
|
|
392
395
|
edn = m[2]
|
393
396
|
edn = edn ? edn.to_i : sta
|
@@ -396,16 +399,28 @@ class Rufus::Scheduler
|
|
396
399
|
inc = m[3]
|
397
400
|
inc = inc ? inc.to_i : 1
|
398
401
|
|
402
|
+
fail ArgumentError.new(
|
403
|
+
"#{item.inspect} positive/negative ranges not allowed"
|
404
|
+
) if (sta < 0 && edn > 0) || (sta > 0 && edn < 0)
|
405
|
+
|
406
|
+
fail ArgumentError.new(
|
407
|
+
"#{item.inspect} descending day ranges not allowed"
|
408
|
+
) if min == -30 && sta > edn
|
409
|
+
|
399
410
|
fail ArgumentError.new(
|
400
411
|
"#{item.inspect} is not in range #{min}..#{max}"
|
401
412
|
) if sta < min || edn > max
|
402
413
|
|
414
|
+
fail ArgumentError.new(
|
415
|
+
"#{item.inspect} increment must be greater than zero"
|
416
|
+
) if inc == 0
|
417
|
+
|
403
418
|
r = []
|
404
419
|
val = sta
|
405
420
|
|
406
421
|
loop do
|
407
422
|
v = val
|
408
|
-
v = 0 if max == 24 && v == 24
|
423
|
+
v = 0 if max == 24 && v == 24 # hours
|
409
424
|
r << v
|
410
425
|
break if inc == 1 && val == edn
|
411
426
|
val += inc
|
@@ -421,9 +436,19 @@ class Rufus::Scheduler
|
|
421
436
|
value = time.send(accessor)
|
422
437
|
|
423
438
|
return true if values.nil?
|
424
|
-
return true if values.include?('L') && (time + DAY_S).day == 1
|
425
439
|
|
426
|
-
|
440
|
+
if accessor == :day
|
441
|
+
|
442
|
+
values.each do |v|
|
443
|
+
return true if v == 'L' && (time + DAY_S).day == 1
|
444
|
+
return true if v.to_i < 0 && (time + (1 - v) * DAY_S).day == 1
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
if accessor == :hour
|
449
|
+
|
450
|
+
return true if value == 0 && values.include?(24)
|
451
|
+
end
|
427
452
|
|
428
453
|
values.include?(value)
|
429
454
|
end
|
@@ -466,7 +491,7 @@ class Rufus::Scheduler
|
|
466
491
|
neg = neg - 1
|
467
492
|
end
|
468
493
|
|
469
|
-
[ "#{
|
494
|
+
[ "#{date.wday}##{pos}", "#{date.wday}##{neg}" ]
|
470
495
|
end
|
471
496
|
end
|
472
497
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
data/lib/rufus/scheduler/jobs.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -41,7 +41,7 @@ class Rufus::Scheduler
|
|
41
41
|
end
|
42
42
|
|
43
43
|
#
|
44
|
-
# The standard flock
|
44
|
+
# The standard flock mechanism, with its own class thanks to @ecin
|
45
45
|
#
|
46
46
|
class FileLock
|
47
47
|
|
data/lib/rufus/scheduler/util.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -125,38 +125,24 @@ module Rufus
|
|
125
125
|
#
|
126
126
|
def self.parse_duration(string, opts={})
|
127
127
|
|
128
|
-
|
128
|
+
s = string.to_s.strip
|
129
|
+
mod = s[0, 1] == '-' ? -1 : 1
|
130
|
+
s = s[1..-1] if mod == -1
|
129
131
|
|
130
|
-
|
132
|
+
ss = mod < 0 ? '-' : ''
|
133
|
+
r = 0.0
|
131
134
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
mod = m[1] == '-' ? -1.0 : 1.0
|
138
|
-
val = 0.0
|
139
|
-
|
140
|
-
s = m[2]
|
135
|
+
s.scan(/(\d*\.\d+|\d+\.?)([#{DURATION_LETTERS}]?)/) do |f, d|
|
136
|
+
ss += "#{f}#{d}"
|
137
|
+
r += f.to_f * (DURATIONS[d] || 1.0)
|
138
|
+
end
|
141
139
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
val += m[1].to_f * DURATIONS[m[2]]
|
146
|
-
elsif s.match(/^\d+$/)
|
147
|
-
val += s.to_i
|
148
|
-
elsif s.match(/^\d*\.\d*$/)
|
149
|
-
val += s.to_f
|
150
|
-
elsif opts[:no_error]
|
151
|
-
return nil
|
152
|
-
else
|
153
|
-
fail ArgumentError.new("cannot parse '#{string}' (especially '#{s}')")
|
154
|
-
end
|
155
|
-
break unless m && m[3]
|
156
|
-
s = m[3]
|
140
|
+
if ss == '-' || ss != string.to_s.strip
|
141
|
+
return nil if opts[:no_error]
|
142
|
+
fail ArgumentError.new("invalid time duration #{string.inspect}")
|
157
143
|
end
|
158
144
|
|
159
|
-
mod *
|
145
|
+
mod * r
|
160
146
|
end
|
161
147
|
|
162
148
|
class << self
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2006-
|
2
|
+
# Copyright (c) 2006-2016, John Mettraux, jmettraux@gmail.com
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
# of this software and associated documentation files (the "Software"), to deal
|
@@ -85,7 +85,7 @@ class Rufus::Scheduler
|
|
85
85
|
@seconds
|
86
86
|
end
|
87
87
|
|
88
|
-
#DELTA_TZ_REX =
|
88
|
+
#DELTA_TZ_REX = /\A[+-][0-1][0-9]:?[0-5][0-9]\z/
|
89
89
|
|
90
90
|
def self.envtzable?(s)
|
91
91
|
|
data/rufus-scheduler.gemspec
CHANGED
@@ -21,14 +21,13 @@ job scheduler for Ruby (at, cron, in and every jobs).
|
|
21
21
|
|
22
22
|
#s.files = `git ls-files`.split("\n")
|
23
23
|
s.files = Dir[
|
24
|
-
'
|
24
|
+
'Makefile',
|
25
25
|
'lib/**/*.rb', #'spec/**/*.rb', 'test/**/*.rb',
|
26
26
|
'*.gemspec', '*.txt', '*.rdoc', '*.md'
|
27
27
|
]
|
28
28
|
|
29
29
|
#s.add_runtime_dependency 'tzinfo'
|
30
30
|
|
31
|
-
s.add_development_dependency 'rake'
|
32
31
|
s.add_development_dependency 'rspec', '>= 2.13.0'
|
33
32
|
s.add_development_dependency 'chronic'
|
34
33
|
s.add_development_dependency 'tzinfo'
|
metadata
CHANGED
@@ -1,78 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
5
|
-
prerelease:
|
4
|
+
version: 3.2.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Mettraux
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rake
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
13
|
- !ruby/object:Gem::Dependency
|
31
14
|
name: rspec
|
32
15
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
16
|
requirements:
|
35
|
-
- -
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: 2.13.0
|
38
20
|
type: :development
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: 2.13.0
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: chronic
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
|
-
- -
|
31
|
+
- - '>='
|
52
32
|
- !ruby/object:Gem::Version
|
53
33
|
version: '0'
|
54
34
|
type: :development
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
|
-
- -
|
38
|
+
- - '>='
|
60
39
|
- !ruby/object:Gem::Version
|
61
40
|
version: '0'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
42
|
name: tzinfo
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - '>='
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: '0'
|
70
48
|
type: :development
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - '>='
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: '0'
|
78
55
|
description: job scheduler for Ruby (at, cron, in and every jobs).
|
@@ -82,7 +59,7 @@ executables: []
|
|
82
59
|
extensions: []
|
83
60
|
extra_rdoc_files: []
|
84
61
|
files:
|
85
|
-
-
|
62
|
+
- Makefile
|
86
63
|
- lib/rufus/scheduler/cronline.rb
|
87
64
|
- lib/rufus/scheduler/job_array.rb
|
88
65
|
- lib/rufus/scheduler/jobs.rb
|
@@ -101,26 +78,25 @@ files:
|
|
101
78
|
homepage: http://github.com/jmettraux/rufus-scheduler
|
102
79
|
licenses:
|
103
80
|
- MIT
|
81
|
+
metadata: {}
|
104
82
|
post_install_message:
|
105
83
|
rdoc_options: []
|
106
84
|
require_paths:
|
107
85
|
- lib
|
108
86
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
87
|
requirements:
|
111
|
-
- -
|
88
|
+
- - '>='
|
112
89
|
- !ruby/object:Gem::Version
|
113
90
|
version: '0'
|
114
91
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
92
|
requirements:
|
117
|
-
- -
|
93
|
+
- - '>='
|
118
94
|
- !ruby/object:Gem::Version
|
119
95
|
version: '0'
|
120
96
|
requirements: []
|
121
97
|
rubyforge_project: rufus
|
122
|
-
rubygems_version:
|
98
|
+
rubygems_version: 2.0.14
|
123
99
|
signing_key:
|
124
|
-
specification_version:
|
100
|
+
specification_version: 4
|
125
101
|
summary: job scheduler for Ruby (at, cron, in and every jobs)
|
126
102
|
test_files: []
|
data/Rakefile
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
require 'rake'
|
5
|
-
require 'rake/clean'
|
6
|
-
require 'rdoc/task'
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
# clean
|
11
|
-
|
12
|
-
CLEAN.include('pkg', 'rdoc')
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
# test / spec
|
17
|
-
|
18
|
-
#task :spec => :check_dependencies do
|
19
|
-
task :spec do
|
20
|
-
exec 'rspec spec/'
|
21
|
-
end
|
22
|
-
task :test => :spec
|
23
|
-
|
24
|
-
task :default => :spec
|
25
|
-
|
26
|
-
|
27
|
-
#
|
28
|
-
# gem
|
29
|
-
|
30
|
-
GEMSPEC_FILE = Dir['*.gemspec'].first
|
31
|
-
GEMSPEC = eval(File.read(GEMSPEC_FILE))
|
32
|
-
GEMSPEC.validate
|
33
|
-
|
34
|
-
|
35
|
-
desc %{
|
36
|
-
builds the gem and places it in pkg/
|
37
|
-
}
|
38
|
-
task :build do
|
39
|
-
|
40
|
-
sh "gem build #{GEMSPEC_FILE}"
|
41
|
-
sh "mkdir -p pkg"
|
42
|
-
sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
|
43
|
-
end
|
44
|
-
|
45
|
-
desc %{
|
46
|
-
builds the gem and pushes it to rubygems.org
|
47
|
-
}
|
48
|
-
task :push => :build do
|
49
|
-
|
50
|
-
sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
#
|
55
|
-
# rdoc
|
56
|
-
#
|
57
|
-
# make sure to have rdoc 2.5.x to run that
|
58
|
-
|
59
|
-
Rake::RDocTask.new do |rd|
|
60
|
-
|
61
|
-
rd.main = 'README.txt'
|
62
|
-
rd.rdoc_dir = "rdoc/#{GEMSPEC.name}"
|
63
|
-
|
64
|
-
rd.rdoc_files.include('README.rdoc', 'CHANGELOG.txt', 'lib/**/*.rb')
|
65
|
-
|
66
|
-
rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
#
|
71
|
-
# upload_rdoc
|
72
|
-
|
73
|
-
desc %{
|
74
|
-
upload the rdoc to rubyforge
|
75
|
-
}
|
76
|
-
task :upload_rdoc => [ :clean, :rdoc ] do
|
77
|
-
|
78
|
-
account = 'jmettraux@rubyforge.org'
|
79
|
-
webdir = '/var/www/gforge-projects/rufus'
|
80
|
-
|
81
|
-
sh "rsync -azv -e ssh rdoc/#{GEMSPEC.name} #{account}:#{webdir}/"
|
82
|
-
end
|
83
|
-
|