rufus-scheduler 3.1.4 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.txt +5 -0
- data/CREDITS.txt +1 -0
- data/README.md +16 -0
- data/lib/rufus/scheduler.rb +1 -1
- data/lib/rufus/scheduler/zones.rb +1 -0
- data/lib/rufus/scheduler/zotime.rb +8 -2
- data/spec/cronline_spec.rb +10 -10
- metadata +43 -53
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3868d39562cba26f7847e6c4d0fe93082e24be3e
|
4
|
+
data.tar.gz: eb5d20085cfb73db2dd72b9bd612f4e944e92617
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 23d02926922b50fa0d6c99f27e004a0140e53526d6b1659a56da2a83a94e83ce5b16d9c3cacbd8d3bb30bc926ba63611fea9d9443eec34c5ed5fcd4edbed8745
|
7
|
+
data.tar.gz: 2b3e50578a1bd80a11d78e66a1dc38a8e34bf1e9c004e9a40e8f2dba87b12801baf06da44a6389fea36139035372f86e835a6a1d9220212e482a0fe835810e1a
|
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
= rufus-scheduler CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== rufus-scheduler - 3.1.5 released 2015-09-25
|
6
|
+
|
7
|
+
- fix for "not a valid cronline" on "mingw" Ruby distributions, gh-166
|
8
|
+
|
9
|
+
|
5
10
|
== rufus-scheduler - 3.1.4 released 2015/08/29
|
6
11
|
|
7
12
|
- fix cron issue reported by Jesse https://github.com/jhw-at-prosperworks-com
|
data/CREDITS.txt
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
|
39
39
|
== Feedback
|
40
40
|
|
41
|
+
- Radek - http://stackoverflow.com/users/250422 - gh-166
|
41
42
|
- Patrik Ragnarsson - https://github.com/dentarg - timeout vs nil, gh-156
|
42
43
|
- twitter @adefilaedward1 - typo in readme
|
43
44
|
- Michael Guymon - https://github.com/mguymon - #next_time vs :first_at
|
data/README.md
CHANGED
@@ -1399,6 +1399,7 @@ s = Rufus::Scheduler.singleton
|
|
1399
1399
|
s.every '1m' do
|
1400
1400
|
|
1401
1401
|
Rails.logger.info "hello, it's #{Time.now}"
|
1402
|
+
Rails.logger.flush
|
1402
1403
|
end
|
1403
1404
|
```
|
1404
1405
|
|
@@ -1427,6 +1428,21 @@ The rufus-scheduler singleton is instantiated in the ```config/initializers/sche
|
|
1427
1428
|
|
1428
1429
|
*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.
|
1429
1430
|
|
1431
|
+
### rails server -d
|
1432
|
+
|
1433
|
+
(Written in reply to https://github.com/jmettraux/rufus-scheduler/issues/165 )
|
1434
|
+
|
1435
|
+
There is the handy `rails server -d` that starts a development Rails as a daemon. The annoying thing is that the scheduler as seen above is started in the main process that then gets forked and daemonized. The rufus-scheduler thread (and any other thread) gets lost, no scheduling happens.
|
1436
|
+
|
1437
|
+
I avoid running `-d` in development mode and bother about daemonizing only for production deployment.
|
1438
|
+
|
1439
|
+
These are two well crafted articles on process daemonization, please read them:
|
1440
|
+
|
1441
|
+
* http://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/
|
1442
|
+
* http://www.mikeperham.com/2014/07/07/use-runit/
|
1443
|
+
|
1444
|
+
If, anyway, you need something like `rails server -d`, why not try `bundle exec unicorn -D` instead? In my (limited) experience, it worked out of the box (well, had to add `gem 'unicorn'` to `Gemfile` first).
|
1445
|
+
|
1430
1446
|
|
1431
1447
|
## support
|
1432
1448
|
|
data/lib/rufus/scheduler.rb
CHANGED
@@ -151,6 +151,7 @@ America/Argentina/Catamarca America/Indiana/Indianapolis
|
|
151
151
|
America/North_Dakota/New_Salem America/Argentina/Rio_Gallegos
|
152
152
|
America/Argentina/Buenos_Aires America/Argentina/ComodRivadavia
|
153
153
|
]
|
154
|
+
TIMEZONEs = TIMEZONES.collect(&:downcase)
|
154
155
|
|
155
156
|
##
|
156
157
|
## http://en.wikipedia.org/wiki/List_of_time_zone_abbreviations
|
@@ -121,17 +121,23 @@ class Rufus::Scheduler
|
|
121
121
|
def self.is_timezone?(str)
|
122
122
|
|
123
123
|
return false if str == nil
|
124
|
+
return false if str == '*'
|
125
|
+
|
126
|
+
return false if str.index('#')
|
127
|
+
# "sun#2", etc... On OSX would go all the way to true
|
124
128
|
|
125
129
|
return true if Time.zone_offset(str)
|
126
|
-
return true if str == 'Zulu' || str == 'UTC'
|
127
130
|
|
128
131
|
return !! (::TZInfo::Timezone.get(str) rescue nil) if defined?(::TZInfo)
|
129
132
|
|
133
|
+
return true if TIMEZONES.include?(str)
|
134
|
+
return true if TIMEZONEs.include?(str)
|
135
|
+
|
130
136
|
t = ZoTime.new(0, str).time
|
131
137
|
|
132
138
|
return false if t.zone == ''
|
133
139
|
return false if t.zone == 'UTC'
|
134
|
-
return false if
|
140
|
+
return false if t.utc_offset == 0 && str.start_with?(t.zone)
|
135
141
|
# 3 common fallbacks...
|
136
142
|
|
137
143
|
return false if RUBY_PLATFORM.include?('java') && ! envtzable?(str)
|
data/spec/cronline_spec.rb
CHANGED
@@ -100,12 +100,12 @@ describe Rufus::Scheduler::CronLine do
|
|
100
100
|
|
101
101
|
it 'rejects invalid weekday expressions' do
|
102
102
|
|
103
|
-
expect { cl '0 17 * * MON_FRI' }.to raise_error
|
103
|
+
expect { cl '0 17 * * MON_FRI' }.to raise_error(ArgumentError)
|
104
104
|
# underline instead of dash
|
105
105
|
|
106
|
-
expect { cl '* * * * 9' }.to raise_error
|
107
|
-
expect { cl '* * * * 0-12' }.to raise_error
|
108
|
-
expect { cl '* * * * BLABLA' }.to raise_error
|
106
|
+
expect { cl '* * * * 9' }.to raise_error(ArgumentError)
|
107
|
+
expect { cl '* * * * 0-12' }.to raise_error(ArgumentError)
|
108
|
+
expect { cl '* * * * BLABLA' }.to raise_error(ArgumentError)
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'rejects invalid cronlines' do
|
@@ -125,8 +125,8 @@ describe Rufus::Scheduler::CronLine do
|
|
125
125
|
'* * * * * * America/New_York',
|
126
126
|
[ nil, nil, nil, nil, nil, nil, nil, 'America/New_York' ])
|
127
127
|
|
128
|
-
expect { cl '* * * * * NotATimeZone' }.to raise_error
|
129
|
-
expect { cl '* * * * * * NotATimeZone' }.to raise_error
|
128
|
+
expect { cl '* * * * * NotATimeZone' }.to raise_error(ArgumentError)
|
129
|
+
expect { cl '* * * * * * NotATimeZone' }.to raise_error(ArgumentError)
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'interprets cron strings with / (slashes) correctly' do
|
@@ -432,7 +432,7 @@ describe Rufus::Scheduler::CronLine do
|
|
432
432
|
eq(local(1970,1,1,1,1,50))
|
433
433
|
)
|
434
434
|
expect(nt('*/10 * * * * *',local(1970,1,1,1,1,50))).to(
|
435
|
-
eq(local(1970,1,1,1,2,00))
|
435
|
+
eq(local(1970,1,1,1,2,00))
|
436
436
|
)
|
437
437
|
end
|
438
438
|
end
|
@@ -450,9 +450,9 @@ describe Rufus::Scheduler::CronLine do
|
|
450
450
|
# ...
|
451
451
|
[ '*/10 * * * * *', local(1970,1,1,1,1,49), 1 ], # 9 sec to 50s mark
|
452
452
|
[ '*/10 * * * * *', local(1970,1,1,1,1,50), 0 ], # 0 sec to 50s mark
|
453
|
-
[ '*/10 * * * * *', local(1970,1,1,1,1,51), 9 ],
|
454
|
-
].each do |cronline,now,sec|
|
455
|
-
it "
|
453
|
+
[ '*/10 * * * * *', local(1970,1,1,1,1,51), 9 ],
|
454
|
+
].each do |cronline, now, sec|
|
455
|
+
it "ensures that next_second('#{cronline}', #{now}) is #{sec}" do
|
456
456
|
expect(ns(cronline,now)).to eq(sec)
|
457
457
|
end
|
458
458
|
end
|
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
5
|
-
prerelease:
|
4
|
+
version: 3.1.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Mettraux
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.13.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.13.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: chronic
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: tzinfo
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description: job scheduler for Ruby (at, cron, in and every jobs).
|
@@ -82,70 +73,69 @@ executables: []
|
|
82
73
|
extensions: []
|
83
74
|
extra_rdoc_files: []
|
84
75
|
files:
|
76
|
+
- CHANGELOG.txt
|
77
|
+
- CREDITS.txt
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
85
80
|
- Rakefile
|
81
|
+
- TODO.txt
|
86
82
|
- lib/rufus-scheduler.rb
|
87
83
|
- lib/rufus/scheduler.rb
|
88
|
-
- lib/rufus/scheduler/locks.rb
|
89
|
-
- lib/rufus/scheduler/zotime.rb
|
90
84
|
- lib/rufus/scheduler/cronline.rb
|
91
|
-
- lib/rufus/scheduler/
|
85
|
+
- lib/rufus/scheduler/job_array.rb
|
92
86
|
- lib/rufus/scheduler/jobs.rb
|
87
|
+
- lib/rufus/scheduler/locks.rb
|
88
|
+
- lib/rufus/scheduler/util.rb
|
93
89
|
- lib/rufus/scheduler/zones.rb
|
94
|
-
- lib/rufus/scheduler/
|
95
|
-
-
|
96
|
-
- spec/
|
97
|
-
- spec/
|
98
|
-
- spec/
|
90
|
+
- lib/rufus/scheduler/zotime.rb
|
91
|
+
- rufus-scheduler.gemspec
|
92
|
+
- spec/basics_spec.rb
|
93
|
+
- spec/cronline_spec.rb
|
94
|
+
- spec/error_spec.rb
|
99
95
|
- spec/job_array_spec.rb
|
100
|
-
- spec/schedule_interval_spec.rb
|
101
96
|
- spec/job_at_spec.rb
|
102
|
-
- spec/
|
103
|
-
- spec/
|
104
|
-
- spec/
|
105
|
-
- spec/schedule_cron_spec.rb
|
97
|
+
- spec/job_cron_spec.rb
|
98
|
+
- spec/job_every_spec.rb
|
99
|
+
- spec/job_in_spec.rb
|
106
100
|
- spec/job_interval_spec.rb
|
107
101
|
- spec/job_repeat_spec.rb
|
108
|
-
- spec/
|
109
|
-
- spec/
|
110
|
-
- spec/
|
102
|
+
- spec/job_spec.rb
|
103
|
+
- spec/lock_custom_spec.rb
|
104
|
+
- spec/lock_flock_spec.rb
|
111
105
|
- spec/lock_lockfile_spec.rb
|
112
|
-
- spec/
|
106
|
+
- spec/lock_spec.rb
|
113
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
|
114
113
|
- spec/scheduler_spec.rb
|
115
|
-
- spec/
|
116
|
-
- spec/
|
117
|
-
- spec/
|
118
|
-
- spec/job_every_spec.rb
|
119
|
-
- spec/lock_flock_spec.rb
|
120
|
-
- rufus-scheduler.gemspec
|
121
|
-
- CHANGELOG.txt
|
122
|
-
- TODO.txt
|
123
|
-
- LICENSE.txt
|
124
|
-
- CREDITS.txt
|
125
|
-
- README.md
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
- spec/threads_spec.rb
|
116
|
+
- spec/zotime_spec.rb
|
126
117
|
homepage: http://github.com/jmettraux/rufus-scheduler
|
127
118
|
licenses:
|
128
119
|
- MIT
|
120
|
+
metadata: {}
|
129
121
|
post_install_message:
|
130
122
|
rdoc_options: []
|
131
123
|
require_paths:
|
132
124
|
- lib
|
133
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
126
|
requirements:
|
136
|
-
- -
|
127
|
+
- - ">="
|
137
128
|
- !ruby/object:Gem::Version
|
138
129
|
version: '0'
|
139
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
131
|
requirements:
|
142
|
-
- -
|
132
|
+
- - ">="
|
143
133
|
- !ruby/object:Gem::Version
|
144
134
|
version: '0'
|
145
135
|
requirements: []
|
146
136
|
rubyforge_project: rufus
|
147
|
-
rubygems_version:
|
137
|
+
rubygems_version: 2.2.2
|
148
138
|
signing_key:
|
149
|
-
specification_version:
|
139
|
+
specification_version: 4
|
150
140
|
summary: job scheduler for Ruby (at, cron, in and every jobs)
|
151
141
|
test_files: []
|