devise-async 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.4.0
4
+
5
+ * Enhancements
6
+ * Add support for queue config to DelayedJob backend
7
+ * Use Devise third party modules API insted of including module directly.
8
+ This fixes the ordering issue when including.
9
+
3
10
  ## 0.3.1
4
11
 
5
12
  * Fixes
data/README.md CHANGED
@@ -26,18 +26,23 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
- ### Devise >= 2.1.1
30
-
31
- Include `Devise::Async::Model` to your Devise model
29
+ Add `:async` to the `devise` call in your model:
32
30
 
33
31
  ```ruby
34
32
  class User < ActiveRecord::Base
35
- devise :database_authenticatable, :confirmable # etc ...
36
-
37
- include Devise::Async::Model # should be below call to `devise`
33
+ devise :database_authenticatable, :async, :confirmable # etc ...
38
34
  end
39
35
  ```
40
36
 
37
+ Set your queuing backend by creating `config/initializers/devise_async.rb`:
38
+
39
+ ```ruby
40
+ # Supported options: :resque, :sidekiq, :delayed_job
41
+ Devise::Async.backend = :resque
42
+ ```
43
+
44
+ Tip: it defaults to Resque. You don't need to create the initializer if using it.
45
+
41
46
  ### Devise < 2.1.1
42
47
 
43
48
  Set `Devise::Async::Proxy` as Devise's mailer in `config/initializers/devise.rb`:
@@ -46,16 +51,9 @@ Set `Devise::Async::Proxy` as Devise's mailer in `config/initializers/devise.rb`
46
51
  # Configure the class responsible to send e-mails.
47
52
  config.mailer = "Devise::Async::Proxy"
48
53
  ```
49
- ### All
50
-
51
- Set your queuing backend by creating `config/initializers/devise_async.rb`:
52
54
 
53
- ```ruby
54
- # Supported options: :resque, :sidekiq, :delayed_job
55
- Devise::Async.backend = :resque
56
- ```
57
-
58
- Tip: it defaults to Resque. You don't need to create the initializer if using it.
55
+ Note: before devise 2.1.1 devise-async had issues with background jobs trying to run
56
+ before the record was committed to the DB if the creation was transactioned.
59
57
 
60
58
  ## Advanced Options
61
59
 
@@ -56,3 +56,5 @@ module DeviseAsync
56
56
  Devise::Async.backend = value
57
57
  end
58
58
  end
59
+
60
+ Devise.add_module(:async, :model => 'devise/async/model')
@@ -3,7 +3,7 @@ module Devise
3
3
  module Backend
4
4
  class DelayedJob < Base
5
5
  def self.enqueue(*args)
6
- new.delay.perform(*args)
6
+ new.delay(:queue => Devise::Async.queue).perform(*args)
7
7
  end
8
8
  end
9
9
  end
@@ -1,8 +1,19 @@
1
1
  module Devise
2
+ # TODO remove when appropriate
2
3
  module Async
3
4
  module Model
4
5
  extend ActiveSupport::Concern
5
6
 
7
+ included do
8
+ warn "Including Devise::Async::Model directly in your models is no longer supported and won't work. Please add `:async` to your `devise` call."
9
+ end
10
+ end
11
+ end
12
+
13
+ module Models
14
+ module Async
15
+ extend ActiveSupport::Concern
16
+
6
17
  included do
7
18
  if respond_to?(:after_commit) # AR only
8
19
  after_commit :send_devise_pending_notifications
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Async
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -1,7 +1,5 @@
1
1
  class Admin < ActiveRecord::Base
2
2
  devise :database_authenticatable, :confirmable, :lockable, :recoverable,
3
3
  :registerable, :rememberable, :timeoutable, :token_authenticatable,
4
- :trackable, :validatable
5
-
6
- include Devise::Async::Model
4
+ :trackable, :validatable, :async
7
5
  end
@@ -5,9 +5,9 @@ require "minitest/spec"
5
5
  require "minitest/mock"
6
6
  require "mocha"
7
7
 
8
+ require "devise"
8
9
  require "devise/async"
9
10
  require "rails/all"
10
- require "devise"
11
11
  require "resque"
12
12
  require "sidekiq"
13
13
  require "delayed_job_active_record"
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.3.1
4
+ version: 0.4.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-08-15 00:00:00.000000000 Z
12
+ date: 2012-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: devise
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  segments:
234
234
  - 0
235
- hash: -215577202643201492
235
+ hash: -1947628383257764484
236
236
  required_rubygems_version: !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  version: '0'
242
242
  segments:
243
243
  - 0
244
- hash: -215577202643201492
244
+ hash: -1947628383257764484
245
245
  requirements: []
246
246
  rubyforge_project:
247
247
  rubygems_version: 1.8.23