devise-async 0.1.1 → 0.2.0
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.
- data/CHANGELOG.md +4 -0
- data/README.md +11 -0
- data/lib/devise/async.rb +4 -0
- data/lib/devise/async/backend/resque.rb +1 -1
- data/lib/devise/async/backend/sidekiq.rb +1 -1
- data/lib/devise/async/version.rb +1 -1
- data/test/devise/async/backend/resque_test.rb +6 -0
- data/test/devise/async/backend/sidekiq_test.rb +6 -0
- data/test/support/rails_app/config/initializers/devise_async.rb +3 -0
- data/test/test_helper.rb +1 -0
- metadata +6 -4
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,16 @@ you'll need to tell `Devise::Async` to proxy to that class.
|
|
54
54
|
Devise::Async.mailer = "MyCustomMailer"
|
55
55
|
```
|
56
56
|
|
57
|
+
### Custom queue
|
58
|
+
|
59
|
+
Let you specify a custom queue where to enqueue your background Devise jobs. Works
|
60
|
+
only for Resque and Sidekiq. Defaults to :mailer.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# config/initializers/devise_async.rb
|
64
|
+
Devise::Async.queue = :my_custom_queue
|
65
|
+
```
|
66
|
+
|
57
67
|
### Setup via block
|
58
68
|
|
59
69
|
To avoid repeating `Devise::Async` in the initializer file you can use the block syntax
|
@@ -64,6 +74,7 @@ similar do what `Devise` offers.
|
|
64
74
|
Devise::Async.setup do |config|
|
65
75
|
config.backend = :resque
|
66
76
|
config.mailer = "MyCustomMailer"
|
77
|
+
config.queue = :my_custom_queue
|
67
78
|
end
|
68
79
|
```
|
69
80
|
|
data/lib/devise/async.rb
CHANGED
@@ -22,6 +22,10 @@ module Devise
|
|
22
22
|
mattr_accessor :mailer
|
23
23
|
@@mailer = "Devise::Mailer"
|
24
24
|
|
25
|
+
# Defines the queue in which the background job will be enqueued. Default is :mailer.
|
26
|
+
mattr_accessor :queue
|
27
|
+
@@queue = :mailer
|
28
|
+
|
25
29
|
# Allow configuring Devise::Async with a block
|
26
30
|
#
|
27
31
|
# Example:
|
data/lib/devise/async/version.rb
CHANGED
@@ -15,6 +15,12 @@ module Devise
|
|
15
15
|
Backend::Resque.perform(:confirmation_instructions, "User", user.id)
|
16
16
|
ActionMailer::Base.deliveries.size.must_equal 1
|
17
17
|
end
|
18
|
+
|
19
|
+
it "enqueues to configured queue" do
|
20
|
+
expected_size = 1 + ::Resque.size(:custom_queue)
|
21
|
+
Resque.enqueue(:mailer_method, "User", 123)
|
22
|
+
::Resque.size(:custom_queue).must_equal expected_size
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
@@ -15,6 +15,12 @@ module Devise
|
|
15
15
|
Backend::Sidekiq.new.perform(:confirmation_instructions, "User", user.id)
|
16
16
|
ActionMailer::Base.deliveries.size.must_equal 1
|
17
17
|
end
|
18
|
+
|
19
|
+
it "enqueues to configured queue" do
|
20
|
+
expected_size = 1 + Sidekiq.jobs.size
|
21
|
+
Sidekiq.enqueue(:mailer_method, "User", 123)
|
22
|
+
Sidekiq.jobs.size.must_equal expected_size
|
23
|
+
end
|
18
24
|
end
|
19
25
|
end
|
20
26
|
end
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: devise
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- test/support/rails_app/app/models/user.rb
|
211
211
|
- test/support/rails_app/config/database.yml
|
212
212
|
- test/support/rails_app/config/initializers/devise.rb
|
213
|
+
- test/support/rails_app/config/initializers/devise_async.rb
|
213
214
|
- test/support/rails_app/config/routes.rb
|
214
215
|
- test/support/rails_app/db/schema.rb
|
215
216
|
- test/support/rails_app/log/development.log
|
@@ -229,7 +230,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
230
|
version: '0'
|
230
231
|
segments:
|
231
232
|
- 0
|
232
|
-
hash:
|
233
|
+
hash: -2016895500650412107
|
233
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
235
|
none: false
|
235
236
|
requirements:
|
@@ -238,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
239
|
version: '0'
|
239
240
|
segments:
|
240
241
|
- 0
|
241
|
-
hash:
|
242
|
+
hash: -2016895500650412107
|
242
243
|
requirements: []
|
243
244
|
rubyforge_project:
|
244
245
|
rubygems_version: 1.8.23
|
@@ -262,6 +263,7 @@ test_files:
|
|
262
263
|
- test/support/rails_app/app/models/user.rb
|
263
264
|
- test/support/rails_app/config/database.yml
|
264
265
|
- test/support/rails_app/config/initializers/devise.rb
|
266
|
+
- test/support/rails_app/config/initializers/devise_async.rb
|
265
267
|
- test/support/rails_app/config/routes.rb
|
266
268
|
- test/support/rails_app/db/schema.rb
|
267
269
|
- test/support/rails_app/log/development.log
|