sidekiq-cron 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
- Sidekiq-Cron
2
- ============
1
+ Sidekiq-Cron [![Gem Version](https://badge.fury.io/rb/sidekiq-cron.png)](http://badge.fury.io/rb/sidekiq-cron) [![Build Status](https://travis-ci.org/ondrejbartas/sidekiq-cron.png?branch=master)](https://travis-ci.org/ondrejbartas/sidekiq-cron) [![Coverage Status](https://coveralls.io/repos/ondrejbartas/sidekiq-cron/badge.png?branch=master)](https://coveralls.io/r/ondrejbartas/sidekiq-cron?branch=master)
2
+ ================================================================================================================================================================================================================================================================================================================================================================================================================================================
3
3
 
4
- [![Build Status](https://travis-ci.org/ondrejbartas/sidekiq-cron.png?branch=master)](https://travis-ci.org/ondrejbartas/sidekiq-cron) [![Coverage Status](https://coveralls.io/repos/ondrejbartas/sidekiq-cron/badge.png?branch=master)](https://coveralls.io/r/ondrejbartas/sidekiq-cron?branch=master)
5
4
 
6
5
  Add-on for [Sidekiq](http://sidekiq.org)
7
6
 
@@ -75,6 +74,71 @@ unless job.save
75
74
  end
76
75
  ```
77
76
 
77
+ Load more jobs from hash:
78
+ ```ruby
79
+
80
+ hash = {
81
+ 'name_of_job' => {
82
+ 'class' => 'MyClass',
83
+ 'cron' => '1 * * * *',
84
+ 'args' => '(OPTIONAL) [Array or Hash]'
85
+ },
86
+ 'My super iber cool job' => {
87
+ 'class' => 'SecondClass',
88
+ 'cron' => '*/5 * * * *'
89
+ }
90
+ }
91
+
92
+ Sidekiq::Cron::Job.load_from_hash hash
93
+ ```
94
+
95
+ Load more jobs from array:
96
+ ```ruby
97
+ array = [
98
+ {
99
+ 'name' => 'name_of_job',
100
+ 'class' => 'MyClass',
101
+ 'cron' => '1 * * * *',
102
+ 'args' => '(OPTIONAL) [Array or Hash]'
103
+ },
104
+ {
105
+ 'name' => 'Cool Job for Second Class',
106
+ 'class' => 'SecondClass',
107
+ 'cron' => '*/5 * * * *'
108
+ }
109
+ ]
110
+
111
+ Sidekiq::Cron::Job.load_from_array array
112
+ ```
113
+
114
+ or from YML (same notation as Resque-scheduler)
115
+ ```yaml
116
+ #config/shedule.yml
117
+
118
+ my_first_job:
119
+ cron: "*/5 * * * *"
120
+ class: "HardWorker"
121
+ queue: hard_worker
122
+
123
+ second_job:
124
+ cron: "*/30 * * * *"
125
+ class: "HardWorker"
126
+ queue: hard_worker_long
127
+ args:
128
+ hard: "stuff"
129
+ ```
130
+
131
+ ```ruby
132
+ #initializers/sidekiq.rb
133
+ schedule_file = "config/schedule.yml"
134
+
135
+ if File.exists?(schedule_file)
136
+ Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
137
+ end
138
+ ```
139
+
140
+
141
+
78
142
  #### Finding jobs
79
143
  ```ruby
80
144
  #return array of all jobs
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
@@ -1,5 +1,8 @@
1
- require 'sidekiq/cron/poller'
1
+ #require Sidekiq original launcher
2
+ require 'sidekiq/launcher'
2
3
 
4
+ #require cron poller
5
+ require 'sidekiq/cron/poller'
3
6
 
4
7
  # For Cron we need to add some methods to Launcher
5
8
  # so look at the code bellow.
data/lib/sidekiq/cron.rb CHANGED
@@ -10,6 +10,7 @@ require "sidekiq/cron/web_extension"
10
10
  #require poller only if celluloid is defined
11
11
  if defined?(Celluloid)
12
12
  require "sidekiq/cron/poller"
13
+ require "sidekiq/cron/launcher"
13
14
  end
14
15
 
15
16
  module Sidekiq
data/sidekiq-cron.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "sidekiq-cron"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ondrej Bartas"]
12
- s.date = "2013-08-25"
12
+ s.date = "2013-08-26"
13
13
  s.description = "Enables to set jobs to be run in specified time (using CRON notation)"
14
14
  s.email = "ondrej@bartas.cz"
15
15
  s.extra_rdoc_files = [
@@ -30,11 +30,11 @@ Gem::Specification.new do |s|
30
30
  "lib/sidekiq-cron.rb",
31
31
  "lib/sidekiq/cron.rb",
32
32
  "lib/sidekiq/cron/job.rb",
33
+ "lib/sidekiq/cron/launcher.rb",
33
34
  "lib/sidekiq/cron/locales/en.yml",
34
35
  "lib/sidekiq/cron/poller.rb",
35
36
  "lib/sidekiq/cron/views/cron.slim",
36
37
  "lib/sidekiq/cron/web_extension.rb",
37
- "lib/sidekiq/launcher.rb",
38
38
  "sidekiq-cron.gemspec",
39
39
  "test/test_helper.rb",
40
40
  "test/unit/job_test.rb",
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  s.homepage = "http://github.com/ondrejbartas/sidekiq-cron"
45
45
  s.licenses = ["MIT"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = "1.8.25"
47
+ s.rubygems_version = "1.8.24"
48
48
  s.summary = "Sidekiq Cron helps to add repeated scheduled jobs"
49
49
 
50
50
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-25 00:00:00.000000000 Z
12
+ date: 2013-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - '>='
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 2.13.1
22
22
  type: :runtime
@@ -24,7 +24,7 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - '>='
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 2.13.1
30
30
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - '>='
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: 0.1.2
38
38
  type: :runtime
@@ -40,7 +40,7 @@ dependencies:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - '>='
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 0.1.2
46
46
  - !ruby/object:Gem::Dependency
@@ -48,7 +48,7 @@ dependencies:
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - '>='
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
@@ -56,7 +56,7 @@ dependencies:
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - '>='
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - '>='
67
+ - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  type: :development
@@ -72,7 +72,7 @@ dependencies:
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - '>='
75
+ - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
@@ -80,7 +80,7 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - '>='
83
+ - - ! '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  type: :development
@@ -88,7 +88,7 @@ dependencies:
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - '>='
91
+ - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  - !ruby/object:Gem::Dependency
@@ -96,7 +96,7 @@ dependencies:
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - '>='
99
+ - - ! '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  type: :development
@@ -104,7 +104,7 @@ dependencies:
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - '>='
107
+ - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,7 @@ dependencies:
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - '>='
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
@@ -120,7 +120,7 @@ dependencies:
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - '>='
123
+ - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
@@ -128,7 +128,7 @@ dependencies:
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
- - - '>='
131
+ - - ! '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
@@ -136,7 +136,7 @@ dependencies:
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
139
- - - '>='
139
+ - - ! '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  - !ruby/object:Gem::Dependency
@@ -160,7 +160,7 @@ dependencies:
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
- - - '>='
163
+ - - ! '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  type: :development
@@ -168,7 +168,7 @@ dependencies:
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
171
- - - '>='
171
+ - - ! '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  - !ruby/object:Gem::Dependency
@@ -176,7 +176,7 @@ dependencies:
176
176
  requirement: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements:
179
- - - '>='
179
+ - - ! '>='
180
180
  - !ruby/object:Gem::Version
181
181
  version: '0'
182
182
  type: :development
@@ -184,7 +184,7 @@ dependencies:
184
184
  version_requirements: !ruby/object:Gem::Requirement
185
185
  none: false
186
186
  requirements:
187
- - - '>='
187
+ - - ! '>='
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
190
  - !ruby/object:Gem::Dependency
@@ -192,7 +192,7 @@ dependencies:
192
192
  requirement: !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
- - - '>='
195
+ - - ! '>='
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  type: :development
@@ -200,7 +200,7 @@ dependencies:
200
200
  version_requirements: !ruby/object:Gem::Requirement
201
201
  none: false
202
202
  requirements:
203
- - - '>='
203
+ - - ! '>='
204
204
  - !ruby/object:Gem::Version
205
205
  version: '0'
206
206
  - !ruby/object:Gem::Dependency
@@ -208,7 +208,7 @@ dependencies:
208
208
  requirement: !ruby/object:Gem::Requirement
209
209
  none: false
210
210
  requirements:
211
- - - '>='
211
+ - - ! '>='
212
212
  - !ruby/object:Gem::Version
213
213
  version: '0'
214
214
  type: :development
@@ -216,7 +216,7 @@ dependencies:
216
216
  version_requirements: !ruby/object:Gem::Requirement
217
217
  none: false
218
218
  requirements:
219
- - - '>='
219
+ - - ! '>='
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  - !ruby/object:Gem::Dependency
@@ -224,7 +224,7 @@ dependencies:
224
224
  requirement: !ruby/object:Gem::Requirement
225
225
  none: false
226
226
  requirements:
227
- - - '>='
227
+ - - ! '>='
228
228
  - !ruby/object:Gem::Version
229
229
  version: '0'
230
230
  type: :development
@@ -232,7 +232,7 @@ dependencies:
232
232
  version_requirements: !ruby/object:Gem::Requirement
233
233
  none: false
234
234
  requirements:
235
- - - '>='
235
+ - - ! '>='
236
236
  - !ruby/object:Gem::Version
237
237
  version: '0'
238
238
  - !ruby/object:Gem::Dependency
@@ -240,7 +240,7 @@ dependencies:
240
240
  requirement: !ruby/object:Gem::Requirement
241
241
  none: false
242
242
  requirements:
243
- - - '>='
243
+ - - ! '>='
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  type: :development
@@ -248,7 +248,7 @@ dependencies:
248
248
  version_requirements: !ruby/object:Gem::Requirement
249
249
  none: false
250
250
  requirements:
251
- - - '>='
251
+ - - ! '>='
252
252
  - !ruby/object:Gem::Version
253
253
  version: '0'
254
254
  description: Enables to set jobs to be run in specified time (using CRON notation)
@@ -272,11 +272,11 @@ files:
272
272
  - lib/sidekiq-cron.rb
273
273
  - lib/sidekiq/cron.rb
274
274
  - lib/sidekiq/cron/job.rb
275
+ - lib/sidekiq/cron/launcher.rb
275
276
  - lib/sidekiq/cron/locales/en.yml
276
277
  - lib/sidekiq/cron/poller.rb
277
278
  - lib/sidekiq/cron/views/cron.slim
278
279
  - lib/sidekiq/cron/web_extension.rb
279
- - lib/sidekiq/launcher.rb
280
280
  - sidekiq-cron.gemspec
281
281
  - test/test_helper.rb
282
282
  - test/unit/job_test.rb
@@ -292,21 +292,21 @@ require_paths:
292
292
  required_ruby_version: !ruby/object:Gem::Requirement
293
293
  none: false
294
294
  requirements:
295
- - - '>='
295
+ - - ! '>='
296
296
  - !ruby/object:Gem::Version
297
297
  version: '0'
298
298
  segments:
299
299
  - 0
300
- hash: -3914560018168738406
300
+ hash: -1445982085601461411
301
301
  required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  none: false
303
303
  requirements:
304
- - - '>='
304
+ - - ! '>='
305
305
  - !ruby/object:Gem::Version
306
306
  version: '0'
307
307
  requirements: []
308
308
  rubyforge_project:
309
- rubygems_version: 1.8.25
309
+ rubygems_version: 1.8.24
310
310
  signing_key:
311
311
  specification_version: 3
312
312
  summary: Sidekiq Cron helps to add repeated scheduled jobs