qe 0.3.5 → 0.4.0

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
  SHA1:
3
- metadata.gz: 4fc9d27dd577ce5164a2d8f785bbd0444461dfeb
4
- data.tar.gz: a9baded0b5e1978af43a46430a6fa4aa7948ce56
3
+ metadata.gz: b2b51561f2d0b2049401a673a8d2742b81afa42e
4
+ data.tar.gz: 042ff83f3a95c09ee581eea21b82793304e19857
5
5
  SHA512:
6
- metadata.gz: 7bf8d75c482e0617a79986acdb41a4718e2e83b20d30e1504de4211a1a4783478a95291ff036de1fca3f07f5acaea05deaa68fd6ee540eda1f7b0e6cd9a5bc6c
7
- data.tar.gz: b0d02d51692709520bfecca71e796898acd20d280c3408ece0cc13e2e9a84b16f8734bf16228cc23ae2282ae7c983620d521f1232a5aea1362faf40a9b0d1cba
6
+ metadata.gz: c2fa0a4118dd9a201648aff7fa0a82e503fad9ae6f51441d1954e1fa3d6d68fa0630289758c0b05b13cb8e00434bae30b50d48c93aa994cc5af814e42ca85b72
7
+ data.tar.gz: ef8a1bcb96c133cabf80132b141f13bdeb3d7ef6ce03041c6b854a6ad693b51082f01641f5650ea898bb4850c3dcb456068544e8bb9ac586fb39110b23e1eaa4
@@ -1,90 +1,91 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qe (0.3.5)
4
+ qe (0.4.0)
5
5
  activesupport
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.1.1)
11
- activesupport (= 4.1.1)
10
+ activemodel (4.2.0)
11
+ activesupport (= 4.2.0)
12
12
  builder (~> 3.1)
13
- activerecord (4.1.1)
14
- activemodel (= 4.1.1)
15
- activesupport (= 4.1.1)
16
- arel (~> 5.0.0)
17
- activesupport (4.1.1)
18
- i18n (~> 0.6, >= 0.6.9)
13
+ activerecord (4.2.0)
14
+ activemodel (= 4.2.0)
15
+ activesupport (= 4.2.0)
16
+ arel (~> 6.0)
17
+ activesupport (4.2.0)
18
+ i18n (~> 0.7)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
21
- thread_safe (~> 0.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
22
  tzinfo (~> 1.1)
23
- arel (5.0.1.20140414130214)
24
- awesome_print (1.2.0)
25
- backburner (0.4.5)
23
+ arel (6.0.0)
24
+ awesome_print (1.6.1)
25
+ backburner (0.4.6)
26
26
  beaneater (~> 0.3.1)
27
27
  dante (~> 0.1.5)
28
- beaneater (0.3.2)
28
+ beaneater (0.3.3)
29
29
  builder (3.2.2)
30
- celluloid (0.15.2)
31
- timers (~> 1.1.0)
30
+ celluloid (0.16.0)
31
+ timers (~> 4.0.0)
32
32
  coderay (1.1.0)
33
- connection_pool (2.0.0)
33
+ connection_pool (2.1.1)
34
34
  dante (0.1.5)
35
- delayed_job (4.0.1)
36
- activesupport (>= 3.0, < 4.2)
37
- delayed_job_active_record (4.0.1)
38
- activerecord (>= 3.0, < 4.2)
35
+ delayed_job (4.0.6)
36
+ activesupport (>= 3.0, < 5.0)
37
+ delayed_job_active_record (4.0.3)
38
+ activerecord (>= 3.0, < 5.0)
39
39
  delayed_job (>= 3.0, < 4.1)
40
40
  diff-lcs (1.2.5)
41
- i18n (0.6.9)
42
- json (1.8.1)
41
+ hitimes (1.2.2)
42
+ i18n (0.7.0)
43
+ json (1.8.2)
43
44
  method_source (0.8.2)
44
- minitest (5.3.4)
45
+ minitest (5.5.1)
45
46
  mono_logger (1.1.0)
46
47
  multi_json (1.10.1)
47
- pry (0.10.0)
48
+ pry (0.10.1)
48
49
  coderay (~> 1.1.0)
49
50
  method_source (~> 0.8.1)
50
51
  slop (~> 3.4)
51
52
  qu (0.2.0)
52
53
  multi_json
53
- rack (1.5.2)
54
+ rack (1.6.0)
54
55
  rack-protection (1.5.3)
55
56
  rack
56
- rake (10.3.2)
57
- redis (3.0.7)
58
- redis-namespace (1.4.1)
59
- redis (~> 3.0.4)
57
+ rake (10.4.2)
58
+ redis (3.2.0)
59
+ redis-namespace (1.5.1)
60
+ redis (~> 3.0, >= 3.0.4)
60
61
  resque (1.25.2)
61
62
  mono_logger (~> 1.0)
62
63
  multi_json (~> 1.0)
63
64
  redis-namespace (~> 1.3)
64
65
  sinatra (>= 0.9.2)
65
66
  vegas (~> 0.1.2)
66
- resque-scheduler (3.0.0)
67
+ resque-scheduler (4.0.0)
67
68
  mono_logger (~> 1.0)
68
69
  redis (~> 3.0)
69
70
  resque (~> 1.25)
70
- rufus-scheduler (~> 2.0)
71
- rspec (3.0.0)
72
- rspec-core (~> 3.0.0)
73
- rspec-expectations (~> 3.0.0)
74
- rspec-mocks (~> 3.0.0)
75
- rspec-core (3.0.1)
76
- rspec-support (~> 3.0.0)
77
- rspec-expectations (3.0.1)
71
+ rufus-scheduler (~> 3.0)
72
+ rspec (3.1.0)
73
+ rspec-core (~> 3.1.0)
74
+ rspec-expectations (~> 3.1.0)
75
+ rspec-mocks (~> 3.1.0)
76
+ rspec-core (3.1.7)
77
+ rspec-support (~> 3.1.0)
78
+ rspec-expectations (3.1.2)
78
79
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.0.0)
80
- rspec-mocks (3.0.1)
81
- rspec-support (~> 3.0.0)
82
- rspec-support (3.0.0)
83
- rufus-scheduler (2.0.24)
84
- tzinfo (>= 0.3.22)
85
- sidekiq (3.1.4)
86
- celluloid (>= 0.15.2)
87
- connection_pool (>= 2.0.0)
80
+ rspec-support (~> 3.1.0)
81
+ rspec-mocks (3.1.3)
82
+ rspec-support (~> 3.1.0)
83
+ rspec-support (3.1.2)
84
+ rufus-scheduler (3.0.9)
85
+ tzinfo
86
+ sidekiq (3.3.1)
87
+ celluloid (>= 0.16.0)
88
+ connection_pool (>= 2.1.1)
88
89
  json
89
90
  redis (>= 3.0.6)
90
91
  redis-namespace (>= 1.3.1)
@@ -92,12 +93,13 @@ GEM
92
93
  rack (~> 1.4)
93
94
  rack-protection (~> 1.4)
94
95
  tilt (~> 1.3, >= 1.3.4)
95
- slop (3.5.0)
96
- sqlite3 (1.3.9)
96
+ slop (3.6.0)
97
+ sqlite3 (1.3.10)
97
98
  thread_safe (0.3.4)
98
99
  tilt (1.4.1)
99
- timers (1.1.0)
100
- tzinfo (1.2.1)
100
+ timers (4.0.1)
101
+ hitimes
102
+ tzinfo (1.2.2)
101
103
  thread_safe (~> 0.1)
102
104
  vegas (0.1.11)
103
105
  rack (>= 1.0.0)
data/README.md CHANGED
@@ -184,6 +184,23 @@ If the `mailer()` method isn't defined, the `Qe::ActionMailer::AbstractMethodErr
184
184
 
185
185
  If the `:mail` option isn't defined, the `Qe::ActionMailer::MissingMailNameError` exception will be raised.
186
186
 
187
+ ### Sidekiq
188
+
189
+ You can set Sidekiq options by using the method `Sidekiq::Worker.options`.
190
+
191
+ ```ruby
192
+ require 'qe/sidekiq'
193
+
194
+ class NonRetryableWorker
195
+ include Qe::Worker
196
+ options retry: false
197
+
198
+ def perform
199
+ # do something...
200
+ end
201
+ end
202
+ ```
203
+
187
204
  ### Development support
188
205
 
189
206
  Qe comes with development support. Instead of starting up workers on development environment, you can use the `Qe::Immediate` adapter, which executes your worker right away!
@@ -222,7 +239,6 @@ describe "Enqueuing a job" do
222
239
  end
223
240
  ```
224
241
 
225
-
226
242
  ## Maintainer
227
243
 
228
244
  * Nando Vieira (<http://nandovieira.com.br>)
@@ -12,12 +12,12 @@ module Qe
12
12
  end
13
13
 
14
14
  def self.enqueue(worker, options = {})
15
- Worker.sidekiq_options :queue => worker.queue
15
+ Worker.sidekiq_options worker.options.merge(:queue => worker.queue)
16
16
  Worker.perform_async(worker.name, options)
17
17
  end
18
18
 
19
19
  def self.schedule(worker, run_at, options = {})
20
- Worker.sidekiq_options :queue => worker.queue
20
+ Worker.sidekiq_options worker.options.merge(:queue => worker.queue)
21
21
  Worker.perform_at(run_at, worker.name, options)
22
22
  end
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Qe
2
- VERSION = "0.3.5"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -18,6 +18,12 @@ module Qe
18
18
  @queue = args.first unless args.empty?
19
19
  (@queue || :default).to_s
20
20
  end
21
+
22
+ # Set the queue options.
23
+ def options(*args)
24
+ @options = args.first unless args.empty?
25
+ @options || {}
26
+ end
21
27
  end
22
28
  end
23
29
  end
@@ -23,7 +23,7 @@ describe Qe::Sidekiq do
23
23
 
24
24
  context "enqueuing" do
25
25
  let(:worker) {
26
- double("worker", :queue => "some_queue", :name => "SomeWorker")
26
+ double("worker", :queue => "some_queue", :name => "SomeWorker", :options => {})
27
27
  }
28
28
 
29
29
  before do
@@ -43,11 +43,22 @@ describe Qe::Sidekiq do
43
43
 
44
44
  Qe::Sidekiq.enqueue(worker, :a => 1)
45
45
  end
46
+
47
+ it "sets options" do
48
+ worker = Class.new do
49
+ include Qe::Worker
50
+ options :retry => false
51
+ end
52
+
53
+ expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
54
+ .with(hash_including(:retry => false))
55
+ Qe::Sidekiq.enqueue(worker)
56
+ end
46
57
  end
47
58
 
48
59
  context "scheduling" do
49
60
  let(:worker) {
50
- double("worker", :queue => "some_queue", :name => "SomeWorker")
61
+ double("worker", :queue => "some_queue", :name => "SomeWorker", :options => {})
51
62
  }
52
63
 
53
64
  before do
@@ -58,7 +69,7 @@ describe Qe::Sidekiq do
58
69
  expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
59
70
  .with(:queue => "some_queue")
60
71
 
61
- Qe::Sidekiq.enqueue(worker)
72
+ Qe::Sidekiq.schedule(worker, Time.now)
62
73
  end
63
74
 
64
75
  it "schedules job" do
@@ -69,5 +80,18 @@ describe Qe::Sidekiq do
69
80
 
70
81
  Qe::Sidekiq.schedule(worker, date, :a => 1)
71
82
  end
83
+
84
+ it "sets options" do
85
+ Qe.adapter = Qe::Sidekiq
86
+
87
+ worker = Class.new do
88
+ include Qe::Worker
89
+ options :retry => false
90
+ end
91
+
92
+ expect(Qe::Sidekiq::Worker).to receive(:sidekiq_options)
93
+ .with(hash_including(:retry => false))
94
+ Qe::Sidekiq.schedule(worker, Time.now)
95
+ end
72
96
  end
73
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-13 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
272
  version: '0'
273
273
  requirements: []
274
274
  rubyforge_project:
275
- rubygems_version: 2.2.2
275
+ rubygems_version: 2.4.5
276
276
  signing_key:
277
277
  specification_version: 4
278
278
  summary: A simple interface over several background job libraries like Resque, Sidekiq
@@ -294,4 +294,3 @@ test_files:
294
294
  - spec/spec_helper.rb
295
295
  - spec/support/hello_worker.rb
296
296
  - spec/support/localized_worker.rb
297
- has_rdoc: