Permalink
Browse files

Deletes trailing whitespaces (over text files only find * -type f -ex…

…ec sed 's/[ \t]*$//' -i {} \;)
  • Loading branch information...
1 parent 1590377 commit b451de0d6de4df6bc66b274cec73b919f823d5ae @spastorino spastorino committed Aug 14, 2010
Showing 337 changed files with 2,122 additions and 2,124 deletions.
View
@@ -34,7 +34,7 @@ link:files/vendor/rails/actionpack/README.html.
2. At the command prompt, create a new Rails application:
- rails new myapp
+ rails new myapp
where "myapp" is the application name.
@@ -48,7 +48,7 @@ link:files/vendor/rails/actionpack/README.html.
"Welcome aboard: You're riding Ruby on Rails!"
-5. Follow the guidelines to start developing your application. You can find
+5. Follow the guidelines to start developing your application. You can find
the following resources handy:
* The README file created within your application.
View
@@ -181,7 +181,7 @@
* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
-* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
+* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
* Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
@@ -327,7 +327,7 @@
* Added that deliver_* will now return the email that was sent
-* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
+* Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
@@ -366,7 +366,7 @@
@body = "Nothing to see here."
@charset = "iso-8859-1"
end
-
+
def unencoded_subject(recipient)
@recipients = recipient
@subject = "testing unencoded subject"
@@ -375,7 +375,7 @@
@encode_subject = false
@charset = "iso-8859-1"
end
-
+
*0.6.1* (January 18th, 2005)
View
@@ -5,7 +5,7 @@ are used to consolidate code for sending out forgotten passwords, welcome
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.
-Action Mailer is in essence a wrapper around Action Controller and the
+Action Mailer is in essence a wrapper around Action Controller and the
Mail gem. It provides a way to make emails using templates in the same
way that Action Controller renders views using templates.
@@ -23,7 +23,7 @@ This can be as simple as:
class Notifier < ActionMailer::Base
delivers_from 'system@loudthinking.com'
-
+
def welcome(recipient)
@recipient = recipient
mail(:to => recipient,
@@ -36,13 +36,13 @@ ERb) that has the instance variables that are declared in the mailer action.
So the corresponding body template for the method above could look like this:
- Hello there,
+ Hello there,
Mr. <%= @recipient %>
Thank you for signing up!
-
-And if the recipient was given as "david@loudthinking.com", the email
+
+And if the recipient was given as "david@loudthinking.com", the email
generated would look like this:
Date: Mon, 25 Jan 2010 22:48:09 +1100
@@ -55,7 +55,7 @@ generated would look like this:
charset="US-ASCII";
Content-Transfer-Encoding: 7bit
- Hello there,
+ Hello there,
Mr. david@loudthinking.com
@@ -75,7 +75,7 @@ Or you can just chain the methods together like:
== Receiving emails
To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes a
-tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
+tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called <tt>receive</tt>, that accepts a raw, unprocessed email as a string, which it then turns
into the tmail object and calls the receive instance method.
@@ -90,21 +90,21 @@ Example:
if email.has_attachments?
for attachment in email.attachments
- page.attachments.create({
+ page.attachments.create({
:file => attachment, :description => email.subject
})
end
end
end
end
-This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
+This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
trivial case like this:
rails runner 'Mailman.receive(STDIN.read)'
-However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
-instance of Rails should be run within a daemon if it is going to be utilized to process more than just
+However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
+instance of Rails should be run within a daemon if it is going to be utilized to process more than just
a limited number of email.
== Configuration
@@ -187,31 +187,31 @@ module ActionMailer #:nodoc:
# with the filename +free_book.pdf+.
#
# = Inline Attachments
- #
- # You can also specify that a file should be displayed inline with other HTML. This is useful
+ #
+ # You can also specify that a file should be displayed inline with other HTML. This is useful
# if you want to display a corporate logo or a photo.
- #
+ #
# class ApplicationMailer < ActionMailer::Base
# def welcome(recipient)
# attachments.inline['photo.png'] = File.read('path/to/photo.png')
# mail(:to => recipient, :subject => "Here is what we look like")
# end
# end
- #
+ #
# And then to reference the image in the view, you create a <tt>welcome.html.erb</tt> file and
- # make a call to +image_tag+ passing in the attachment you want to display and then call
+ # make a call to +image_tag+ passing in the attachment you want to display and then call
# +url+ on the attachment to get the relative content id path for the image source:
- #
+ #
# <h1>Please Don't Cringe</h1>
- #
+ #
# <%= image_tag attachments['photo.png'].url -%>
- #
+ #
# As we are using Action View's +image_tag+ method, you can pass in any other options you want:
- #
+ #
# <h1>Please Don't Cringe</h1>
- #
+ #
# <%= image_tag attachments['photo.png'].url, :alt => 'Our Photo', :class => 'photo' -%>
- #
+ #
# = Observing and Intercepting Mails
#
# Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to
@@ -46,11 +46,11 @@ module ClassMethods
# as alias and the default options supplied:
#
# Example:
- #
+ #
# add_delivery_method :sendmail, Mail::Sendmail,
# :location => '/usr/sbin/sendmail',
# :arguments => '-i -t'
- #
+ #
def add_delivery_method(symbol, klass, default_options={})
class_attribute(:"#{symbol}_settings") unless respond_to?(:"#{symbol}_settings")
send(:"#{symbol}_settings=", default_options)
@@ -15,11 +15,11 @@ def block_format(text)
:columns => 72, :first_indent => 2, :body_indent => 2, :text => paragraph
).format
}.join("\n")
-
+
# Make list points stand on their own line
formatted.gsub!(/[ ]*([*]+) ([^*]*)/) { |s| " #{$1} #{$2.strip}\n" }
formatted.gsub!(/[ ]*([#]+) ([^#]*)/) { |s| " #{$1} #{$2.strip}\n" }
-
+
formatted
end
@@ -116,36 +116,36 @@ def attachment(params, &block)
def normalize_nonfile_hash(params)
content_disposition = "attachment;"
-
+
mime_type = params.delete(:mime_type)
-
+
if content_type = params.delete(:content_type)
content_type = "#{mime_type || content_type};"
end
params[:body] = params.delete(:data) if params[:data]
-
+
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
-
+
def normalize_file_hash(params)
filename = File.basename(params.delete(:filename))
content_disposition = "attachment; filename=\"#{File.basename(filename)}\""
-
+
mime_type = params.delete(:mime_type)
-
+
if (content_type = params.delete(:content_type)) && (content_type !~ /filename=/)
content_type = "#{mime_type || content_type}; filename=\"#{filename}\""
end
-
+
params[:body] = params.delete(:data) if params[:data]
-
+
{ :content_type => content_type,
:content_disposition => content_disposition }.merge(params)
end
- def create_mail
+ def create_mail
m = @_message
set_fields!({:subject => subject, :to => recipients, :from => from,
@@ -178,14 +178,14 @@ def create_mail
wrap_delivery_behavior!
m.content_transfer_encoding = '8bit' unless m.body.only_us_ascii?
-
+
@_message
end
-
+
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.
- def initialize_defaults(method_name)
+ def initialize_defaults(method_name)
@charset ||= self.class.default[:charset].try(:dup)
@content_type ||= self.class.default[:content_type].try(:dup)
@implicit_parts_order ||= self.class.default[:parts_order].try(:dup)
@@ -201,7 +201,7 @@ def initialize_defaults(method_name)
@body ||= {}
end
- def create_parts
+ def create_parts
if String === @body
@parts.unshift create_inline_part(@body)
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
@@ -220,7 +220,7 @@ def create_parts
end
end
- def create_inline_part(body, mime_type=nil)
+ def create_inline_part(body, mime_type=nil)
ct = mime_type || "text/plain"
main_type, sub_type = split_content_type(ct.to_s)
@@ -242,11 +242,11 @@ def set_fields!(headers, charset) #:nodoc:
m.reply_to ||= headers.delete(:reply_to) if headers[:reply_to]
end
- def split_content_type(ct)
+ def split_content_type(ct)
ct.to_s.split("/")
end
- def parse_content_type(defaults=nil)
+ def parse_content_type(defaults=nil)
if @content_type.blank?
[ nil, {} ]
else
@@ -1,12 +1,12 @@
module Mail
class Message
-
+
def set_content_type(*args)
ActiveSupport::Deprecation.warn('Message#set_content_type is deprecated, please just call ' <<
'Message#content_type with the same arguments', caller[0,2])
content_type(*args)
end
-
+
alias :old_transfer_encoding :transfer_encoding
def transfer_encoding(value = nil)
if value
@@ -29,6 +29,6 @@ def original_filename
'please call Message#filename', caller[0,2])
filename
end
-
+
end
end
@@ -148,7 +148,7 @@ def teardown
assert_equal("application/pdf", email.parts[1].mime_type)
assert_equal("VGhpcyBpcyB0ZXN0IEZpbGUgY29udGVudA==\r\n", email.parts[1].body.encoded)
end
-
+
test "can embed an inline attachment" do
email = BaseMailer.inline_attachment
# Need to call #encoded to force the JIT sort on parts
@@ -413,7 +413,7 @@ def teardown
BaseMailer.welcome.deliver
assert_equal(1, BaseMailer.deliveries.length)
end
-
+
test "calling deliver, ActionMailer should yield back to mail to let it call :do_delivery on itself" do
mail = Mail::Message.new
mail.expects(:do_delivery).once
@@ -447,7 +447,7 @@ def teardown
mail = BaseMailer.welcome_from_another_path(['unknown/invalid', 'another.path/base_mailer']).deliver
assert_equal("Welcome from another path", mail.body.encoded)
end
-
+
test "assets tags should use ActionMailer's asset_host settings" do
ActionMailer::Base.config.asset_host = "http://global.com"
ActionMailer::Base.config.assets_dir = "global/"
@@ -456,7 +456,7 @@ def teardown
assert_equal(%{<img alt="Dummy" src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip)
end
-
+
test "assets tags should use a Mailer's asset_host settings when available" do
ActionMailer::Base.config.asset_host = "global.com"
ActionMailer::Base.config.assets_dir = "global/"
@@ -469,12 +469,12 @@ def teardown
end
# Before and After hooks
-
+
class MyObserver
def self.delivered_email(mail)
end
end
-
+
test "you can register an observer to the mail object that gets informed on email delivery" do
ActionMailer::Base.register_observer(MyObserver)
mail = BaseMailer.welcome
@@ -493,15 +493,15 @@ def self.delivering_email(mail)
MyInterceptor.expects(:delivering_email).with(mail)
mail.deliver
end
-
+
test "being able to put proc's into the defaults hash and they get evaluated on mail sending" do
mail1 = ProcMailer.welcome
yesterday = 1.day.ago
Time.stubs(:now).returns(yesterday)
mail2 = ProcMailer.welcome
assert(mail1['X-Proc-Method'].to_s.to_i > mail2['X-Proc-Method'].to_s.to_i)
end
-
+
test "we can call other defined methods on the class as needed" do
mail = ProcMailer.welcome
assert_equal("Thanks for signing up this afternoon", mail.subject)
Oops, something went wrong.

0 comments on commit b451de0

Please sign in to comment.