action_mailer_verp 0.2.1 → 0.3.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/Rakefile CHANGED
@@ -11,7 +11,7 @@ begin
11
11
  gem.homepage = "http://github.com/jamesgolick/action_mailer_verp"
12
12
  gem.authors = ["James Golick"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_dependency "actionmailer", "~> 2.3.1"
14
+ gem.add_dependency "actionmailer", "~> 3.0.5"
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -1,49 +1,47 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{action_mailer_verp}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Golick"]
12
- s.date = %q{2010-10-04}
12
+ s.date = %q{2011-03-21}
13
13
  s.description = %q{Send VERP emails with actionmailer.}
14
14
  s.email = %q{jamesgolick@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "action_mailer_verp.gemspec",
27
- "lib/action_mailer_verp.rb",
28
- "lib/action_mailer_verp/bounce_processor.rb",
29
- "lib/action_mailer_verp/pop_fetcher.rb",
30
- "spec/action_mailer_verp_spec.rb",
31
- "spec/bounce_processor_spec.rb",
32
- "spec/spec.opts",
33
- "spec/spec_helper.rb",
34
- "spec/templates/my_mailer/multiple_froms.erb",
35
- "spec/templates/my_mailer/multiple_recipients.erb",
36
- "spec/templates/my_mailer/some_mail.erb"
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "action_mailer_verp.gemspec",
26
+ "lib/action_mailer_verp.rb",
27
+ "lib/action_mailer_verp/bounce_processor.rb",
28
+ "lib/action_mailer_verp/pop_fetcher.rb",
29
+ "spec/action_mailer_verp_spec.rb",
30
+ "spec/bounce_processor_spec.rb",
31
+ "spec/spec.opts",
32
+ "spec/spec_helper.rb",
33
+ "spec/templates/my_mailer/multiple_froms.erb",
34
+ "spec/templates/my_mailer/multiple_recipients.erb",
35
+ "spec/templates/my_mailer/some_mail.erb"
37
36
  ]
38
37
  s.homepage = %q{http://github.com/jamesgolick/action_mailer_verp}
39
- s.rdoc_options = ["--charset=UTF-8"]
40
38
  s.require_paths = ["lib"]
41
39
  s.rubygems_version = %q{1.3.7}
42
40
  s.summary = %q{Send VERP emails with actionmailer.}
43
41
  s.test_files = [
44
42
  "spec/action_mailer_verp_spec.rb",
45
- "spec/bounce_processor_spec.rb",
46
- "spec/spec_helper.rb"
43
+ "spec/bounce_processor_spec.rb",
44
+ "spec/spec_helper.rb"
47
45
  ]
48
46
 
49
47
  if s.respond_to? :specification_version then
@@ -52,14 +50,14 @@ Gem::Specification.new do |s|
52
50
 
53
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
52
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
55
- s.add_runtime_dependency(%q<actionmailer>, ["~> 2.3.1"])
53
+ s.add_runtime_dependency(%q<actionmailer>, ["~> 3.0.5"])
56
54
  else
57
55
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
58
- s.add_dependency(%q<actionmailer>, ["~> 2.3.1"])
56
+ s.add_dependency(%q<actionmailer>, ["~> 3.0.5"])
59
57
  end
60
58
  else
61
59
  s.add_dependency(%q<rspec>, [">= 1.2.9"])
62
- s.add_dependency(%q<actionmailer>, ["~> 2.3.1"])
60
+ s.add_dependency(%q<actionmailer>, ["~> 3.0.5"])
63
61
  end
64
62
  end
65
63
 
@@ -1,4 +1,4 @@
1
- require 'actionmailer'
1
+ require 'action_mailer'
2
2
  require 'action_mailer_verp/bounce_processor'
3
3
  require 'action_mailer_verp/pop_fetcher'
4
4
 
@@ -7,14 +7,10 @@ module ActionMailerVerp
7
7
  class MultipleFromsError < ArgumentError; end
8
8
  class MultipleRecipientsError < ArgumentError; end
9
9
 
10
- def self.included(klass)
11
- klass.send(:alias_method_chain, :create_mail, :verp)
12
- end
13
-
14
- def create_mail_with_verp
15
- create_mail_without_verp
16
- verpify(@mail)
17
- @mail
10
+ def mail(*args, &block)
11
+ m = super
12
+ verpify(m)
13
+ m
18
14
  end
19
15
 
20
16
  private
@@ -27,9 +23,11 @@ module ActionMailerVerp
27
23
  raise MultipleRecipientsError, "Multiple recipients not supported."
28
24
  end
29
25
 
30
- from = mail.from_addrs.first
31
- local = "#{from.local}+#{mail.to.first.gsub("@", "=")}"
32
- return_path = "#{local}@#{from.domain}"
26
+ from_parts = mail.from_addrs.first.split(/@/)
27
+ from_local = from_parts.first
28
+ from_domain = from_parts.last
29
+ local = "#{from_local}+#{mail.to.first.gsub("@", "=")}"
30
+ return_path = "#{local}@#{from_domain}"
33
31
  mail['return-path'] = return_path
34
32
  end
35
33
  end
@@ -3,44 +3,44 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "ActionMailerVerp" do
4
4
  class MyMailer < ActionMailer::Base
5
5
  include ActionMailerVerp::VERPMail
6
- self.template_root = File.dirname(__FILE__) + "/templates"
6
+ prepend_view_path File.dirname(__FILE__) + "/templates"
7
7
 
8
8
  def some_mail(address)
9
- from "MyCompany <donotreply@mycompany.com>"
10
- recipients address
11
- subject "An exciting new email from MyCompany"
9
+ mail :from => "MyCompany <donotreply@mycompany.com>",
10
+ :to => address,
11
+ :subject => "An exciting new email from MyCompany"
12
12
  end
13
13
 
14
14
  def multiple_froms
15
- from ["MyCompany <donotreply@mycompany.com>", "AnotherFrom <asdf@bsdf.com>"]
16
- recipients "asdf@bsdf.com"
17
- subject "An exciting new email from MyCompany"
15
+ mail :from => ["MyCompany <donotreply@mycompany.com>", "AnotherFrom <asdf@bsdf.com>"],
16
+ :to => "asdf@bsdf.com",
17
+ :subject => "An exciting new email from MyCompany"
18
18
  end
19
19
 
20
20
  def multiple_recipients
21
- from "MyCompany <donotreply@mycompany.com>"
22
- recipients ["asdf@bsdf.com", "bsdf@csdf.com"]
23
- subject "An exciting new email from MyCompany"
21
+ mail :from => "MyCompany <donotreply@mycompany.com>",
22
+ :to => ["asdf@bsdf.com", "bsdf@csdf.com"],
23
+ :subject => "An exciting new email from MyCompany"
24
24
  end
25
25
  end
26
26
 
27
27
  describe "ActionMailerVerp::VERPMail" do
28
28
  describe "with one from address" do
29
29
  before do
30
- @mail = MyMailer.create_some_mail("james@example.com")
30
+ @mail = MyMailer.some_mail("james@example.com")
31
31
  end
32
32
 
33
33
  it "sets the return-path to the VERP address" do
34
- addr = @mail['return-path'].addr
35
- addr.local.should == "donotreply+james=example.com"
36
- addr.domain.should == "mycompany.com"
34
+ addr = @mail['return-path'].value.split(/@/)
35
+ addr.first.should == "donotreply+james=example.com"
36
+ addr.last.should == "mycompany.com"
37
37
  end
38
38
  end
39
-
39
+
40
40
  describe "with multiple from addresses" do
41
41
  it "raises an error because that is not supported" do
42
42
  lambda {
43
- MyMailer.create_multiple_froms
43
+ MyMailer.multiple_froms
44
44
  }.should raise_error(ActionMailerVerp::VERPMail::MultipleFromsError)
45
45
  end
46
46
  end
@@ -48,7 +48,7 @@ describe "ActionMailerVerp" do
48
48
  describe "with multiple recipients" do
49
49
  it "raises an error because that is not supported" do
50
50
  lambda {
51
- MyMailer.create_multiple_recipients
51
+ MyMailer.multiple_recipients
52
52
  }.should raise_error(ActionMailerVerp::VERPMail::MultipleRecipientsError)
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_mailer_verp
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - James Golick
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-04 00:00:00 -07:00
18
+ date: 2011-03-21 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 13
28
30
  segments:
29
31
  - 1
30
32
  - 2
@@ -40,11 +42,12 @@ dependencies:
40
42
  requirements:
41
43
  - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 13
43
46
  segments:
44
- - 2
45
47
  - 3
46
- - 1
47
- version: 2.3.1
48
+ - 0
49
+ - 5
50
+ version: 3.0.5
48
51
  type: :runtime
49
52
  version_requirements: *id002
50
53
  description: Send VERP emails with actionmailer.
@@ -58,7 +61,6 @@ extra_rdoc_files:
58
61
  - README.rdoc
59
62
  files:
60
63
  - .document
61
- - .gitignore
62
64
  - LICENSE
63
65
  - README.rdoc
64
66
  - Rakefile
@@ -79,8 +81,8 @@ homepage: http://github.com/jamesgolick/action_mailer_verp
79
81
  licenses: []
80
82
 
81
83
  post_install_message:
82
- rdoc_options:
83
- - --charset=UTF-8
84
+ rdoc_options: []
85
+
84
86
  require_paths:
85
87
  - lib
86
88
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -88,6 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
90
  requirements:
89
91
  - - ">="
90
92
  - !ruby/object:Gem::Version
93
+ hash: 3
91
94
  segments:
92
95
  - 0
93
96
  version: "0"
@@ -96,6 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
99
  requirements:
97
100
  - - ">="
98
101
  - !ruby/object:Gem::Version
102
+ hash: 3
99
103
  segments:
100
104
  - 0
101
105
  version: "0"
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC