resque_mail_queue 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +57 -51
- data/lib/resque_mail_queue.rb +20 -10
- data/readme.md +1 -1
- data/resque_mail_queue.gemspec +2 -2
- data/spec/resque_mail_queue_spec.rb +17 -13
- metadata +12 -12
- data/.rbenv-gemsets +0 -1
data/Gemfile.lock
CHANGED
@@ -1,78 +1,84 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
resque_mail_queue (0.0
|
5
|
-
actionmailer (>= 3.
|
4
|
+
resque_mail_queue (0.2.0)
|
5
|
+
actionmailer (>= 3.1)
|
6
6
|
resque (>= 1.1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
rack (~> 1.2
|
22
|
-
rack-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
i18n (~> 0.
|
29
|
-
|
30
|
-
builder (
|
11
|
+
actionmailer (3.2.5)
|
12
|
+
actionpack (= 3.2.5)
|
13
|
+
mail (~> 2.4.4)
|
14
|
+
actionpack (3.2.5)
|
15
|
+
activemodel (= 3.2.5)
|
16
|
+
activesupport (= 3.2.5)
|
17
|
+
builder (~> 3.0.0)
|
18
|
+
erubis (~> 2.7.0)
|
19
|
+
journey (~> 1.0.1)
|
20
|
+
rack (~> 1.4.0)
|
21
|
+
rack-cache (~> 1.2)
|
22
|
+
rack-test (~> 0.6.1)
|
23
|
+
sprockets (~> 2.1.3)
|
24
|
+
activemodel (3.2.5)
|
25
|
+
activesupport (= 3.2.5)
|
26
|
+
builder (~> 3.0.0)
|
27
|
+
activesupport (3.2.5)
|
28
|
+
i18n (~> 0.6)
|
29
|
+
multi_json (~> 1.0)
|
30
|
+
builder (3.0.0)
|
31
31
|
diff-lcs (1.1.3)
|
32
|
-
erubis (2.
|
33
|
-
|
34
|
-
i18n (0.
|
35
|
-
|
36
|
-
|
32
|
+
erubis (2.7.0)
|
33
|
+
hike (1.2.1)
|
34
|
+
i18n (0.6.0)
|
35
|
+
journey (1.0.3)
|
36
|
+
mail (2.4.4)
|
37
37
|
i18n (>= 0.4.0)
|
38
38
|
mime-types (~> 1.16)
|
39
39
|
treetop (~> 1.4.8)
|
40
|
-
mime-types (1.
|
41
|
-
multi_json (1.
|
42
|
-
polyglot (0.3.
|
43
|
-
rack (1.
|
44
|
-
rack-
|
45
|
-
rack (>=
|
46
|
-
rack-
|
40
|
+
mime-types (1.18)
|
41
|
+
multi_json (1.3.6)
|
42
|
+
polyglot (0.3.3)
|
43
|
+
rack (1.4.1)
|
44
|
+
rack-cache (1.2)
|
45
|
+
rack (>= 0.4)
|
46
|
+
rack-protection (1.2.0)
|
47
|
+
rack
|
48
|
+
rack-test (0.6.1)
|
47
49
|
rack (>= 1.0)
|
48
50
|
redis (2.2.2)
|
49
51
|
redis-namespace (1.0.3)
|
50
52
|
redis (< 3.0.0)
|
51
|
-
resque (1.
|
53
|
+
resque (1.20.0)
|
52
54
|
multi_json (~> 1.0)
|
53
55
|
redis-namespace (~> 1.0.2)
|
54
56
|
sinatra (>= 0.9.2)
|
55
57
|
vegas (~> 0.1.2)
|
56
|
-
resque_spec (0.
|
57
|
-
resque (>= 1.
|
58
|
+
resque_spec (0.12.1)
|
59
|
+
resque (>= 1.19.0)
|
58
60
|
rspec (>= 2.5.0)
|
59
|
-
rspec (2.
|
60
|
-
rspec-core (~> 2.
|
61
|
-
rspec-expectations (~> 2.
|
62
|
-
rspec-mocks (~> 2.
|
63
|
-
rspec-core (2.
|
64
|
-
rspec-expectations (2.
|
65
|
-
diff-lcs (~> 1.1.
|
66
|
-
rspec-mocks (2.
|
67
|
-
sinatra (1.2
|
68
|
-
rack (~> 1.1)
|
69
|
-
|
61
|
+
rspec (2.10.0)
|
62
|
+
rspec-core (~> 2.10.0)
|
63
|
+
rspec-expectations (~> 2.10.0)
|
64
|
+
rspec-mocks (~> 2.10.0)
|
65
|
+
rspec-core (2.10.1)
|
66
|
+
rspec-expectations (2.10.0)
|
67
|
+
diff-lcs (~> 1.1.3)
|
68
|
+
rspec-mocks (2.10.1)
|
69
|
+
sinatra (1.3.2)
|
70
|
+
rack (~> 1.3, >= 1.3.6)
|
71
|
+
rack-protection (~> 1.2)
|
72
|
+
tilt (~> 1.3, >= 1.3.3)
|
73
|
+
sprockets (2.1.3)
|
74
|
+
hike (~> 1.2)
|
75
|
+
rack (~> 1.0)
|
76
|
+
tilt (~> 1.1, != 1.3.0)
|
70
77
|
tilt (1.3.3)
|
71
78
|
treetop (1.4.10)
|
72
79
|
polyglot
|
73
80
|
polyglot (>= 0.3.1)
|
74
|
-
|
75
|
-
vegas (0.1.8)
|
81
|
+
vegas (0.1.11)
|
76
82
|
rack (>= 1.0.0)
|
77
83
|
|
78
84
|
PLATFORMS
|
@@ -80,4 +86,4 @@ PLATFORMS
|
|
80
86
|
|
81
87
|
DEPENDENCIES
|
82
88
|
resque_mail_queue!
|
83
|
-
resque_spec
|
89
|
+
resque_spec
|
data/lib/resque_mail_queue.rb
CHANGED
@@ -3,8 +3,8 @@ require 'action_mailer'
|
|
3
3
|
|
4
4
|
module Resque
|
5
5
|
module MailQueue
|
6
|
-
|
7
|
-
include Resque::Helpers
|
6
|
+
|
7
|
+
include Resque::Helpers
|
8
8
|
extend self
|
9
9
|
|
10
10
|
def queue
|
@@ -17,20 +17,30 @@ module Resque
|
|
17
17
|
mailer.send(method, *options['args']).deliver
|
18
18
|
end
|
19
19
|
|
20
|
-
def enqueue
|
20
|
+
def enqueue
|
21
21
|
EnqueueProxy.new(self)
|
22
22
|
end
|
23
23
|
|
24
|
+
def enqueue_to(queue)
|
25
|
+
EnqueueProxy.new(self, queue)
|
26
|
+
end
|
27
|
+
|
24
28
|
class EnqueueProxy
|
25
29
|
|
26
|
-
def initialize(klass)
|
30
|
+
def initialize(klass, queue = nil)
|
27
31
|
@klass = klass
|
32
|
+
@queue = queue
|
28
33
|
end
|
29
34
|
|
30
|
-
def method_missing(
|
31
|
-
if @klass.respond_to?
|
32
|
-
options = {'klass' => @klass.to_s, 'method' =>
|
33
|
-
|
35
|
+
def method_missing(method, *args, &block)
|
36
|
+
if @klass.respond_to? method
|
37
|
+
options = {'klass' => @klass.to_s, 'method' => method, 'args' => args}
|
38
|
+
|
39
|
+
if @queue
|
40
|
+
Resque.enqueue_to(@queue, @klass, options)
|
41
|
+
else
|
42
|
+
Resque.enqueue(@klass, options)
|
43
|
+
end
|
34
44
|
else
|
35
45
|
super
|
36
46
|
end
|
@@ -38,10 +48,10 @@ module Resque
|
|
38
48
|
|
39
49
|
end
|
40
50
|
|
41
|
-
VERSION = '0.
|
51
|
+
VERSION = '0.3.0'
|
42
52
|
end
|
43
53
|
end
|
44
54
|
|
45
55
|
class ActionMailer::Base
|
46
56
|
extend Resque::MailQueue
|
47
|
-
end
|
57
|
+
end
|
data/readme.md
CHANGED
@@ -29,7 +29,7 @@ Then anytime you want to push an email asynchronously add _enqueue_ before the m
|
|
29
29
|
|
30
30
|
## Why use this instead of ResqueMailer
|
31
31
|
|
32
|
-
I initially started using [ResqueMailer](https://github.com/zapnap/resque_mailer) and it worked well. However, I preferred being more explicit (and simple) on when emails
|
32
|
+
I initially started using [ResqueMailer](https://github.com/zapnap/resque_mailer) and it worked well. However, I preferred being more explicit (and simple) on when emails were sent asynchronously (by calling enqueue).
|
33
33
|
|
34
34
|
More clearly, if ResqueMailer works for you and you like it, stick with it.
|
35
35
|
|
data/resque_mail_queue.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_dependency 'actionmailer', '>= 3.
|
21
|
+
s.add_dependency 'actionmailer', '>= 3.1'
|
22
22
|
|
23
23
|
s.add_dependency 'resque', '>= 1.1.0'
|
24
|
-
s.add_development_dependency 'resque_spec'
|
24
|
+
s.add_development_dependency 'resque_spec'
|
25
25
|
|
26
26
|
end
|
@@ -8,34 +8,38 @@ class DumbMailer
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
class DumbMailer2 < DumbMailer
|
11
|
+
class DumbMailer2 < DumbMailer
|
12
12
|
def self.queue
|
13
13
|
:not_default
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
|
18
|
+
describe Resque::MailQueue do
|
19
|
+
|
20
|
+
before(:each) do
|
21
21
|
ResqueSpec.reset!
|
22
22
|
end
|
23
|
-
|
24
|
-
it 'should find a dummy mail in the default queue' do
|
23
|
+
|
24
|
+
it 'should find a dummy mail in the default queue' do
|
25
25
|
DumbMailer.enqueue.send_mail(3)
|
26
|
-
DumbMailer.should have_queued('klass' => 'DumbMailer', 'method' => :send_mail, 'args' => [3]).in(:
|
26
|
+
DumbMailer.should have_queued('klass' => 'DumbMailer', 'method' => :send_mail, 'args' => [3]).in(:mail)
|
27
27
|
end
|
28
|
-
|
29
|
-
it 'should be able to override the queue (not default)' do
|
28
|
+
|
29
|
+
it 'should be able to override the queue from the mailer class (not default)' do
|
30
30
|
DumbMailer2.enqueue.send_mail(3)
|
31
31
|
DumbMailer2.should have_queued('klass' => 'DumbMailer2', 'method'=> :send_mail, 'args' => [3]).in(:not_default)
|
32
|
+
end
|
32
33
|
|
34
|
+
it 'should be able to override the queue when enqueueing (also not default)' do
|
35
|
+
DumbMailer2.enqueue_to(:also_not_default).send_mail(3)
|
36
|
+
DumbMailer2.should have_queued('klass' => 'DumbMailer2', 'method'=> :send_mail, 'args' => [3]).in(:also_not_default)
|
33
37
|
end
|
34
38
|
|
35
|
-
it 'should call deliver when pulling an item from the queue' do
|
39
|
+
it 'should call deliver when pulling an item from the queue' do
|
36
40
|
mail_message = double('mail_message')
|
37
41
|
DumbMailer.stub(:send_mail).and_return(mail_message)
|
38
|
-
mail_message.should_receive(:deliver)
|
42
|
+
mail_message.should_receive(:deliver)
|
39
43
|
Resque::MailQueue.perform('klass' => 'DumbMailer', 'method' => :send_mail, 'args' => [3])
|
40
44
|
end
|
41
|
-
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_mail_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionmailer
|
16
|
-
requirement: &
|
16
|
+
requirement: &70213812346660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70213812346660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: resque
|
27
|
-
requirement: &
|
27
|
+
requirement: &70213812346160 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,18 +32,18 @@ dependencies:
|
|
32
32
|
version: 1.1.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70213812346160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: resque_spec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70213812345780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
43
|
+
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70213812345780
|
47
47
|
description: Simple asynchronous emails with Resque
|
48
48
|
email:
|
49
49
|
- scottwater@gmail.com
|
@@ -52,7 +52,6 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- .gitignore
|
55
|
-
- .rbenv-gemsets
|
56
55
|
- Gemfile
|
57
56
|
- Gemfile.lock
|
58
57
|
- Rakefile
|
@@ -80,9 +79,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
79
|
version: '0'
|
81
80
|
requirements: []
|
82
81
|
rubyforge_project: resque_mail_queue
|
83
|
-
rubygems_version: 1.8.
|
82
|
+
rubygems_version: 1.8.11
|
84
83
|
signing_key:
|
85
84
|
specification_version: 3
|
86
85
|
summary: Simple asynchronous emails with Resque
|
87
86
|
test_files:
|
88
87
|
- spec/resque_mail_queue_spec.rb
|
88
|
+
has_rdoc:
|
data/.rbenv-gemsets
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
resque_mail_queue global
|