clockwork 2.0.3 → 2.0.4

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
  SHA256:
3
- metadata.gz: 2c3178abe3610be706ab5cbb8ca2b62ee014fa94232a35346c27d48ec31fc0ab
4
- data.tar.gz: b6a65f9d5c6ea01047cb2bc6fd2b9f58f9f2093ac5d043eecdee1ef8a221034a
3
+ metadata.gz: 7ad11e2b8e79db572d4240dd9ce2065067b22514919d4debc3758065b438ebca
4
+ data.tar.gz: 5dec51edf5bbd101a002e8c6ede3f11918441d75281b2baff3091bc0995721c4
5
5
  SHA512:
6
- metadata.gz: 52dee0a57f8b01792089770f77aad73af9fa7eab7a113b44733e66bd7d335abe268a7bd60f36c7f96d9c56e17d1e4d26eb94b066b9eb9ea8a669d67de1e2d9b7
7
- data.tar.gz: fcacc19bfd3ffd3a12df1ad2d6cf71a32802e9de17b7833704af19d766cb76b8000ca236741208447af6e04515b25029da2d999c808c921b222d7076b961f985
6
+ metadata.gz: f06770eaf4eb2b473ee165a00ddf7b6326f957ccfbf1eb71ee65a3e4a840ea8a42fe052a52a7032f7b786677bad54e94bc58a7f3961a44bb404c16685dcddc48
7
+ data.tar.gz: 5a60bddb9ae7b7312e8df9a4b01a022d9072a3a4f2fdb7f5790f03a61cf8b31a0d6fc4a76c3b80abeee63eeb269447922b2c065982497f2d6f7becd33082f78e
@@ -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
- - 1.9.3
6
- - 2.0.0
7
- - 2.1
8
- - 2.2
9
- - ruby-2.3.1
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
@@ -0,0 +1,9 @@
1
+ ## 2.0.4 ##
2
+
3
+ * Reverts the breaking changes in PR #18 that went out in patch 2.0.3
4
+
5
+ *Javier Julio*
6
+
7
+ ## 2.0.3 (February 15, 2018) ##
8
+
9
+ * [See the version release](https://github.com/Rykian/clockwork/releases) for the commits that were included.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Clockwork - a clock process to replace cron [![Build Status](https://api.travis-ci.org/Rykian/clockwork.png?branch=master)](https://travis-ci.org/Rykian/clockwork) [![Dependency Status](https://gemnasium.com/Rykian/clockwork.png)](https://gemnasium.com/Rykian/clockwork)
1
+ Clockwork - a clock process to replace cron [![Build Status](https://api.travis-ci.org/Rykian/clockwork.png?branch=master)](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 to use [clockwork-init.sh](https://gist.github.com/1312172) to create
62
- a new project for heroku.
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
- 1. the class responds to `all` returning an array of instances from the database
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
- - `frequency` returning the how frequently (in seconds) the database event should be run
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
- - `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
+ - `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
- - (optionally) `at` return any acceptable clockwork `:at` string
164
+ - `at` *(optional)* return any acceptable clockwork `:at` string
164
165
 
165
- - (optionally) `name` returning the name for the event (used to identify it in the Clockwork output)
166
+ - `name` *(optional)* returning the name for the event (used to identify it in the Clockwork output)
166
167
 
167
- - (optionally) `if?` 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
+ - `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
- - (optionally) `ignored_attributes` returning an array of model attributes (as symbols) to ignore when determining whether the database event has been modified since our last run
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
- - (optionally) `tz` returning the timezone to use (default is the local timezone)
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](http://tzinfo.rubyforge.org/)
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 `Time`. If the `:tz` option is set, it has the given time zone. Otherwise, the time zone is the system time zone.
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
 
@@ -4,7 +4,7 @@ STDERR.sync = STDOUT.sync = true
4
4
 
5
5
  require 'clockwork'
6
6
 
7
- usage = 'clockwork <clock.rb>'
7
+ usage = 'Usage: clockwork <clock.rb>'
8
8
  file = ARGV.shift or abort usage
9
9
 
10
10
  file = "./#{file}" unless file.match(/^[\/.]/)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "clockwork"
3
- s.version = "2.0.3"
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"
@@ -6,6 +6,6 @@ platforms :rbx do
6
6
  gem 'rubinius-developer_tools'
7
7
  end
8
8
 
9
- gem 'activesupport', '~> 4.0.0'
10
- gem 'minitest', '~> 4.2'
9
+ gem 'activesupport', '~> 4.2'
10
+ gem 'minitest', '~> 5.0'
11
11
  gemspec :path=>"../"
@@ -6,5 +6,6 @@ platforms :rbx do
6
6
  gem 'rubinius-developer_tools'
7
7
  end
8
8
 
9
- gem 'activesupport', '~> 3.2.14'
9
+ gem 'activesupport', '~> 5.0'
10
+ gem 'minitest', '~> 5.0'
10
11
  gemspec :path=>"../"
@@ -1,5 +1,5 @@
1
1
  require 'logger'
2
- require 'tzinfo'
2
+ require 'active_support/time'
3
3
 
4
4
  require 'clockwork/at'
5
5
  require 'clockwork/event'
@@ -17,7 +17,7 @@ module Clockwork
17
17
  end
18
18
 
19
19
  def convert_timezone(t)
20
- @timezone ? t.getlocal(TZInfo::Timezone.get(@timezone).period_for_utc(t).utc_total_offset) : t
20
+ @timezone ? t.in_time_zone(@timezone) : t
21
21
  end
22
22
 
23
23
  def run_now?(t)
@@ -2,6 +2,7 @@ require File.expand_path('../../lib/clockwork', __FILE__)
2
2
  require "minitest/autorun"
3
3
  require 'mocha/setup'
4
4
  require 'time'
5
+ require 'active_support/time'
5
6
 
6
7
  describe 'Clockwork::At' do
7
8
  def time_in_day(hour, minute)
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.3
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: 2018-02-15 00:00:00.000000000 Z
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: bundler
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: :development
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: activesupport
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.3
178
+ rubygems_version: 2.7.6
192
179
  signing_key:
193
180
  specification_version: 4
194
181
  summary: A scheduler process to replace cron.