actionmailer 3.0.0.beta4 → 3.0.0.rc

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionmailer might be problematic. Click here for more details.

data/CHANGELOG CHANGED
@@ -1,5 +1,12 @@
1
+ *Rails 3.0.0 [release candidate] (July 26th, 2010)*
2
+
3
+ * No material changes
4
+
5
+
1
6
  *Rails 3.0.0 [beta 4] (June 8th, 2010)*
2
7
 
8
+ * subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(".subject") [JK]
9
+
3
10
  * Changed encoding behaviour of mail, so updated tests in actionmailer and bumped mail version to 2.2.1 [ML]
4
11
 
5
12
  * Added ability to pass Proc objects to the defaults hash [ML]
@@ -119,36 +119,16 @@ The Base class has the full list of configuration options. Here's an example:
119
119
  :authentication => :plain # :plain, :login or :cram_md5
120
120
  }
121
121
 
122
- == Dependencies
123
122
 
124
- Action Mailer requires that the Action Pack is either available to be required immediately
125
- or is accessible as a GEM.
123
+ == Download and installation
126
124
 
127
- Additionally, Action Mailer requires the Mail gem, http://github.com/mikel/mail
125
+ The latest version of Action Mailer can be installed with Rubygems:
128
126
 
129
- == Bundled software
127
+ % [sudo] gem install actionmailer
130
128
 
131
- * Text::Format 0.63 by Austin Ziegler released under OpenSource
132
- Read more on http://www.halostatue.ca/ruby/Text__Format.html
129
+ Source code can be downloaded as part of the Rails project on GitHub
133
130
 
134
- == Download
135
-
136
- The latest version of Action Mailer can be found at
137
-
138
- * http://rubyforge.org/project/showfiles.php?group_id=361
139
-
140
- Documentation can be found at
141
-
142
- * http://actionmailer.rubyonrails.org
143
-
144
-
145
- == Installation
146
-
147
- You can install Action Mailer with the following command.
148
-
149
- % [sudo] ruby install.rb
150
-
151
- from its distribution directory.
131
+ * http://github.com/rails/rails/tree/master/actionmailer/
152
132
 
153
133
 
154
134
  == License
@@ -158,10 +138,10 @@ Action Mailer is released under the MIT license.
158
138
 
159
139
  == Support
160
140
 
161
- The Action Mailer homepage is http://www.rubyonrails.org. You can find
162
- the Action Mailer RubyForge page at http://rubyforge.org/projects/actionmailer.
163
- And as Jim from Rake says:
141
+ API documentation is at
142
+
143
+ * http://api.rubyonrails.com
144
+
145
+ Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
164
146
 
165
- Feel free to submit commits or feature requests. If you send a patch,
166
- remember to update the corresponding unit tests. If fact, I prefer
167
- new feature to be submitted in the form of new unit tests.
147
+ * https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
@@ -4,6 +4,7 @@ require 'action_mailer/collector'
4
4
  require 'active_support/core_ext/array/wrap'
5
5
  require 'active_support/core_ext/object/blank'
6
6
  require 'active_support/core_ext/proc'
7
+ require 'action_mailer/log_subscriber'
7
8
 
8
9
  module ActionMailer #:nodoc:
9
10
  # Action Mailer allows you to send email from your application using a mailer model and views.
@@ -60,21 +61,21 @@ module ActionMailer #:nodoc:
60
61
  #
61
62
  # If you want to explicitly render only certain templates, pass a block:
62
63
  #
63
- # mail(:to => user.emai) do |format|
64
+ # mail(:to => user.email) do |format|
64
65
  # format.text
65
66
  # format.html
66
67
  # end
67
68
  #
68
69
  # The block syntax is useful if also need to specify information specific to a part:
69
70
  #
70
- # mail(:to => user.emai) do |format|
71
+ # mail(:to => user.email) do |format|
71
72
  # format.text(:content_transfer_encoding => "base64")
72
73
  # format.html
73
74
  # end
74
75
  #
75
76
  # Or even to render a special view:
76
77
  #
77
- # mail(:to => user.emai) do |format|
78
+ # mail(:to => user.email) do |format|
78
79
  # format.text
79
80
  # format.html { render "some_other_template" }
80
81
  # end
@@ -124,14 +125,13 @@ module ActionMailer #:nodoc:
124
125
  # make sense to generate relative URLs in email messages.
125
126
  #
126
127
  # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt>
127
- # option in the <tt>ActionMailer::Base.default_url_options</tt> hash as follows:
128
- #
129
- # ActionMailer::Base.default_url_options[:host] = "example.com"
130
- #
131
- # This can also be set as a configuration option in <tt>config/environment.rb</tt>:
128
+ # option as a configuration option in <tt>config/application.rb</tt>:
132
129
  #
133
130
  # config.action_mailer.default_url_options = { :host => "example.com" }
134
131
  #
132
+ # Setting <tt>ActionMailer::Base.default_url_options</tt> directly is now deprecated, use the configuration
133
+ # option mentioned above to set the default host.
134
+ #
135
135
  # If you do decide to set a default <tt>:host</tt> for your mailers you will want to use the
136
136
  # <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are
137
137
  # generated because the <tt>url_for</tt> view helper will, by default, generate relative URLs when a
@@ -182,7 +182,7 @@ module ActionMailer #:nodoc:
182
182
  # end
183
183
  #
184
184
  # Which will (if it had both a <tt>welcome.text.plain.erb</tt> and <tt>welcome.text.html.erb</tt>
185
- # tempalte in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
185
+ # template in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
186
186
  # the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside,
187
187
  # and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
188
188
  # with the filename +free_book.pdf+.
@@ -209,7 +209,7 @@ module ActionMailer #:nodoc:
209
209
  #
210
210
  # <%= image_tag attachments['photo.png'].url -%>
211
211
  #
212
- # As we are using ActionView's +image_tag+ method, you can pass in any other options you want:
212
+ # As we are using Action View's +image_tag+ method, you can pass in any other options you want:
213
213
  #
214
214
  # <h1>Please Don't Cringe</h1>
215
215
  #
@@ -395,7 +395,7 @@ module ActionMailer #:nodoc:
395
395
  end
396
396
 
397
397
  # Wraps an email delivery inside of Active Support Notifications instrumentation. This
398
- # method is actually called by the <tt>Mail::Message</tt> object itself through a call back
398
+ # method is actually called by the <tt>Mail::Message</tt> object itself through a callback
399
399
  # when you call <tt>:deliver</tt> on the Mail::Message, calling +deliver_mail+ directly
400
400
  # and passing a Mail::Message will do nothing except tell the logger you sent the email.
401
401
  def deliver_mail(mail) #:nodoc:
@@ -534,7 +534,9 @@ module ActionMailer #:nodoc:
534
534
  # :reply_to => 'bounces@test.lindsaar.net'
535
535
  # end
536
536
  #
537
- # If you need other headers not listed above, use the <tt>headers['name'] = value</tt> method.
537
+ # If you need other headers not listed above, you can either pass them in
538
+ # as part of the headers hash or use the <tt>headers['name'] = value</tt>
539
+ # method.
538
540
  #
539
541
  # When a <tt>:return_path</tt> is specified as header, that value will be used as the 'envelope from'
540
542
  # address for the Mail message. Setting this is useful when you want delivery notifications
@@ -657,7 +659,7 @@ module ActionMailer #:nodoc:
657
659
 
658
660
  def default_i18n_subject #:nodoc:
659
661
  mailer_scope = self.class.mailer_name.gsub('/', '.')
660
- I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize)
662
+ I18n.t(:subject, :scope => [mailer_scope, action_name], :default => action_name.humanize)
661
663
  end
662
664
 
663
665
  def collect_responses_and_parts_order(headers) #:nodoc:
@@ -734,13 +736,13 @@ module ActionMailer #:nodoc:
734
736
  raise "You can no longer call ActionMailer::Base.default_url_options " \
735
737
  "directly. You need to set config.action_mailer.default_url_options. " \
736
738
  "If you are using ActionMailer standalone, you need to include the " \
737
- "url_helpers of a router directly."
739
+ "routing url_helpers directly."
738
740
  end
739
741
  end
740
742
 
741
743
  # This module will complain if the user tries to set default_url_options
742
- # directly instead of through the config object. In ActionMailer's Railtie,
743
- # we include the url_helpers of the router, which will override this module
744
+ # directly instead of through the config object. In Action Mailer's Railtie,
745
+ # we include the router's url_helpers, which will override this module.
744
746
  extend DeprecatedUrlOptions
745
747
 
746
748
  ActiveSupport.run_load_hooks(:action_mailer, self)
@@ -1,7 +1,7 @@
1
1
  module ActionMailer
2
2
  # This is the API which is deprecated and is going to be removed on Rails 3.1 release.
3
3
  # Part of the old API will be deprecated after 3.1, for a smoother deprecation process.
4
- # Chech those in OldApi instead.
4
+ # Check those in OldApi instead.
5
5
  module DeprecatedApi #:nodoc:
6
6
  extend ActiveSupport::Concern
7
7
 
@@ -0,0 +1,22 @@
1
+ require 'active_support/core_ext/array/wrap'
2
+
3
+ module ActionMailer
4
+ class LogSubscriber < ActiveSupport::LogSubscriber
5
+ def deliver(event)
6
+ recipients = Array.wrap(event.payload[:to]).join(', ')
7
+ info("\nSent mail to #{recipients} (%1.fms)" % event.duration)
8
+ debug(event.payload[:mail])
9
+ end
10
+
11
+ def receive(event)
12
+ info("\nReceived mail (%.1fms)" % event.duration)
13
+ debug(event.payload[:mail])
14
+ end
15
+
16
+ def logger
17
+ ActionMailer::Base.logger
18
+ end
19
+ end
20
+ end
21
+
22
+ ActionMailer::LogSubscriber.attach_to :action_mailer
@@ -5,29 +5,21 @@ module ActionMailer
5
5
  class Railtie < Rails::Railtie
6
6
  config.action_mailer = ActiveSupport::OrderedOptions.new
7
7
 
8
- require "action_mailer/railties/log_subscriber"
9
- log_subscriber :action_mailer, ActionMailer::Railties::LogSubscriber.new
10
-
11
8
  initializer "action_mailer.logger" do
12
9
  ActiveSupport.on_load(:action_mailer) { self.logger ||= Rails.logger }
13
10
  end
14
11
 
15
12
  initializer "action_mailer.set_configs" do |app|
16
- paths = app.config.paths
17
- am = app.config.action_mailer
13
+ paths = app.config.paths
14
+ options = app.config.action_mailer
18
15
 
19
- am.assets_dir ||= paths.public.to_a.first
20
- am.javascripts_dir ||= paths.public.javascripts.to_a.first
21
- am.stylesheets_dir ||= paths.public.stylesheets.to_a.first
16
+ options.assets_dir ||= paths.public.to_a.first
17
+ options.javascripts_dir ||= paths.public.javascripts.to_a.first
18
+ options.stylesheets_dir ||= paths.public.stylesheets.to_a.first
22
19
 
23
20
  ActiveSupport.on_load(:action_mailer) do
24
- self.config.merge!(am)
25
-
26
21
  include app.routes.url_helpers
27
-
28
- app.config.action_mailer.each do |k,v|
29
- send "#{k}=", v
30
- end
22
+ options.each { |k,v| send("#{k}=", v) }
31
23
  end
32
24
  end
33
25
  end
@@ -8,55 +8,69 @@ module ActionMailer
8
8
  end
9
9
 
10
10
  class TestCase < ActiveSupport::TestCase
11
- include TestHelper
11
+ module Behavior
12
+ extend ActiveSupport::Concern
12
13
 
13
- setup :initialize_test_deliveries
14
- setup :set_expected_mail
14
+ include TestHelper
15
15
 
16
- class << self
17
- def tests(mailer)
18
- write_inheritable_attribute(:mailer_class, mailer)
19
- end
16
+ module ClassMethods
17
+ def tests(mailer)
18
+ write_inheritable_attribute(:mailer_class, mailer)
19
+ end
20
20
 
21
- def mailer_class
22
- if mailer = read_inheritable_attribute(:mailer_class)
23
- mailer
24
- else
25
- tests determine_default_mailer(name)
21
+ def mailer_class
22
+ if mailer = read_inheritable_attribute(:mailer_class)
23
+ mailer
24
+ else
25
+ tests determine_default_mailer(name)
26
+ end
26
27
  end
27
- end
28
28
 
29
- def determine_default_mailer(name)
30
- name.sub(/Test$/, '').constantize
31
- rescue NameError => e
32
- raise NonInferrableMailerError.new(name)
29
+ def determine_default_mailer(name)
30
+ name.sub(/Test$/, '').constantize
31
+ rescue NameError
32
+ raise NonInferrableMailerError.new(name)
33
+ end
33
34
  end
34
- end
35
35
 
36
- protected
37
- def initialize_test_deliveries
38
- ActionMailer::Base.delivery_method = :test
39
- ActionMailer::Base.perform_deliveries = true
40
- ActionMailer::Base.deliveries.clear
41
- end
36
+ module InstanceMethods
42
37
 
43
- def set_expected_mail
44
- @expected = Mail.new
45
- @expected.content_type ["text", "plain", { "charset" => charset }]
46
- @expected.mime_version = '1.0'
47
- end
38
+ protected
48
39
 
49
- private
50
- def charset
51
- "UTF-8"
52
- end
40
+ def initialize_test_deliveries
41
+ ActionMailer::Base.delivery_method = :test
42
+ ActionMailer::Base.perform_deliveries = true
43
+ ActionMailer::Base.deliveries.clear
44
+ end
45
+
46
+ def set_expected_mail
47
+ @expected = Mail.new
48
+ @expected.content_type ["text", "plain", { "charset" => charset }]
49
+ @expected.mime_version = '1.0'
50
+ end
51
+
52
+ private
53
+
54
+ def charset
55
+ "UTF-8"
56
+ end
57
+
58
+ def encode(subject)
59
+ Mail::Encodings.q_value_encode(subject, charset)
60
+ end
53
61
 
54
- def encode(subject)
55
- Mail::Encodings.q_value_encode(subject, charset)
62
+ def read_fixture(action)
63
+ IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
64
+ end
56
65
  end
57
66
 
58
- def read_fixture(action)
59
- IO.readlines(File.join(Rails.root, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
67
+ included do
68
+ setup :initialize_test_deliveries
69
+ setup :set_expected_mail
60
70
  end
71
+ end
72
+
73
+ include Behavior
74
+
61
75
  end
62
76
  end
@@ -1,5 +1,7 @@
1
1
  module ActionMailer
2
2
  module TestHelper
3
+ extend ActiveSupport::Concern
4
+
3
5
  # Asserts that the number of emails sent matches the given number.
4
6
  #
5
7
  # def test_emails
@@ -57,11 +59,3 @@ module ActionMailer
57
59
  end
58
60
  end
59
61
  end
60
-
61
- module Test
62
- module Unit
63
- class TestCase
64
- include ActionMailer::TestHelper
65
- end
66
- end
67
- end
@@ -3,7 +3,7 @@ module ActionMailer
3
3
  MAJOR = 3
4
4
  MINOR = 0
5
5
  TINY = 0
6
- BUILD = "beta4"
6
+ BUILD = "rc"
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
9
9
  end
@@ -5,7 +5,7 @@ class <%= class_name %> < ActionMailer::Base
5
5
  # Subject can be set in your I18n file at config/locales/en.yml
6
6
  # with the following lookup:
7
7
  #
8
- # en.actionmailer.<%= file_name %>.<%= action %>.subject
8
+ # en.<%= file_name %>.<%= action %>.subject
9
9
  #
10
10
  def <%= action %>
11
11
  @greeting = "Hi"
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailer
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 7712042
4
5
  prerelease: true
5
6
  segments:
6
7
  - 3
7
8
  - 0
8
9
  - 0
9
- - beta4
10
- version: 3.0.0.beta4
10
+ - rc
11
+ version: 3.0.0.rc
11
12
  platform: ruby
12
13
  authors:
13
14
  - David Heinemeier Hansson
@@ -15,36 +16,40 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-06-08 00:00:00 -04:00
19
+ date: 2010-07-26 00:00:00 -05:00
19
20
  default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: actionpack
23
24
  prerelease: false
24
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
25
27
  requirements:
26
28
  - - "="
27
29
  - !ruby/object:Gem::Version
30
+ hash: 7712042
28
31
  segments:
29
32
  - 3
30
33
  - 0
31
34
  - 0
32
- - beta4
33
- version: 3.0.0.beta4
35
+ - rc
36
+ version: 3.0.0.rc
34
37
  type: :runtime
35
38
  version_requirements: *id001
36
39
  - !ruby/object:Gem::Dependency
37
40
  name: mail
38
41
  prerelease: false
39
42
  requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
40
44
  requirements:
41
45
  - - ~>
42
46
  - !ruby/object:Gem::Version
47
+ hash: 13
43
48
  segments:
44
49
  - 2
45
50
  - 2
46
- - 3
47
- version: 2.2.3
51
+ - 5
52
+ version: 2.2.5
48
53
  type: :runtime
49
54
  version_requirements: *id002
50
55
  description: Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.
@@ -57,17 +62,17 @@ extra_rdoc_files: []
57
62
 
58
63
  files:
59
64
  - CHANGELOG
60
- - README
65
+ - README.rdoc
61
66
  - MIT-LICENSE
62
67
  - lib/action_mailer/adv_attr_accessor.rb
63
68
  - lib/action_mailer/base.rb
64
69
  - lib/action_mailer/collector.rb
65
70
  - lib/action_mailer/delivery_methods.rb
66
71
  - lib/action_mailer/deprecated_api.rb
72
+ - lib/action_mailer/log_subscriber.rb
67
73
  - lib/action_mailer/mail_helper.rb
68
74
  - lib/action_mailer/old_api.rb
69
75
  - lib/action_mailer/railtie.rb
70
- - lib/action_mailer/railties/log_subscriber.rb
71
76
  - lib/action_mailer/test_case.rb
72
77
  - lib/action_mailer/test_helper.rb
73
78
  - lib/action_mailer/tmail_compat.rb
@@ -86,18 +91,22 @@ rdoc_options: []
86
91
  require_paths:
87
92
  - lib
88
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
89
95
  requirements:
90
96
  - - ">="
91
97
  - !ruby/object:Gem::Version
98
+ hash: 57
92
99
  segments:
93
100
  - 1
94
101
  - 8
95
102
  - 7
96
103
  version: 1.8.7
97
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
98
106
  requirements:
99
107
  - - ">"
100
108
  - !ruby/object:Gem::Version
109
+ hash: 25
101
110
  segments:
102
111
  - 1
103
112
  - 3
@@ -106,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
115
  requirements:
107
116
  - none
108
117
  rubyforge_project: actionmailer
109
- rubygems_version: 1.3.6
118
+ rubygems_version: 1.3.7
110
119
  signing_key:
111
120
  specification_version: 3
112
121
  summary: Email composition, delivery, and receiving framework (part of Rails).
@@ -1,22 +0,0 @@
1
- require 'active_support/core_ext/array/wrap'
2
-
3
- module ActionMailer
4
- module Railties
5
- class LogSubscriber < Rails::LogSubscriber
6
- def deliver(event)
7
- recipients = Array.wrap(event.payload[:to]).join(', ')
8
- info("\nSent mail to #{recipients} (%1.fms)" % event.duration)
9
- debug(event.payload[:mail])
10
- end
11
-
12
- def receive(event)
13
- info("\nReceived mail (%.1fms)" % event.duration)
14
- debug(event.payload[:mail])
15
- end
16
-
17
- def logger
18
- ActionMailer::Base.logger
19
- end
20
- end
21
- end
22
- end