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 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.3
1
+ 0.9.4
@@ -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 = app.views
23
+ Padrino::Mailer::Base::views_path << app.views
24
24
  end
25
25
  end # Mailer
26
26
  end # Padrino
@@ -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, :type, :charset, :via, :attachments]
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
- @mail_attributes[:body] = Tilt.new(template_path).render(self, body_value.symbolize_keys) if body_value.is_a?(Hash)
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
- Dir[File.join(self.views_path, self.class.name.underscore.split("/").last, "#{@mail_name}.*")].first
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
 
@@ -28,7 +28,6 @@ module Padrino
28
28
  end
29
29
 
30
30
  def build_tmail(options)
31
- logger.error options.inspect
32
31
  mail = TMail::Mail.new
33
32
  mail.to = options[:to]
34
33
  mail.cc = options[:cc] || ''
@@ -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.3"
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-01}
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.5}
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.3"])
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.3"])
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.3"])
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"])
@@ -31,7 +31,7 @@ class MailerDemo < Sinatra::Base
31
31
  to 'julie@fake.com'
32
32
  from 'noreply@anniversary.com'
33
33
  body 'names' => names, 'years_married' => years_married
34
- type 'html'
34
+ content_type 'text/html'
35
35
  end
36
36
  end
37
37
 
@@ -10,9 +10,9 @@ class DemoMailer < Padrino::Mailer::Base
10
10
  body "Hello world!"
11
11
  via :sendmail
12
12
  end
13
-
13
+
14
14
  def sample_mail_smtp
15
- from 'test@default.com'
15
+ from 'test@default.com'
16
16
  to 'test@test.com'
17
17
  body "SMTP Hello world!"
18
18
  end
@@ -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', :type => 'html', :via => :smtp,
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
- version: 0.9.3
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-01 00:00:00 +01:00
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
- type: :runtime
21
- version_requirement:
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
- version: 0.9.3
27
- version:
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: tmail
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
- version_requirement:
32
- version_requirements: !ruby/object:Gem::Requirement
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
- version:
61
+ type: :runtime
62
+ version_requirements: *id003
38
63
  - !ruby/object:Gem::Dependency
39
64
  name: shoulda
40
- type: :development
41
- version_requirement:
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
- version:
75
+ type: :development
76
+ version_requirements: *id004
48
77
  - !ruby/object:Gem::Dependency
49
78
  name: haml
50
- type: :development
51
- version_requirement:
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
- version:
89
+ type: :development
90
+ version_requirements: *id005
58
91
  - !ruby/object:Gem::Dependency
59
92
  name: mocha
60
- type: :development
61
- version_requirement:
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
- version:
103
+ type: :development
104
+ version_requirements: *id006
68
105
  - !ruby/object:Gem::Dependency
69
106
  name: rack-test
70
- type: :development
71
- version_requirement:
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
- version:
117
+ type: :development
118
+ version_requirements: *id007
78
119
  - !ruby/object:Gem::Dependency
79
120
  name: webrat
80
- type: :development
81
- version_requirement:
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
- version:
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.5
187
+ rubygems_version: 1.3.6
141
188
  signing_key:
142
189
  specification_version: 3
143
190
  summary: Mailer system for padrino