clockwork 2.0.3 → 2.0.4
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.
- checksums.yaml +4 -4
- data/.travis.yml +12 -8
- data/CHANGELOG.md +9 -0
- data/README.md +26 -17
- data/bin/clockwork +1 -1
- data/clockwork.gemspec +2 -3
- data/gemfiles/activesupport4.gemfile +2 -2
- data/gemfiles/{activesupport3.gemfile → activesupport5.gemfile} +2 -1
- data/lib/clockwork.rb +1 -1
- data/lib/clockwork/event.rb +1 -1
- data/test/at_test.rb +1 -0
- metadata +8 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ad11e2b8e79db572d4240dd9ce2065067b22514919d4debc3758065b438ebca
|
4
|
+
data.tar.gz: 5dec51edf5bbd101a002e8c6ede3f11918441d75281b2baff3091bc0995721c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f06770eaf4eb2b473ee165a00ddf7b6326f957ccfbf1eb71ee65a3e4a840ea8a42fe052a52a7032f7b786677bad54e94bc58a7f3961a44bb404c16685dcddc48
|
7
|
+
data.tar.gz: 5a60bddb9ae7b7312e8df9a4b01a022d9072a3a4f2fdb7f5790f03a61cf8b31a0d6fc4a76c3b80abeee63eeb269447922b2c065982497f2d6f7becd33082f78e
|
data/.travis.yml
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
cache: bundler
|
4
|
+
before_install:
|
5
|
+
- gem update --system
|
6
|
+
# This is required to support ActiveSupport 4
|
7
|
+
# https://docs.travis-ci.com/user/languages/ruby/#bundler-20
|
8
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
9
|
+
- gem install bundler -v '< 2'
|
4
10
|
rvm:
|
5
|
-
-
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- jruby-19mode
|
11
|
-
- # rbx-2.2.7
|
11
|
+
- 2.3.8
|
12
|
+
- 2.4.5
|
13
|
+
- 2.5.3
|
14
|
+
- jruby-9.1.17.0
|
15
|
+
- jruby-9.2.6.0
|
12
16
|
gemfile:
|
13
|
-
- gemfiles/activesupport3.gemfile
|
14
17
|
- gemfiles/activesupport4.gemfile
|
18
|
+
- gemfiles/activesupport5.gemfile
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Clockwork - a clock process to replace cron [](https://travis-ci.org/Rykian/clockwork)
|
1
|
+
Clockwork - a clock process to replace cron [](https://travis-ci.org/Rykian/clockwork)
|
2
2
|
===========================================
|
3
3
|
|
4
4
|
Cron is non-ideal for running scheduled application tasks, especially in an app
|
@@ -18,6 +18,8 @@ Create clock.rb:
|
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
require 'clockwork'
|
21
|
+
require 'active_support/time' # Allow numeric durations (eg: 1.minutes)
|
22
|
+
|
21
23
|
module Clockwork
|
22
24
|
handler do |job|
|
23
25
|
puts "Running #{job}"
|
@@ -58,8 +60,8 @@ Quickstart for Heroku
|
|
58
60
|
|
59
61
|
Clockwork fits well with heroku's cedar stack.
|
60
62
|
|
61
|
-
Consider
|
62
|
-
a new project for
|
63
|
+
Consider using [clockwork-init.sh](https://gist.github.com/tomykaira/1312172) to create
|
64
|
+
a new project for Heroku.
|
63
65
|
|
64
66
|
Use with queueing
|
65
67
|
-----------------
|
@@ -80,6 +82,7 @@ For example, if you're using Beanstalk/Stalker:
|
|
80
82
|
|
81
83
|
```ruby
|
82
84
|
require 'stalker'
|
85
|
+
require 'active_support/time'
|
83
86
|
|
84
87
|
module Clockwork
|
85
88
|
handler { |job| Stalker.enqueue(job) }
|
@@ -150,25 +153,23 @@ When one of the events is ready to be run (based on it's `frequency`, and possib
|
|
150
153
|
|
151
154
|
`ActiveRecord` models are a perfect candidate for the model class. Having said that, the only requirements are:
|
152
155
|
|
153
|
-
|
154
|
-
|
155
|
-
2. the instances returned respond to:
|
156
|
-
|
157
|
-
- `id` returning a unique identifier (this is needed to track changes to event settings)
|
156
|
+
1. the class responds to `all` returning an array of instances from the database
|
158
157
|
|
159
|
-
|
158
|
+
2. the instances returned respond to:
|
159
|
+
- `id` returning a unique identifier (this is needed to track changes to event settings)
|
160
|
+
- `frequency` returning the how frequently (in seconds) the database event should be run
|
160
161
|
|
161
|
-
|
162
|
+
- `attributes` returning a hash of [attribute name] => [attribute value] values (or really anything that we can use store on registering the event, and then compare again to see if the state has changed later)
|
162
163
|
|
163
|
-
|
164
|
+
- `at` *(optional)* return any acceptable clockwork `:at` string
|
164
165
|
|
165
|
-
|
166
|
+
- `name` *(optional)* returning the name for the event (used to identify it in the Clockwork output)
|
166
167
|
|
167
|
-
|
168
|
+
- `if?`*(optional)* returning either true or false, depending on whether the database event should run at the given time (this method will be passed the time as a parameter, much like the standard clockwork `:if`)
|
168
169
|
|
169
|
-
|
170
|
+
- `ignored_attributes` *(optional)* returning an array of model attributes (as symbols) to ignore when determining whether the database event has been modified since our last run
|
170
171
|
|
171
|
-
|
172
|
+
- `tz` *(optional)* returning the timezone to use (default is the local timezone)
|
172
173
|
|
173
174
|
#### Example Setup
|
174
175
|
|
@@ -329,7 +330,8 @@ If this is a problem, please use the `:thread` option to prevent the long runnin
|
|
329
330
|
```ruby
|
330
331
|
every(1.day, 'reminders.send', :at => '00:00', :tz => 'UTC')
|
331
332
|
# Runs the job each day at midnight, UTC.
|
332
|
-
# The value for :tz can be anything supported by [TZInfo](
|
333
|
+
# The value for :tz can be anything supported by [TZInfo](https://github.com/tzinfo/tzinfo)
|
334
|
+
# Using the 'tzinfo' gem, run TZInfo::Timezone.all_identifiers to get a list of acceptable identifiers.
|
333
335
|
```
|
334
336
|
|
335
337
|
### :if
|
@@ -343,7 +345,7 @@ Run on every first day of month.
|
|
343
345
|
Clockwork.every(1.day, 'myjob', :if => lambda { |t| t.day == 1 })
|
344
346
|
```
|
345
347
|
|
346
|
-
The argument is an instance of `
|
348
|
+
The argument is an instance of `ActiveSupport::TimeWithZone` if the `:tz` option is set. Otherwise, it's an instance of `Time`.
|
347
349
|
|
348
350
|
This argument cannot be omitted. Please use _ as placeholder if not needed.
|
349
351
|
|
@@ -560,6 +562,13 @@ clockworkd -c YOUR_CLOCK.rb start
|
|
560
562
|
|
561
563
|
For more details, you can run `clockworkd -h`.
|
562
564
|
|
565
|
+
Integration Testing
|
566
|
+
-------------------
|
567
|
+
|
568
|
+
You could take a look at:
|
569
|
+
* [clockwork-mocks](https://github.com/dpoetzsch/clockwork-mocks) that helps with running scheduled tasks during integration testing.
|
570
|
+
* [clockwork-test](https://github.com/kevin-j-m/clockwork-test) which ensures that tasks are triggered at the right time
|
571
|
+
|
563
572
|
Issues and Pull requests
|
564
573
|
------------------------
|
565
574
|
|
data/bin/clockwork
CHANGED
data/clockwork.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "clockwork"
|
3
|
-
s.version = "2.0.
|
3
|
+
s.version = "2.0.4"
|
4
4
|
|
5
5
|
s.authors = ["Adam Wiggins", "tomykaira"]
|
6
6
|
s.license = 'MIT'
|
@@ -18,10 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
20
|
s.add_dependency(%q<tzinfo>)
|
21
|
+
s.add_dependency(%q<activesupport>)
|
21
22
|
|
22
|
-
s.add_development_dependency "bundler", "~> 1.3"
|
23
23
|
s.add_development_dependency "rake"
|
24
|
-
s.add_development_dependency "activesupport"
|
25
24
|
s.add_development_dependency "daemons"
|
26
25
|
s.add_development_dependency "minitest", "~> 5.8"
|
27
26
|
s.add_development_dependency "mocha"
|
data/lib/clockwork.rb
CHANGED
data/lib/clockwork/event.rb
CHANGED
data/test/at_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clockwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Wiggins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tzinfo
|
@@ -26,27 +26,13 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '1.3'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '1.3'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rake
|
29
|
+
name: activesupport
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
45
31
|
requirements:
|
46
32
|
- - ">="
|
47
33
|
- !ruby/object:Gem::Version
|
48
34
|
version: '0'
|
49
|
-
type: :
|
35
|
+
type: :runtime
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
@@ -54,7 +40,7 @@ dependencies:
|
|
54
40
|
- !ruby/object:Gem::Version
|
55
41
|
version: '0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
43
|
+
name: rake
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
59
45
|
requirements:
|
60
46
|
- - ">="
|
@@ -137,6 +123,7 @@ extra_rdoc_files:
|
|
137
123
|
files:
|
138
124
|
- ".gitignore"
|
139
125
|
- ".travis.yml"
|
126
|
+
- CHANGELOG.md
|
140
127
|
- Gemfile
|
141
128
|
- LICENSE
|
142
129
|
- README.md
|
@@ -146,8 +133,8 @@ files:
|
|
146
133
|
- clockwork.gemspec
|
147
134
|
- clockworkd.1
|
148
135
|
- example.rb
|
149
|
-
- gemfiles/activesupport3.gemfile
|
150
136
|
- gemfiles/activesupport4.gemfile
|
137
|
+
- gemfiles/activesupport5.gemfile
|
151
138
|
- lib/clockwork.rb
|
152
139
|
- lib/clockwork/at.rb
|
153
140
|
- lib/clockwork/database_events.rb
|
@@ -188,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
175
|
version: '0'
|
189
176
|
requirements: []
|
190
177
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.7.
|
178
|
+
rubygems_version: 2.7.6
|
192
179
|
signing_key:
|
193
180
|
specification_version: 4
|
194
181
|
summary: A scheduler process to replace cron.
|