padrino-mailer 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/padrino-mailer.rb +1 -1
- data/lib/padrino-mailer/base.rb +9 -3
- data/lib/padrino-mailer/delivery.rb +0 -1
- data/padrino-mailer.gemspec +9 -6
- data/test/fixtures/mailer_app/app.rb +1 -1
- data/test/test_mailer_base.rb +2 -2
- data/test/test_padrino_mailer.rb +1 -1
- metadata +81 -34
data/Rakefile
CHANGED
@@ -15,6 +15,7 @@ begin
|
|
15
15
|
gem.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
16
16
|
gem.rubyforge_project = 'padrino-mailer'
|
17
17
|
gem.add_runtime_dependency "padrino-core", "= #{GEM_VERSION}"
|
18
|
+
gem.add_runtime_dependency "tilt", ">= 0.6"
|
18
19
|
gem.add_runtime_dependency "tmail", ">= 1.2"
|
19
20
|
gem.add_development_dependency "shoulda", ">= 2.10.3"
|
20
21
|
gem.add_development_dependency "haml", ">= 2.2.1"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
data/lib/padrino-mailer.rb
CHANGED
@@ -20,7 +20,7 @@ module Padrino
|
|
20
20
|
# Used Padrino::Application for register Padrino::Mailer::Base::views_path
|
21
21
|
#
|
22
22
|
def self.registered(app)
|
23
|
-
Padrino::Mailer::Base::views_path
|
23
|
+
Padrino::Mailer::Base::views_path << app.views
|
24
24
|
end
|
25
25
|
end # Mailer
|
26
26
|
end # Padrino
|
data/lib/padrino-mailer/base.rb
CHANGED
@@ -21,7 +21,7 @@ module Padrino
|
|
21
21
|
# Returns the available mail fields when composing a message
|
22
22
|
#
|
23
23
|
def self.mail_fields
|
24
|
-
[:to, :cc, :bcc, :reply_to, :from, :subject, :
|
24
|
+
[:to, :cc, :bcc, :reply_to, :from, :subject, :content_type, :charset, :via, :attachments]
|
25
25
|
end
|
26
26
|
|
27
27
|
attr_accessor :mail_attributes
|
@@ -42,7 +42,9 @@ module Padrino
|
|
42
42
|
# Assigns the body key to the mail attributes either with the rendered body from a template or the given string value
|
43
43
|
#
|
44
44
|
def body(body_value)
|
45
|
-
|
45
|
+
template = template_path
|
46
|
+
raise "Template for '#{@mail_name}' could not be located in views path!" unless template
|
47
|
+
@mail_attributes[:body] = Tilt.new(template).render(self, body_value.symbolize_keys) if body_value.is_a?(Hash)
|
46
48
|
@mail_attributes[:body] = body_value if body_value.is_a?(String)
|
47
49
|
end
|
48
50
|
|
@@ -50,9 +52,13 @@ module Padrino
|
|
50
52
|
# Returns the path to the email template searched for using glob pattern
|
51
53
|
#
|
52
54
|
def template_path
|
53
|
-
|
55
|
+
self.views_path.each do |path|
|
56
|
+
template = Dir[File.join(path, self.class.name.underscore.split("/").last, "#{@mail_name}.*")].first
|
57
|
+
return template if template
|
58
|
+
end
|
54
59
|
end
|
55
60
|
|
61
|
+
@@views_path = []
|
56
62
|
cattr_accessor :smtp_settings
|
57
63
|
cattr_accessor :views_path
|
58
64
|
|
data/padrino-mailer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-mailer}
|
8
|
-
s.version = "0.9.
|
8
|
+
s.version = "0.9.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-03}
|
13
13
|
s.description = %q{Mailer system for padrino allowing easy delivery of application emails}
|
14
14
|
s.email = %q{padrinorb@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.rdoc_options = ["--charset=UTF-8"]
|
41
41
|
s.require_paths = ["lib"]
|
42
42
|
s.rubyforge_project = %q{padrino-mailer}
|
43
|
-
s.rubygems_version = %q{1.3.
|
43
|
+
s.rubygems_version = %q{1.3.6}
|
44
44
|
s.summary = %q{Mailer system for padrino}
|
45
45
|
|
46
46
|
if s.respond_to? :specification_version then
|
@@ -48,7 +48,8 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.specification_version = 3
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.
|
51
|
+
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.4"])
|
52
|
+
s.add_runtime_dependency(%q<tilt>, [">= 0.6"])
|
52
53
|
s.add_runtime_dependency(%q<tmail>, [">= 1.2"])
|
53
54
|
s.add_development_dependency(%q<shoulda>, [">= 2.10.3"])
|
54
55
|
s.add_development_dependency(%q<haml>, [">= 2.2.1"])
|
@@ -56,7 +57,8 @@ Gem::Specification.new do |s|
|
|
56
57
|
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
57
58
|
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
58
59
|
else
|
59
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
60
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.4"])
|
61
|
+
s.add_dependency(%q<tilt>, [">= 0.6"])
|
60
62
|
s.add_dependency(%q<tmail>, [">= 1.2"])
|
61
63
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
62
64
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
@@ -65,7 +67,8 @@ Gem::Specification.new do |s|
|
|
65
67
|
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
66
68
|
end
|
67
69
|
else
|
68
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
70
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.4"])
|
71
|
+
s.add_dependency(%q<tilt>, [">= 0.6"])
|
69
72
|
s.add_dependency(%q<tmail>, [">= 1.2"])
|
70
73
|
s.add_dependency(%q<shoulda>, [">= 2.10.3"])
|
71
74
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
data/test/test_mailer_base.rb
CHANGED
data/test/test_padrino_mailer.rb
CHANGED
@@ -20,7 +20,7 @@ class TestPadrinoMailer < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
should 'be able to deliver html emails' do
|
23
|
-
assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com', :
|
23
|
+
assert_email_sent(:to => 'julie@fake.com', :from => 'noreply@anniversary.com', :content_type => 'text/html', :via => :smtp,
|
24
24
|
:subject => "Happy anniversary!", :body => "<p>Yay Joey & Charlotte!</p>\n<p>You have been married 16 years</p>")
|
25
25
|
visit '/deliver/html', :post
|
26
26
|
assert_equal 'mail delivered', last_response.body
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 9
|
8
|
+
- 4
|
9
|
+
version: 0.9.4
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Padrino Team
|
@@ -12,79 +17,119 @@ autorequire:
|
|
12
17
|
bindir: bin
|
13
18
|
cert_chain: []
|
14
19
|
|
15
|
-
date: 2010-03-
|
20
|
+
date: 2010-03-03 00:00:00 +01:00
|
16
21
|
default_executable:
|
17
22
|
dependencies:
|
18
23
|
- !ruby/object:Gem::Dependency
|
19
24
|
name: padrino-core
|
20
|
-
|
21
|
-
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
prerelease: false
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
27
|
requirements:
|
24
28
|
- - "="
|
25
29
|
- !ruby/object:Gem::Version
|
26
|
-
|
27
|
-
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 9
|
33
|
+
- 4
|
34
|
+
version: 0.9.4
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
28
37
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
38
|
+
name: tilt
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 6
|
47
|
+
version: "0.6"
|
30
48
|
type: :runtime
|
31
|
-
|
32
|
-
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: tmail
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
33
54
|
requirements:
|
34
55
|
- - ">="
|
35
56
|
- !ruby/object:Gem::Version
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 2
|
36
60
|
version: "1.2"
|
37
|
-
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
38
63
|
- !ruby/object:Gem::Dependency
|
39
64
|
name: shoulda
|
40
|
-
|
41
|
-
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
43
67
|
requirements:
|
44
68
|
- - ">="
|
45
69
|
- !ruby/object:Gem::Version
|
70
|
+
segments:
|
71
|
+
- 2
|
72
|
+
- 10
|
73
|
+
- 3
|
46
74
|
version: 2.10.3
|
47
|
-
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
48
77
|
- !ruby/object:Gem::Dependency
|
49
78
|
name: haml
|
50
|
-
|
51
|
-
|
52
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
53
81
|
requirements:
|
54
82
|
- - ">="
|
55
83
|
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 2
|
86
|
+
- 2
|
87
|
+
- 1
|
56
88
|
version: 2.2.1
|
57
|
-
|
89
|
+
type: :development
|
90
|
+
version_requirements: *id005
|
58
91
|
- !ruby/object:Gem::Dependency
|
59
92
|
name: mocha
|
60
|
-
|
61
|
-
|
62
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
prerelease: false
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
63
95
|
requirements:
|
64
96
|
- - ">="
|
65
97
|
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
100
|
+
- 9
|
101
|
+
- 7
|
66
102
|
version: 0.9.7
|
67
|
-
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id006
|
68
105
|
- !ruby/object:Gem::Dependency
|
69
106
|
name: rack-test
|
70
|
-
|
71
|
-
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
73
109
|
requirements:
|
74
110
|
- - ">="
|
75
111
|
- !ruby/object:Gem::Version
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
- 5
|
115
|
+
- 0
|
76
116
|
version: 0.5.0
|
77
|
-
|
117
|
+
type: :development
|
118
|
+
version_requirements: *id007
|
78
119
|
- !ruby/object:Gem::Dependency
|
79
120
|
name: webrat
|
80
|
-
|
81
|
-
|
82
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
prerelease: false
|
122
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
83
123
|
requirements:
|
84
124
|
- - ">="
|
85
125
|
- !ruby/object:Gem::Version
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
- 5
|
129
|
+
- 1
|
86
130
|
version: 0.5.1
|
87
|
-
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id008
|
88
133
|
description: Mailer system for padrino allowing easy delivery of application emails
|
89
134
|
email: padrinorb@gmail.com
|
90
135
|
executables: []
|
@@ -126,18 +171,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
171
|
requirements:
|
127
172
|
- - ">="
|
128
173
|
- !ruby/object:Gem::Version
|
174
|
+
segments:
|
175
|
+
- 0
|
129
176
|
version: "0"
|
130
|
-
version:
|
131
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
178
|
requirements:
|
133
179
|
- - ">="
|
134
180
|
- !ruby/object:Gem::Version
|
181
|
+
segments:
|
182
|
+
- 0
|
135
183
|
version: "0"
|
136
|
-
version:
|
137
184
|
requirements: []
|
138
185
|
|
139
186
|
rubyforge_project: padrino-mailer
|
140
|
-
rubygems_version: 1.3.
|
187
|
+
rubygems_version: 1.3.6
|
141
188
|
signing_key:
|
142
189
|
specification_version: 3
|
143
190
|
summary: Mailer system for padrino
|