devise-async 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bc72ccc5171244615739769bf6b9fca485d6701
4
+ data.tar.gz: 5ddee310635e35eaa7c892db50eaa5db3ab612dc
5
+ SHA512:
6
+ metadata.gz: 1bc76ed72a9a0c688cc820eda1089ceb730f46db902047f31c50f6673d0500ad05f382500280d320330a4be85b8941f9d3220a2654c4ed67d539a013ea57be69
7
+ data.tar.gz: 9091df36bf6efe21894c93828f8f5e64865d72b8c12e4753ffe869c40581b1ebd311c619ca7a7d1b6c6f02cf994c08be5a3d18163fb6ee80a124714052b7381c
data/.gitignore CHANGED
@@ -2,7 +2,9 @@
2
2
  *.rbc
3
3
  .bundle
4
4
  .config
5
+ .ruby-version
5
6
  .yardoc
7
+ Gemfile.lock
6
8
  InstalledFiles
7
9
  _yardoc
8
10
  coverage
@@ -1,5 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.9.0
4
+
5
+ * Multiple mailers support (baschtl)
6
+ * Update devise dependency to ~3.2
7
+
3
8
  ## 0.8.0
4
9
 
5
10
  * Support arbitrary number of arguments to mailer (glebm)
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Devise::Async::VERSION
17
17
 
18
- gem.add_dependency "devise", ">= 2.2", "< 3.2"
18
+ gem.add_dependency "devise", "~> 3.2"
19
19
 
20
20
  gem.add_development_dependency "activerecord", ">= 3.2"
21
21
  gem.add_development_dependency "actionpack", ">= 3.2"
@@ -13,13 +13,13 @@ module Devise
13
13
  def perform(method, resource_class, resource_id, *args)
14
14
  resource = resource_class.constantize.to_adapter.get!(resource_id)
15
15
  args[-1] = args.last.symbolize_keys if args.last.is_a?(Hash)
16
- mailer_class.send(method, resource, *args).deliver
16
+ mailer_class(resource).send(method, resource, *args).deliver
17
17
  end
18
18
 
19
19
  private
20
20
 
21
- def mailer_class
22
- @mailer_class ||= Devise.mailer
21
+ def mailer_class(resource = nil)
22
+ @mailer_class ||= resource.try(:devise_mailer) || Devise.mailer
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Async
3
- VERSION = "0.8.0"
3
+ VERSION = "0.9.0"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ module Devise
4
4
  module Async
5
5
  module Backend
6
6
  describe "Base" do
7
+
7
8
  it "delegates to configured mailer" do
8
9
  Devise.mailer = "MyMailer"
9
10
  user = create_user
@@ -13,6 +14,14 @@ module Devise
13
14
  Base.new.perform(:confirmation_instructions, "User", user.id, {})
14
15
  end
15
16
 
17
+ it "delegates to model configured mailer" do
18
+ user = create_user_with_mailer
19
+ mailer_instance = mock(:deliver => true)
20
+
21
+ MyMailer.expects(:confirmation_instructions).once.returns(mailer_instance)
22
+ Base.new.perform(:confirmation_instructions, "UserWithMailer", user.id, {})
23
+ end
24
+
16
25
  after do
17
26
  Devise.mailer = "Devise::Mailer"
18
27
  end
@@ -1,5 +1,5 @@
1
1
  class Admin < ActiveRecord::Base
2
2
  devise :database_authenticatable, :confirmable, :lockable, :recoverable,
3
- :registerable, :rememberable, :timeoutable, :token_authenticatable,
3
+ :registerable, :rememberable, :timeoutable,
4
4
  :trackable, :validatable, :async
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class User < ActiveRecord::Base
2
2
  devise :database_authenticatable, :confirmable, :lockable, :recoverable,
3
- :registerable, :rememberable, :timeoutable, :token_authenticatable,
3
+ :registerable, :rememberable, :timeoutable,
4
4
  :trackable, :validatable
5
5
  end
@@ -0,0 +1,6 @@
1
+ class UserWithMailer < User
2
+
3
+ def devise_mailer
4
+ MyMailer
5
+ end
6
+ end
@@ -20,6 +20,14 @@ module TestHelpers
20
20
  User.create!(valid_attributes(attributes))
21
21
  end
22
22
 
23
+ def new_user_with_mailer(attributes={})
24
+ UserWithMailer.new(valid_attributes(attributes))
25
+ end
26
+
27
+ def create_user_with_mailer(attributes={})
28
+ UserWithMailer.create!(valid_attributes(attributes))
29
+ end
30
+
23
31
  def new_admin(attributes={})
24
32
  Admin.new(valid_attributes(attributes))
25
33
  end
metadata CHANGED
@@ -1,90 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-async
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
5
- prerelease:
4
+ version: 0.9.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Marcelo Silveira
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-08 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: devise
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '2.2'
22
- - - <
17
+ - - ~>
23
18
  - !ruby/object:Gem::Version
24
19
  version: '3.2'
25
20
  type: :runtime
26
21
  prerelease: false
27
22
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
23
  requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '2.2'
33
- - - <
24
+ - - ~>
34
25
  - !ruby/object:Gem::Version
35
26
  version: '3.2'
36
27
  - !ruby/object:Gem::Dependency
37
28
  name: activerecord
38
29
  requirement: !ruby/object:Gem::Requirement
39
- none: false
40
30
  requirements:
41
- - - ! '>='
31
+ - - '>='
42
32
  - !ruby/object:Gem::Version
43
33
  version: '3.2'
44
34
  type: :development
45
35
  prerelease: false
46
36
  version_requirements: !ruby/object:Gem::Requirement
47
- none: false
48
37
  requirements:
49
- - - ! '>='
38
+ - - '>='
50
39
  - !ruby/object:Gem::Version
51
40
  version: '3.2'
52
41
  - !ruby/object:Gem::Dependency
53
42
  name: actionpack
54
43
  requirement: !ruby/object:Gem::Requirement
55
- none: false
56
44
  requirements:
57
- - - ! '>='
45
+ - - '>='
58
46
  - !ruby/object:Gem::Version
59
47
  version: '3.2'
60
48
  type: :development
61
49
  prerelease: false
62
50
  version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
51
  requirements:
65
- - - ! '>='
52
+ - - '>='
66
53
  - !ruby/object:Gem::Version
67
54
  version: '3.2'
68
55
  - !ruby/object:Gem::Dependency
69
56
  name: actionmailer
70
57
  requirement: !ruby/object:Gem::Requirement
71
- none: false
72
58
  requirements:
73
- - - ! '>='
59
+ - - '>='
74
60
  - !ruby/object:Gem::Version
75
61
  version: '3.2'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
- none: false
80
65
  requirements:
81
- - - ! '>='
66
+ - - '>='
82
67
  - !ruby/object:Gem::Version
83
68
  version: '3.2'
84
69
  - !ruby/object:Gem::Dependency
85
70
  name: sqlite3
86
71
  requirement: !ruby/object:Gem::Requirement
87
- none: false
88
72
  requirements:
89
73
  - - ~>
90
74
  - !ruby/object:Gem::Version
@@ -92,7 +76,6 @@ dependencies:
92
76
  type: :development
93
77
  prerelease: false
94
78
  version_requirements: !ruby/object:Gem::Requirement
95
- none: false
96
79
  requirements:
97
80
  - - ~>
98
81
  - !ruby/object:Gem::Version
@@ -100,7 +83,6 @@ dependencies:
100
83
  - !ruby/object:Gem::Dependency
101
84
  name: resque
102
85
  requirement: !ruby/object:Gem::Requirement
103
- none: false
104
86
  requirements:
105
87
  - - ~>
106
88
  - !ruby/object:Gem::Version
@@ -108,7 +90,6 @@ dependencies:
108
90
  type: :development
109
91
  prerelease: false
110
92
  version_requirements: !ruby/object:Gem::Requirement
111
- none: false
112
93
  requirements:
113
94
  - - ~>
114
95
  - !ruby/object:Gem::Version
@@ -116,7 +97,6 @@ dependencies:
116
97
  - !ruby/object:Gem::Dependency
117
98
  name: sidekiq
118
99
  requirement: !ruby/object:Gem::Requirement
119
- none: false
120
100
  requirements:
121
101
  - - ~>
122
102
  - !ruby/object:Gem::Version
@@ -124,7 +104,6 @@ dependencies:
124
104
  type: :development
125
105
  prerelease: false
126
106
  version_requirements: !ruby/object:Gem::Requirement
127
- none: false
128
107
  requirements:
129
108
  - - ~>
130
109
  - !ruby/object:Gem::Version
@@ -132,7 +111,6 @@ dependencies:
132
111
  - !ruby/object:Gem::Dependency
133
112
  name: delayed_job_active_record
134
113
  requirement: !ruby/object:Gem::Requirement
135
- none: false
136
114
  requirements:
137
115
  - - ~>
138
116
  - !ruby/object:Gem::Version
@@ -140,7 +118,6 @@ dependencies:
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
- none: false
144
121
  requirements:
145
122
  - - ~>
146
123
  - !ruby/object:Gem::Version
@@ -148,7 +125,6 @@ dependencies:
148
125
  - !ruby/object:Gem::Dependency
149
126
  name: queue_classic
150
127
  requirement: !ruby/object:Gem::Requirement
151
- none: false
152
128
  requirements:
153
129
  - - ~>
154
130
  - !ruby/object:Gem::Version
@@ -156,7 +132,6 @@ dependencies:
156
132
  type: :development
157
133
  prerelease: false
158
134
  version_requirements: !ruby/object:Gem::Requirement
159
- none: false
160
135
  requirements:
161
136
  - - ~>
162
137
  - !ruby/object:Gem::Version
@@ -164,7 +139,6 @@ dependencies:
164
139
  - !ruby/object:Gem::Dependency
165
140
  name: mocha
166
141
  requirement: !ruby/object:Gem::Requirement
167
- none: false
168
142
  requirements:
169
143
  - - ~>
170
144
  - !ruby/object:Gem::Version
@@ -172,7 +146,6 @@ dependencies:
172
146
  type: :development
173
147
  prerelease: false
174
148
  version_requirements: !ruby/object:Gem::Requirement
175
- none: false
176
149
  requirements:
177
150
  - - ~>
178
151
  - !ruby/object:Gem::Version
@@ -180,7 +153,6 @@ dependencies:
180
153
  - !ruby/object:Gem::Dependency
181
154
  name: minitest
182
155
  requirement: !ruby/object:Gem::Requirement
183
- none: false
184
156
  requirements:
185
157
  - - ~>
186
158
  - !ruby/object:Gem::Version
@@ -188,7 +160,6 @@ dependencies:
188
160
  type: :development
189
161
  prerelease: false
190
162
  version_requirements: !ruby/object:Gem::Requirement
191
- none: false
192
163
  requirements:
193
164
  - - ~>
194
165
  - !ruby/object:Gem::Version
@@ -196,7 +167,6 @@ dependencies:
196
167
  - !ruby/object:Gem::Dependency
197
168
  name: torquebox-no-op
198
169
  requirement: !ruby/object:Gem::Requirement
199
- none: false
200
170
  requirements:
201
171
  - - ~>
202
172
  - !ruby/object:Gem::Version
@@ -204,7 +174,6 @@ dependencies:
204
174
  type: :development
205
175
  prerelease: false
206
176
  version_requirements: !ruby/object:Gem::Requirement
207
- none: false
208
177
  requirements:
209
178
  - - ~>
210
179
  - !ruby/object:Gem::Version
@@ -221,7 +190,6 @@ files:
221
190
  - .travis.yml
222
191
  - CHANGELOG.md
223
192
  - Gemfile
224
- - Gemfile.lock
225
193
  - LICENSE
226
194
  - README.md
227
195
  - Rakefile
@@ -252,6 +220,7 @@ files:
252
220
  - test/support/rails_app.rb
253
221
  - test/support/rails_app/app/models/admin.rb
254
222
  - test/support/rails_app/app/models/user.rb
223
+ - test/support/rails_app/app/models/user_with_mailer.rb
255
224
  - test/support/rails_app/config/database.yml
256
225
  - test/support/rails_app/config/initializers/devise.rb
257
226
  - test/support/rails_app/config/initializers/devise_async.rb
@@ -262,33 +231,26 @@ files:
262
231
  - test/test_helper.rb
263
232
  homepage: https://github.com/mhfs/devise-async/
264
233
  licenses: []
234
+ metadata: {}
265
235
  post_install_message:
266
236
  rdoc_options: []
267
237
  require_paths:
268
238
  - lib
269
239
  required_ruby_version: !ruby/object:Gem::Requirement
270
- none: false
271
240
  requirements:
272
- - - ! '>='
241
+ - - '>='
273
242
  - !ruby/object:Gem::Version
274
243
  version: '0'
275
- segments:
276
- - 0
277
- hash: -3289238140870980510
278
244
  required_rubygems_version: !ruby/object:Gem::Requirement
279
- none: false
280
245
  requirements:
281
- - - ! '>='
246
+ - - '>='
282
247
  - !ruby/object:Gem::Version
283
248
  version: '0'
284
- segments:
285
- - 0
286
- hash: -3289238140870980510
287
249
  requirements: []
288
250
  rubyforge_project:
289
- rubygems_version: 1.8.23
251
+ rubygems_version: 2.0.3
290
252
  signing_key:
291
- specification_version: 3
253
+ specification_version: 4
292
254
  summary: Devise Async provides an easy way to configure Devise to send its emails
293
255
  asynchronously using your preferred queuing backend. It supports Resque, Sidekiq,
294
256
  Delayed::Job and QueueClassic.
@@ -307,6 +269,7 @@ test_files:
307
269
  - test/support/rails_app.rb
308
270
  - test/support/rails_app/app/models/admin.rb
309
271
  - test/support/rails_app/app/models/user.rb
272
+ - test/support/rails_app/app/models/user_with_mailer.rb
310
273
  - test/support/rails_app/config/database.yml
311
274
  - test/support/rails_app/config/initializers/devise.rb
312
275
  - test/support/rails_app/config/initializers/devise_async.rb
@@ -1,144 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- devise-async (0.8.0)
5
- devise (>= 2.2, < 3.2)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- actionmailer (3.2.14)
11
- actionpack (= 3.2.14)
12
- mail (~> 2.5.4)
13
- actionpack (3.2.14)
14
- activemodel (= 3.2.14)
15
- activesupport (= 3.2.14)
16
- builder (~> 3.0.0)
17
- erubis (~> 2.7.0)
18
- journey (~> 1.0.4)
19
- rack (~> 1.4.5)
20
- rack-cache (~> 1.2)
21
- rack-test (~> 0.6.1)
22
- sprockets (~> 2.2.1)
23
- activemodel (3.2.14)
24
- activesupport (= 3.2.14)
25
- builder (~> 3.0.0)
26
- activerecord (3.2.14)
27
- activemodel (= 3.2.14)
28
- activesupport (= 3.2.14)
29
- arel (~> 3.0.2)
30
- tzinfo (~> 0.3.29)
31
- activesupport (3.2.14)
32
- i18n (~> 0.6, >= 0.6.4)
33
- multi_json (~> 1.0)
34
- arel (3.0.2)
35
- atomic (1.1.13)
36
- bcrypt-ruby (3.1.2)
37
- builder (3.0.4)
38
- celluloid (0.10.0)
39
- connection_pool (0.9.3)
40
- delayed_job (3.0.4)
41
- activesupport (~> 3.0)
42
- delayed_job_active_record (0.4.4)
43
- activerecord (>= 2.1.0, < 4)
44
- delayed_job (~> 3.0)
45
- devise (3.1.0)
46
- bcrypt-ruby (~> 3.0)
47
- orm_adapter (~> 0.1)
48
- railties (>= 3.2.6, < 5)
49
- thread_safe (~> 0.1)
50
- warden (~> 1.2.3)
51
- erubis (2.7.0)
52
- hike (1.2.3)
53
- i18n (0.6.5)
54
- journey (1.0.4)
55
- json (1.8.0)
56
- mail (2.5.4)
57
- mime-types (~> 1.16)
58
- treetop (~> 1.4.8)
59
- metaclass (0.0.1)
60
- mime-types (1.25)
61
- minitest (3.5.0)
62
- mocha (0.14.0)
63
- metaclass (~> 0.0.1)
64
- mono_logger (1.1.0)
65
- multi_json (1.8.0)
66
- orm_adapter (0.4.0)
67
- pg (0.16.0)
68
- polyglot (0.3.3)
69
- queue_classic (2.2.2)
70
- pg (~> 0.16.0)
71
- rack (1.4.5)
72
- rack-cache (1.2)
73
- rack (>= 0.4)
74
- rack-protection (1.5.0)
75
- rack
76
- rack-ssl (1.3.3)
77
- rack
78
- rack-test (0.6.2)
79
- rack (>= 1.0)
80
- railties (3.2.14)
81
- actionpack (= 3.2.14)
82
- activesupport (= 3.2.14)
83
- rack-ssl (~> 1.3.2)
84
- rake (>= 0.8.7)
85
- rdoc (~> 3.4)
86
- thor (>= 0.14.6, < 2.0)
87
- rake (10.1.0)
88
- rdoc (3.12.2)
89
- json (~> 1.4)
90
- redis (3.0.4)
91
- redis-namespace (1.3.1)
92
- redis (~> 3.0.0)
93
- resque (1.24.1)
94
- mono_logger (~> 1.0)
95
- multi_json (~> 1.0)
96
- redis-namespace (~> 1.2)
97
- sinatra (>= 0.9.2)
98
- vegas (~> 0.1.2)
99
- sidekiq (1.2.1)
100
- celluloid (~> 0.10.0)
101
- connection_pool (~> 0.9.0)
102
- multi_json (~> 1)
103
- redis
104
- redis-namespace
105
- sinatra (1.4.3)
106
- rack (~> 1.4)
107
- rack-protection (~> 1.4)
108
- tilt (~> 1.3, >= 1.3.4)
109
- sprockets (2.2.2)
110
- hike (~> 1.2)
111
- multi_json (~> 1.0)
112
- rack (~> 1.0)
113
- tilt (~> 1.1, != 1.3.0)
114
- sqlite3 (1.3.8)
115
- thor (0.18.1)
116
- thread_safe (0.1.2)
117
- atomic
118
- tilt (1.4.1)
119
- torquebox-no-op (2.3.2)
120
- treetop (1.4.15)
121
- polyglot
122
- polyglot (>= 0.3.1)
123
- tzinfo (0.3.37)
124
- vegas (0.1.11)
125
- rack (>= 1.0.0)
126
- warden (1.2.3)
127
- rack (>= 1.0)
128
-
129
- PLATFORMS
130
- ruby
131
-
132
- DEPENDENCIES
133
- actionmailer (>= 3.2)
134
- actionpack (>= 3.2)
135
- activerecord (>= 3.2)
136
- delayed_job_active_record (~> 0.3)
137
- devise-async!
138
- minitest (~> 3.0)
139
- mocha (~> 0.11)
140
- queue_classic (~> 2.0)
141
- resque (~> 1.20)
142
- sidekiq (~> 1.2)
143
- sqlite3 (~> 1.3)
144
- torquebox-no-op (~> 2.3)