Permalink
Browse files

Frozen rails

  • Loading branch information...
1 parent dde2065 commit c2d583937680f8d58b26b629af501415ae5b2efd @labria committed Feb 23, 2008
Showing with 24,196 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +3 −0 Capfile
  3. +325 −0 vendor/rails/actionmailer/CHANGELOG
  4. +21 −0 vendor/rails/actionmailer/MIT-LICENSE
  5. +145 −0 vendor/rails/actionmailer/README
  6. +96 −0 vendor/rails/actionmailer/Rakefile
  7. +30 −0 vendor/rails/actionmailer/install.rb
  8. +52 −0 vendor/rails/actionmailer/lib/action_mailer.rb
  9. +30 −0 vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
  10. +603 −0 vendor/rails/actionmailer/lib/action_mailer/base.rb
  11. +111 −0 vendor/rails/actionmailer/lib/action_mailer/helpers.rb
  12. +19 −0 vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
  13. +110 −0 vendor/rails/actionmailer/lib/action_mailer/part.rb
  14. +51 −0 vendor/rails/actionmailer/lib/action_mailer/part_container.rb
  15. +59 −0 vendor/rails/actionmailer/lib/action_mailer/quoting.rb
  16. +59 −0 vendor/rails/actionmailer/lib/action_mailer/test_case.rb
  17. +67 −0 vendor/rails/actionmailer/lib/action_mailer/test_helper.rb
  18. +8 −0 vendor/rails/actionmailer/lib/action_mailer/utils.rb
  19. +14 −0 vendor/rails/actionmailer/lib/action_mailer/vendor.rb
  20. +1,466 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
  21. +4 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail.rb
  22. +19 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/Makefile
  23. +245 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb
  24. +47 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb
  25. +52 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/base64.rb
  26. +39 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/compat.rb
  27. +71 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb
  28. +67 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb
  29. +481 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb
  30. +552 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/facade.rb
  31. +931 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb
  32. +35 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/info.rb
  33. +540 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb
  34. +1 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/loader.rb
  35. +462 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb
  36. +435 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb
  37. +1 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mbox.rb
  38. +282 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb
  39. +137 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/obsolete.rb
  40. +1,475 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb
  41. +381 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y
  42. +379 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb
  43. +142 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb
  44. +43 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/scanner.rb
  45. +263 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/scanner_r.rb
  46. +279 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb
  47. +1 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/tmail.rb
  48. +281 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb
  49. +38 −0 vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/version.rb
  50. +9 −0 vendor/rails/actionmailer/lib/action_mailer/version.rb
  51. +1 −0 vendor/rails/actionmailer/lib/actionmailer.rb
  52. +49 −0 vendor/rails/actionmailer/test/abstract_unit.rb
  53. +51 −0 vendor/rails/actionmailer/test/delivery_method_test.rb
  54. +1 −0 vendor/rails/actionmailer/test/fixtures/first_mailer/share.erb
  55. 0 vendor/rails/actionmailer/test/fixtures/first_mailer/share.rhtml
  56. +1 −0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.erb
  57. 0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.rhtml
  58. +1 −0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.erb
  59. 0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.rhtml
  60. +1 −0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.erb
  61. 0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.rhtml
  62. +5 −0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.erb
  63. 0 vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.rhtml
  64. +5 −0 vendor/rails/actionmailer/test/fixtures/helpers/example_helper.rb
  65. +1 −0 ...nmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb
  66. 0 ...ailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.rhtml
  67. 0 vendor/rails/actionmailer/test/fixtures/path.with.dots/multipart_with_template_path_with_dots.rhtml
  68. BIN vendor/rails/actionmailer/test/fixtures/raw_base64_decoded_string
  69. +1 −0 vendor/rails/actionmailer/test/fixtures/raw_base64_encoded_string
  70. +14 −0 vendor/rails/actionmailer/test/fixtures/raw_email
  71. +20 −0 vendor/rails/actionmailer/test/fixtures/raw_email10
  72. +32 −0 vendor/rails/actionmailer/test/fixtures/raw_email12
  73. +29 −0 vendor/rails/actionmailer/test/fixtures/raw_email13
  74. +114 −0 vendor/rails/actionmailer/test/fixtures/raw_email2
  75. +70 −0 vendor/rails/actionmailer/test/fixtures/raw_email3
  76. +59 −0 vendor/rails/actionmailer/test/fixtures/raw_email4
  77. +19 −0 vendor/rails/actionmailer/test/fixtures/raw_email5
  78. +20 −0 vendor/rails/actionmailer/test/fixtures/raw_email6
  79. +66 −0 vendor/rails/actionmailer/test/fixtures/raw_email7
  80. +47 −0 vendor/rails/actionmailer/test/fixtures/raw_email8
  81. +28 −0 vendor/rails/actionmailer/test/fixtures/raw_email9
  82. +14 −0 vendor/rails/actionmailer/test/fixtures/raw_email_quoted_with_0d0a
  83. +104 −0 vendor/rails/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type
  84. +100 −0 vendor/rails/actionmailer/test/fixtures/raw_email_with_nested_attachment
  85. +14 −0 vendor/rails/actionmailer/test/fixtures/raw_email_with_partially_quoted_subject
  86. +1 −0 vendor/rails/actionmailer/test/fixtures/second_mailer/share.erb
  87. 0 vendor/rails/actionmailer/test/fixtures/second_mailer/share.rhtml
  88. +3 −0 vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb
  89. 0 vendor/rails/actionmailer/test/fixtures/templates/signed_up.rhtml
  90. +1 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb
  91. +6 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml
  92. +6 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml
  93. +1 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb
  94. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.rhtml
  95. +1 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak
  96. +10 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb
  97. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.rhtml
  98. +2 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb
  99. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.rhtml
  100. +1 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb
  101. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml
  102. +1 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb
  103. +2 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.builder
  104. +2 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml
  105. +3 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb
  106. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.rhtml
  107. +5 −0 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
  108. 0 vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.rhtml
  109. +95 −0 vendor/rails/actionmailer/test/mail_helper_test.rb
  110. +122 −0 vendor/rails/actionmailer/test/mail_render_test.rb
  111. +939 −0 vendor/rails/actionmailer/test/mail_service_test.rb
  112. +111 −0 vendor/rails/actionmailer/test/quoting_test.rb
  113. +117 −0 vendor/rails/actionmailer/test/test_helper_test.rb
  114. +22 −0 vendor/rails/actionmailer/test/tmail_test.rb
  115. +76 −0 vendor/rails/actionmailer/test/url_test.rb
  116. +4,606 −0 vendor/rails/actionpack/CHANGELOG
  117. +21 −0 vendor/rails/actionpack/MIT-LICENSE
  118. +469 −0 vendor/rails/actionpack/README
  119. +24 −0 vendor/rails/actionpack/RUNNING_UNIT_TESTS
  120. +153 −0 vendor/rails/actionpack/Rakefile
  121. +30 −0 vendor/rails/actionpack/install.rb
  122. +79 −0 vendor/rails/actionpack/lib/action_controller.rb
  123. +69 −0 vendor/rails/actionpack/lib/action_controller/assertions.rb
  124. +39 −0 vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb
  125. +19 −0 vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb
  126. +166 −0 vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb
  127. +143 −0 vendor/rails/actionpack/lib/action_controller/assertions/routing_assertions.rb
  128. +640 −0 vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb
  129. +130 −0 vendor/rails/actionpack/lib/action_controller/assertions/tag_assertions.rb
  130. +1,295 −0 vendor/rails/actionpack/lib/action_controller/base.rb
  131. +94 −0 vendor/rails/actionpack/lib/action_controller/benchmarking.rb
  132. +683 −0 vendor/rails/actionpack/lib/action_controller/caching.rb
  133. +16 −0 vendor/rails/actionpack/lib/action_controller/cgi_ext.rb
  134. +106 −0 vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie.rb
  135. +22 −0 vendor/rails/actionpack/lib/action_controller/cgi_ext/query_extension.rb
  136. +73 −0 vendor/rails/actionpack/lib/action_controller/cgi_ext/session.rb
  137. +23 −0 vendor/rails/actionpack/lib/action_controller/cgi_ext/stdinput.rb
  138. +221 −0 vendor/rails/actionpack/lib/action_controller/cgi_process.rb
  139. +165 −0 vendor/rails/actionpack/lib/action_controller/components.rb
  140. +84 −0 vendor/rails/actionpack/lib/action_controller/cookies.rb
  141. +195 −0 vendor/rails/actionpack/lib/action_controller/dispatcher.rb
  142. +767 −0 vendor/rails/actionpack/lib/action_controller/filters.rb
  143. +177 −0 vendor/rails/actionpack/lib/action_controller/flash.rb
  144. +204 −0 vendor/rails/actionpack/lib/action_controller/helpers.rb
  145. +126 −0 vendor/rails/actionpack/lib/action_controller/http_authentication.rb
Sorry, we could not display the entire diff because too many files (1,053) changed.
View
3 .gitignore
@@ -5,4 +5,5 @@ public/cache/**/*
doc/api
doc/app
db/development.sqlite3
-db/schema.rb
+db/schema.rb
+config/deploy.rb
View
3 Capfile
@@ -0,0 +1,3 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+load 'config/deploy'
View
325 vendor/rails/actionmailer/CHANGELOG
@@ -0,0 +1,325 @@
+*2.0.2* (December 16th, 2007)
+
+* Included in Rails 2.0.2
+
+
+*2.0.1* (December 7th, 2007)
+
+* Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [rick]
+
+ * Pass the template_root as an array as ActionView's view_path
+ * Request templates with the "#{mailer_name}/#{action}" as opposed to just "#{action}"
+
+* Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java]
+
+* Update README to use new smtp settings configuration API. Closes #10060 [psq]
+
+* Allow ActionMailer subclasses to individually set their delivery method (so two subclasses can have different delivery methods) #10033 [zdennis]
+
+* Update TMail to v1.1.0. Use an updated version of TMail if available. [mikel]
+
+* Introduce a new base test class for testing Mailers. ActionMailer::TestCase [Koz]
+
+* Fix silent failure of rxml templates. #9879 [jstewart]
+
+* Fix attachment decoding when using the TMail C extension. #7861 [orangechicken]
+
+* Increase mail delivery test coverage. #8692 [Kamal Fariz Mahyuddin]
+
+* Register alternative template engines using ActionMailer::Base.register_template_extension('haml'). #7534 [cwd, Josh Peek]
+
+* Only load ActionController::UrlWriter if ActionController is present [Rick Olson]
+
+* Make sure parsed emails recognized attachments nested inside multipart parts. #6714 [Jamis Buck]
+
+* Allow mailer actions named send by using __send__ internally. #6467 [iGEL]
+
+* Add assert_emails and assert_no_emails to test the number of emails delivered. #6479 [Jonathan Viney]
+ # Assert total number of emails delivered:
+ assert_emails 0
+ ContactMailer.deliver_contact
+ assert_emails 1
+
+ # Assert number of emails delivered within a block:
+ assert_emails 1 do
+ post :signup, :name => 'Jonathan'
+ end
+
+
+*1.3.3* (March 12th, 2007)
+
+* Depend on Action Pack 1.13.3
+
+
+*1.3.2* (February 5th, 2007)
+
+* Deprecate server_settings renaming it to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Koz]
+
+
+*1.3.1* (January 16th, 2007)
+
+* Depend on Action Pack 1.13.1
+
+
+*1.3.0* (January 16th, 2007)
+
+* Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
+
+* Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
+
+* Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
+
+* Fixed that iconv decoding should catch InvalidEncoding #3153 [jon@siliconcircus.com]
+
+* Tighten rescue clauses. #5985 [james@grayproductions.net]
+
+* Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [DHH]
+
+* Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
+
+* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
+
+* Resolve action naming collision. #5520 [ssinghi@kreeti.com]
+
+* ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, 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.]
+
+* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
+
+
+*1.2.1* (April 6th, 2006)
+
+* Be part of Rails 1.1.1
+
+
+*1.2.0* (March 27th, 2006)
+
+* Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
+
+* Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
+
+* Make custom headers work in subparts #4034 [elan@bluemandrill.com]
+
+* Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler]
+
+* Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
+
+* Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
+
+
+*1.1.5* (December 13th, 2005)
+
+* Become part of Rails 1.0
+
+
+*1.1.4* (December 7th, 2005)
+
+* Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
+
+* Stricter matching for implicitly multipart filenames excludes files ending in unsupported extensions (such as foo.rhtml.bak) and without a two-part content type (such as foo.text.rhtml or foo.text.really.plain.rhtml). #2398 [Dave Burt <dave@burt.id.au>, Jeremy Kemper]
+
+
+*1.1.3* (November 7th, 2005)
+
+* Allow Mailers to have custom initialize methods that set default instance variables for all mail actions #2563 [mrj@bigpond.net.au]
+
+
+*1.1.2* (October 26th, 2005)
+
+* Upgraded to Action Pack 1.10.2
+
+
+*1.1.1* (October 19th, 2005)
+
+* Upgraded to Action Pack 1.10.1
+
+
+*1.1.0* (October 16th, 2005)
+
+* Update and extend documentation (rdoc)
+
+* Minero Aoki made TMail available to Rails/ActionMailer under the MIT license (instead of LGPL) [RubyConf '05]
+
+* Austin Ziegler made Text::Simple available to Rails/ActionMailer under a MIT-like licens [See rails ML, subject "Text::Format Licence Exception" on Oct 15, 2005]
+
+* Fix vendor require paths to prevent files being required twice
+
+* Don't add charset to content-type header for a part that contains subparts (for AOL compatibility) #2013 [John Long]
+
+* Preserve underscores when unquoting message bodies #1930
+
+* Encode multibyte characters correctly #1894
+
+* Multipart messages specify a MIME-Version header automatically #2003 [John Long]
+
+* Add a unified render method to ActionMailer (delegates to ActionView::Base#render)
+
+* Move mailer initialization to a separate (overridable) method, so that subclasses may alter the various defaults #1727
+
+* Look at content-location header (if available) to determine filename of attachments #1670
+
+* ActionMailer::Base.deliver(email) had been accidentally removed, but was documented in the Rails book #1849
+
+* Fix problem with sendmail delivery where headers should be delimited by \n characters instead of \r\n, which confuses some mail readers #1742 [Kent Sibilev]
+
+
+*1.0.1* (11 July, 2005)
+
+* Bind to Action Pack 1.9.1
+
+
+*1.0.0* (6 July, 2005)
+
+* Avoid adding nil header values #1392
+
+* Better multipart support with implicit multipart/alternative and sorting of subparts [John Long]
+
+* Allow for nested parts in multipart mails #1570 [Flurin Egger]
+
+* Normalize line endings in outgoing mail bodies to "\n" #1536 [John Long]
+
+* Allow template to be explicitly specified #1448 [tuxie@dekadance.se]
+
+* Allow specific "multipart/xxx" content-type to be set on multipart messages #1412 [Flurin Egger]
+
+* Unquoted @ characters in headers are now accepted in spite of RFC 822 #1206
+
+* Helper support (borrowed from ActionPack)
+
+* Silently ignore Errno::EINVAL errors when converting text.
+
+* Don't cause an error when parsing an encoded attachment name #1340 [lon@speedymac.com]
+
+* Nested multipart message parts are correctly processed in TMail::Mail#body
+
+* BCC headers are removed when sending via SMTP #1402
+
+* Added 'content_type' accessor, to allow content type to be set on a per-message basis. content_type defaults to "text/plain".
+
+* Silently ignore Iconv::IllegalSequence errors when converting text #1341 [lon@speedymac.com]
+
+* Support attachments and multipart messages.
+
+* Added new accessors for the various mail properties.
+
+* Fix to only perform the charset conversion if a 'from' and a 'to' charset are given (make no assumptions about what the charset was) #1276 [Jamis Buck]
+
+* Fix attachments and content-type problems #1276 [Jamis Buck]
+
+* Fixed the TMail#body method to look at the content-transfer-encoding header and unquote the body according to the rules it specifies #1265 [Jamis Buck]
+
+* Added unquoting even if the iconv lib can't be loaded--in that case, only the charset conversion is skipped #1265 [Jamis Buck]
+
+* Added automatic decoding of base64 bodies #1214 [Jamis Buck]
+
+* Added that delivery errors are caught in a way so the mail is still returned whether the delivery was successful or not
+
+* Fixed that email address like "Jamis Buck, M.D." <wild.medicine@example.net> would cause the quoter to generate emails resulting in "bad address" errors from the mail server #1220 [Jamis Buck]
+
+
+*0.9.1* (20th April, 2005)
+
+* Depend on Action Pack 1.8.1
+
+
+*0.9.0* (19th April, 2005)
+
+* 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]
+
+* Fixed quoting for all address headers, not just to #955 [Jamis Buck]
+
+* Fixed unquoting of emails that doesn't have an explicit charset #1036 [wolfgang@stufenlos.net]
+
+
+*0.8.1* (27th March, 2005)
+
+* Fixed that if charset was found that the end of a mime part declaration TMail would throw an error #919 [lon@speedymac.com]
+
+* Fixed that TMail::Unquoter would fail to recognize quoting method if it was in lowercase #919 [lon@speedymac.com]
+
+* Fixed that TMail::Encoder would fail when it attempts to parse e-mail addresses which are encoded using something other than the messages encoding method #919 [lon@speedymac.com]
+
+* Added rescue for missing iconv library and throws warnings if subject/body is called on a TMail object without it instead
+
+
+*0.8.0* (22th March, 2005)
+
+* Added framework support for processing incoming emails with an Action Mailer class. See example in README.
+
+
+*0.7.1* (7th March, 2005)
+
+* Bind to newest Action Pack (1.5.1)
+
+
+*0.7.0* (24th February, 2005)
+
+* Added support for charsets for both subject and body. The default charset is now UTF-8 #673 [Jamis Buck]. Examples:
+
+ def iso_charset(recipient)
+ @recipients = recipient
+ @subject = "testing iso charsets"
+ @from = "system@loudthinking.com"
+ @body = "Nothing to see here."
+ @charset = "iso-8859-1"
+ end
+
+ def unencoded_subject(recipient)
+ @recipients = recipient
+ @subject = "testing unencoded subject"
+ @from = "system@loudthinking.com"
+ @body = "Nothing to see here."
+ @encode_subject = false
+ @charset = "iso-8859-1"
+ end
+
+
+*0.6.1* (January 18th, 2005)
+
+* Fixed sending of emails to use Tmail#from not the deprecated Tmail#from_address
+
+
+*0.6* (January 17th, 2005)
+
+* Fixed that bcc and cc should be settable through @bcc and @cc -- not just @headers["Bcc"] and @headers["Cc"] #453 [Eric Hodel]
+
+* Fixed Action Mailer to be "warnings safe" so you can run with ruby -w and not get framework warnings #453 [Eric Hodel]
+
+
+*0.5*
+
+* Added access to custom headers, like cc, bcc, and reply-to #268 [Andreas Schwarz]. Example:
+
+ def post_notification(recipients, post)
+ @recipients = recipients
+ @from = post.author.email_address_with_name
+ @headers["bcc"] = SYSTEM_ADMINISTRATOR_EMAIL
+ @headers["reply-to"] = "notifications@example.com"
+ @subject = "[#{post.account.name} #{post.title}]"
+ @body["post"] = post
+ end
+
+*0.4* (5)
+
+* Consolidated the server configuration options into Base#server_settings= and expanded that with controls for authentication and more [Marten]
+ NOTE: This is an API change that could potentially break your application if you used the old application form. Please do change!
+
+* Added Base#deliveries as an accessor for an array of emails sent out through that ActionMailer class when using the :test delivery option. [Jeremy Kemper]
+
+* Added Base#perform_deliveries= which can be set to false to turn off the actual delivery of the email through smtp or sendmail.
+ This is especially useful for functional testing that shouldn't send off real emails, but still trigger delivery_* methods.
+
+* Added option to specify delivery method with Base#delivery_method=. Default is :smtp and :sendmail is currently the only other option.
+ Sendmail is assumed to be present at "/usr/sbin/sendmail" if that option is used. [Kent Sibilev]
+
+* Dropped "include TMail" as it added to much baggage into the default namespace (like Version) [Chad Fowler]
+
+
+*0.3*
+
+* First release
View
21 vendor/rails/actionmailer/MIT-LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2004-2007 David Heinemeier Hansson
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
145 vendor/rails/actionmailer/README
@@ -0,0 +1,145 @@
+= Action Mailer -- Easy email delivery and testing
+
+Action Mailer is a framework for designing email-service layers. These layers
+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.
+
+Additionally, an Action Mailer class can be used to process incoming email,
+such as allowing a weblog to accept new posts from an email (which could even
+have been sent from a phone).
+
+== Sending emails
+
+The framework works by setting up all the email details, except the body,
+in methods on the service layer. Subject, recipients, sender, and timestamp
+are all set up this way. An example of such a method:
+
+ def signed_up(recipient)
+ recipients recipient
+ subject "[Signed up] Welcome #{recipient}"
+ from "system@loudthinking.com"
+
+ body(:recipient => recipient)
+ end
+
+The body of the email is created by using an Action View template (regular
+ERb) that has the content of the body hash parameter available as instance variables.
+So the corresponding body template for the method above could look like this:
+
+ Hello there,
+
+ Mr. <%= @recipient %>
+
+And if the recipient was given as "david@loudthinking.com", the email
+generated would look like this:
+
+ Date: Sun, 12 Dec 2004 00:00:00 +0100
+ From: system@loudthinking.com
+ To: david@loudthinking.com
+ Subject: [Signed up] Welcome david@loudthinking.com
+
+ Hello there,
+
+ Mr. david@loudthinking.com
+
+You never actually call the instance methods like signed_up directly. Instead,
+you call class methods like deliver_* and create_* that are automatically
+created for each instance method. So if the signed_up method sat on
+ApplicationMailer, it would look like this:
+
+ ApplicationMailer.create_signed_up("david@loudthinking.com") # => tmail object for testing
+ ApplicationMailer.deliver_signed_up("david@loudthinking.com") # sends the email
+ ApplicationMailer.new.signed_up("david@loudthinking.com") # won't work!
+
+== Receiving emails
+
+To receive emails, you need to implement a public instance method called receive that takes a
+tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
+which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns
+into the tmail object and calls the receive instance method.
+
+Example:
+
+ class Mailman < ActionMailer::Base
+ def receive(email)
+ page = Page.find_by_address(email.to.first)
+ page.emails.create(
+ :subject => email.subject, :body => email.body
+ )
+
+ if email.has_attachments?
+ for attachment in email.attachments
+ page.attachments.create({
+ :file => attachment, :description => email.subject
+ })
+ end
+ end
+ end
+ end
+
+This Mailman can be the target for Postfix. In Rails, you would use the runner like this:
+
+ ./script/runner 'Mailman.receive(STDIN.read)'
+
+== Configuration
+
+The Base class has the full list of configuration options. Here's an example:
+
+ActionMailer::Base.smtp_settings = {
+ :address=>'smtp.yourserver.com', # default: localhost
+ :port=>'25', # default: 25
+ :user_name=>'user',
+ :password=>'pass',
+ :authentication=>:plain # :plain, :login or :cram_md5
+}
+
+== Dependencies
+
+Action Mailer requires that the Action Pack is either available to be required immediately
+or is accessible as a GEM.
+
+
+== Bundled software
+
+* tmail 0.10.8 by Minero Aoki released under LGPL
+ Read more on http://i.loveruby.net/en/prog/tmail.html
+
+* Text::Format 0.63 by Austin Ziegler released under OpenSource
+ Read more on http://www.halostatue.ca/ruby/Text__Format.html
+
+
+== Download
+
+The latest version of Action Mailer can be found at
+
+* http://rubyforge.org/project/showfiles.php?group_id=361
+
+Documentation can be found at
+
+* http://actionmailer.rubyonrails.org
+
+
+== Installation
+
+You can install Action Mailer with the following command.
+
+ % [sudo] ruby install.rb
+
+from its distribution directory.
+
+
+== License
+
+Action Mailer is released under the MIT license.
+
+
+== Support
+
+The Action Mailer homepage is http://www.rubyonrails.org. You can find
+the Action Mailer RubyForge page at http://rubyforge.org/projects/actionmailer.
+And as Jim from Rake says:
+
+ Feel free to submit commits or feature requests. If you send a patch,
+ remember to update the corresponding unit tests. If fact, I prefer
+ new feature to be submitted in the form of new unit tests.
View
96 vendor/rails/actionmailer/Rakefile
@@ -0,0 +1,96 @@
+require 'rubygems'
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'rake/packagetask'
+require 'rake/gempackagetask'
+require 'rake/contrib/rubyforgepublisher'
+require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version')
+
+PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
+PKG_NAME = 'actionmailer'
+PKG_VERSION = ActionMailer::VERSION::STRING + PKG_BUILD
+PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
+
+RELEASE_NAME = "REL #{PKG_VERSION}"
+
+RUBY_FORGE_PROJECT = "actionmailer"
+RUBY_FORGE_USER = "webster132"
+
+desc "Default Task"
+task :default => [ :test ]
+
+# Run the unit tests
+Rake::TestTask.new { |t|
+ t.libs << "test"
+ t.pattern = 'test/*_test.rb'
+ t.verbose = true
+ t.warning = false
+}
+
+
+# Generate the RDoc documentation
+Rake::RDocTask.new { |rdoc|
+ rdoc.rdoc_dir = 'doc'
+ rdoc.title = "Action Mailer -- Easy email delivery and testing"
+ rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
+ rdoc.options << '--charset' << 'utf-8'
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
+ rdoc.rdoc_files.include('README', 'CHANGELOG')
+ rdoc.rdoc_files.include('lib/action_mailer.rb')
+ rdoc.rdoc_files.include('lib/action_mailer/*.rb')
+}
+
+
+# Create compressed packages
+spec = Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = PKG_NAME
+ s.summary = "Service layer for easy email delivery and testing."
+ s.description = %q{Makes it trivial to test and deliver emails sent from a single service layer.}
+ s.version = PKG_VERSION
+
+ s.author = "David Heinemeier Hansson"
+ s.email = "david@loudthinking.com"
+ s.rubyforge_project = "actionmailer"
+ s.homepage = "http://www.rubyonrails.org"
+
+ s.add_dependency('actionpack', '= 2.0.2' + PKG_BUILD)
+
+ s.has_rdoc = true
+ s.requirements << 'none'
+ s.require_path = 'lib'
+ s.autorequire = 'action_mailer'
+
+ s.files = [ "Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
+ s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
+ s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
+end
+
+Rake::GemPackageTask.new(spec) do |p|
+ p.gem_spec = spec
+ p.need_tar = true
+ p.need_zip = true
+end
+
+
+desc "Publish the API documentation"
+task :pgem => [:package] do
+ Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
+end
+
+desc "Publish the API documentation"
+task :pdoc => [:rdoc] do
+ Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/am", "doc").upload
+end
+
+desc "Publish the release files to RubyForge."
+task :release => [ :package ] do
+ require 'rubyforge'
+
+ packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
+
+ rubyforge = RubyForge.new
+ rubyforge.login
+ rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
+end
View
30 vendor/rails/actionmailer/install.rb
@@ -0,0 +1,30 @@
+require 'rbconfig'
+require 'find'
+require 'ftools'
+
+include Config
+
+# this was adapted from rdoc's install.rb by way of Log4r
+
+$sitedir = CONFIG["sitelibdir"]
+unless $sitedir
+ version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
+ $libdir = File.join(CONFIG["libdir"], "ruby", version)
+ $sitedir = $:.find {|x| x =~ /site_ruby/ }
+ if !$sitedir
+ $sitedir = File.join($libdir, "site_ruby")
+ elsif $sitedir !~ Regexp.quote(version)
+ $sitedir = File.join($sitedir, version)
+ end
+end
+
+# the actual gruntwork
+Dir.chdir("lib")
+
+Find.find("action_mailer", "action_mailer.rb") { |f|
+ if f[-3..-1] == ".rb"
+ File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
+ else
+ File::makedirs(File.join($sitedir, *f.split(/\//)))
+ end
+}
View
52 vendor/rails/actionmailer/lib/action_mailer.rb
@@ -0,0 +1,52 @@
+#--
+# Copyright (c) 2004-2007 David Heinemeier Hansson
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#++
+
+unless defined?(ActionController)
+ begin
+ $:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
+ require 'action_controller'
+ rescue LoadError
+ require 'rubygems'
+ gem 'actionpack', '>= 1.12.5'
+ end
+end
+
+require 'action_mailer/vendor'
+require 'tmail'
+
+require 'action_mailer/base'
+require 'action_mailer/helpers'
+require 'action_mailer/mail_helper'
+require 'action_mailer/quoting'
+require 'action_mailer/test_helper'
+
+require 'net/smtp'
+
+ActionMailer::Base.class_eval do
+ include ActionMailer::Quoting
+ include ActionMailer::Helpers
+
+ helper MailHelper
+end
+
+silence_warnings { TMail::Encoder.const_set("MAX_LINE_LEN", 200) }
View
30 vendor/rails/actionmailer/lib/action_mailer/adv_attr_accessor.rb
@@ -0,0 +1,30 @@
+module ActionMailer
+ module AdvAttrAccessor #:nodoc:
+ def self.included(base)
+ base.extend(ClassMethods)
+ end
+
+ module ClassMethods #:nodoc:
+ def adv_attr_accessor(*names)
+ names.each do |name|
+ ivar = "@#{name}"
+
+ define_method("#{name}=") do |value|
+ instance_variable_set(ivar, value)
+ end
+
+ define_method(name) do |*parameters|
+ raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
+ if parameters.empty?
+ if instance_variables.include?(ivar)
+ instance_variable_get(ivar)
+ end
+ else
+ instance_variable_set(ivar, parameters.first)
+ end
+ end
+ end
+ end
+ end
+ end
+end
View
603 vendor/rails/actionmailer/lib/action_mailer/base.rb
@@ -0,0 +1,603 @@
+require 'action_mailer/adv_attr_accessor'
+require 'action_mailer/part'
+require 'action_mailer/part_container'
+require 'action_mailer/utils'
+require 'tmail/net'
+
+module ActionMailer #:nodoc:
+ # ActionMailer allows you to send email from your application using a mailer model and views.
+ #
+ #
+ # = Mailer Models
+ #
+ # To use ActionMailer, you need to create a mailer model.
+ #
+ # $ script/generate mailer Notifier
+ #
+ # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
+ # used to set variables to be used in the mail template, to change options on the mail, or
+ # to add attachments.
+ #
+ # Examples:
+ #
+ # class Notifier < ActionMailer::Base
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # from "system@example.com"
+ # subject "New account information"
+ # body :account => recipient
+ # end
+ # end
+ #
+ # Mailer methods have the following configuration methods available.
+ #
+ # * <tt>recipients</tt> - Takes one or more email addresses. These addresses are where your email will be delivered to. Sets the <tt>To:</tt> header.
+ # * <tt>subject</tt> - The subject of your email. Sets the <tt>Subject:</tt> header.
+ # * <tt>from</tt> - Who the email you are sending is from. Sets the <tt>From:</tt> header.
+ # * <tt>cc</tt> - Takes one or more email addresses. These addresses will receive a carbon copy of your email. Sets the <tt>Cc:</tt> header.
+ # * <tt>bcc</tt> - Takes one or more email address. These addresses will receive a blind carbon copy of your email. Sets the <tt>Bcc</tt> header.
+ # * <tt>sent_on</tt> - The date on which the message was sent. If not set, the header wil be set by the delivery agent.
+ # * <tt>content_type</tt> - Specify the content type of the message. Defaults to <tt>text/plain</tt>.
+ # * <tt>headers</tt> - Specify additional headers to be set for the message, e.g. <tt>headers 'X-Mail-Count' => 107370</tt>.
+ #
+ # The <tt>body</tt> method has special behavior. It takes a hash which generates an instance variable
+ # named after each key in the hash containing the value that that key points to.
+ #
+ # So, for example, <tt>body "account" => recipient</tt> would result
+ # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
+ # view.
+ #
+ #
+ # = Mailer views
+ #
+ # Like ActionController, each mailer class has a corresponding view directory
+ # in which each method of the class looks for a template with its name.
+ # To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same name as the method
+ # in your mailer model. For example, in the mailer defined above, the template at
+ # <tt>app/views/notifier/signup_notification.erb</tt> would be used to generate the email.
+ #
+ # Variables defined in the model are accessible as instance variables in the view.
+ #
+ # Emails by default are sent in plain text, so a sample view for our model example might look like this:
+ #
+ # Hi <%= @account.name %>,
+ # Thanks for joining our service! Please check back often.
+ #
+ # You can even use Action Pack helpers in these views. For example:
+ #
+ # You got a new note!
+ # <%= truncate(note.body, 25) %>
+ #
+ #
+ # = Generating URLs for mailer views
+ #
+ # If your view includes URLs from the application, you need to use url_for in the mailing method instead of the view.
+ # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request. That's
+ # why you need to jump this little hoop and supply all the details needed for the URL. Example:
+ #
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # from "system@example.com"
+ # subject "New account information"
+ # body :account => recipient,
+ # :home_page => url_for(:host => "example.com", :controller => "welcome", :action => "greeting")
+ # end
+ #
+ # You can now access @home_page in the template and get http://example.com/welcome/greeting.
+ #
+ # = Sending mail
+ #
+ # Once a mailer action and template are defined, you can deliver your message or create it and save it
+ # for delivery later:
+ #
+ # Notifier.deliver_signup_notification(david) # sends the email
+ # mail = Notifier.create_signup_notification(david) # => a tmail object
+ # Notifier.deliver(mail)
+ #
+ # You never instantiate your mailer class. Rather, your delivery instance
+ # methods are automatically wrapped in class methods that start with the word
+ # <tt>deliver_</tt> followed by the name of the mailer method that you would
+ # like to deliver. The <tt>signup_notification</tt> method defined above is
+ # delivered by invoking <tt>Notifier.deliver_signup_notification</tt>.
+ #
+ #
+ # = HTML email
+ #
+ # To send mail as HTML, make sure your view (the <tt>.erb</tt> file) generates HTML and
+ # set the content type to html.
+ #
+ # class MyMailer < ActionMailer::Base
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # subject "New account information"
+ # body "account" => recipient
+ # from "system@example.com"
+ # content_type "text/html" # Here's where the magic happens
+ # end
+ # end
+ #
+ #
+ # = Multipart email
+ #
+ # You can explicitly specify multipart messages:
+ #
+ # class ApplicationMailer < ActionMailer::Base
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # subject "New account information"
+ # from "system@example.com"
+ #
+ # part :content_type => "text/html",
+ # :body => render_message("signup-as-html", :account => recipient)
+ #
+ # part "text/plain" do |p|
+ # p.body = render_message("signup-as-plain", :account => recipient)
+ # p.transfer_encoding = "base64"
+ # end
+ # end
+ # end
+ #
+ # Multipart messages can also be used implicitly because ActionMailer will automatically
+ # detect and use multipart templates, where each template is named after the name of the action, followed
+ # by the content type. Each such detected template will be added as separate part to the message.
+ #
+ # For example, if the following templates existed:
+ # * signup_notification.text.plain.erb
+ # * signup_notification.text.html.erb
+ # * signup_notification.text.xml.builder
+ # * signup_notification.text.x-yaml.erb
+ #
+ # Each would be rendered and added as a separate part to the message,
+ # with the corresponding content type. The same body hash is passed to
+ # each template.
+ #
+ #
+ # = Attachments
+ #
+ # Attachments can be added by using the +attachment+ method.
+ #
+ # Example:
+ #
+ # class ApplicationMailer < ActionMailer::Base
+ # # attachments
+ # def signup_notification(recipient)
+ # recipients recipient.email_address_with_name
+ # subject "New account information"
+ # from "system@example.com"
+ #
+ # attachment :content_type => "image/jpeg",
+ # :body => File.read("an-image.jpg")
+ #
+ # attachment "application/pdf" do |a|
+ # a.body = generate_your_pdf_here()
+ # end
+ # end
+ # end
+ #
+ #
+ # = Configuration options
+ #
+ # These options are specified on the class level, like <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
+ #
+ # * <tt>template_root</tt> - template root determines the base from which template references will be made.
+ #
+ # * <tt>logger</tt> - the logger is used for generating information on the mailing run if available.
+ # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
+ #
+ # * <tt>smtp_settings</tt> - Allows detailed configuration for :smtp delivery method:
+ # * <tt>:address</tt> Allows you to use a remote mail server. Just change it from its default "localhost" setting.
+ # * <tt>:port</tt> On the off chance that your mail server doesn't run on port 25, you can change it.
+ # * <tt>:domain</tt> If you need to specify a HELO domain, you can do it here.
+ # * <tt>:user_name</tt> If your mail server requires authentication, set the username in this setting.
+ # * <tt>:password</tt> If your mail server requires authentication, set the password in this setting.
+ # * <tt>:authentication</tt> If your mail server requires authentication, you need to specify the authentication type here.
+ # This is a symbol and one of :plain, :login, :cram_md5
+ #
+ # * <tt>sendmail_settings</tt> - Allows you to override options for the :sendmail delivery method
+ # * <tt>:location</tt> The location of the sendmail executable, defaults to "/usr/sbin/sendmail"
+ # * <tt>:arguments</tt> The command line arguments
+ # * <tt>raise_delivery_errors</tt> - whether or not errors should be raised if the email fails to be delivered.
+ #
+ # * <tt>delivery_method</tt> - Defines a delivery method. Possible values are :smtp (default), :sendmail, and :test.
+ #
+ # * <tt>perform_deliveries</tt> - Determines whether deliver_* methods are actually carried out. By default they are,
+ # but this can be turned off to help functional testing.
+ #
+ # * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful
+ # for unit and functional testing.
+ #
+ # * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
+ # pick a different charset from inside a method with <tt>@charset</tt>.
+ # * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
+ # can also pick a different content type from inside a method with <tt>@content_type</tt>.
+ # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to "1.0". You
+ # can also pick a different value from inside a method with <tt>@mime_version</tt>.
+ # * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
+ # which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
+ # ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client
+ # and appear last in the mime encoded message. You can also pick a different order from inside a method with
+ # <tt>@implicit_parts_order</tt>.
+ class Base
+ include AdvAttrAccessor, PartContainer
+ include ActionController::UrlWriter if Object.const_defined?(:ActionController)
+
+ private_class_method :new #:nodoc:
+
+ class_inheritable_accessor :template_root
+ cattr_accessor :logger
+
+ cattr_accessor :template_extensions
+ @@template_extensions = ['erb', 'builder', 'rhtml', 'rxml']
+
+ @@smtp_settings = {
+ :address => "localhost",
+ :port => 25,
+ :domain => 'localhost.localdomain',
+ :user_name => nil,
+ :password => nil,
+ :authentication => nil
+ }
+ cattr_accessor :smtp_settings
+
+ @@sendmail_settings = {
+ :location => '/usr/sbin/sendmail',
+ :arguments => '-i -t'
+ }
+ cattr_accessor :sendmail_settings
+
+ @@raise_delivery_errors = true
+ cattr_accessor :raise_delivery_errors
+
+ superclass_delegating_accessor :delivery_method
+ self.delivery_method = :smtp
+
+ @@perform_deliveries = true
+ cattr_accessor :perform_deliveries
+
+ @@deliveries = []
+ cattr_accessor :deliveries
+
+ @@default_charset = "utf-8"
+ cattr_accessor :default_charset
+
+ @@default_content_type = "text/plain"
+ cattr_accessor :default_content_type
+
+ @@default_mime_version = "1.0"
+ cattr_accessor :default_mime_version
+
+ @@default_implicit_parts_order = [ "text/html", "text/enriched", "text/plain" ]
+ cattr_accessor :default_implicit_parts_order
+
+ # Specify the BCC addresses for the message
+ adv_attr_accessor :bcc
+
+ # Define the body of the message. This is either a Hash (in which case it
+ # specifies the variables to pass to the template when it is rendered),
+ # or a string, in which case it specifies the actual text of the message.
+ adv_attr_accessor :body
+
+ # Specify the CC addresses for the message.
+ adv_attr_accessor :cc
+
+ # Specify the charset to use for the message. This defaults to the
+ # +default_charset+ specified for ActionMailer::Base.
+ adv_attr_accessor :charset
+
+ # Specify the content type for the message. This defaults to <tt>text/plain</tt>
+ # in most cases, but can be automatically set in some situations.
+ adv_attr_accessor :content_type
+
+ # Specify the from address for the message.
+ adv_attr_accessor :from
+
+ # Specify additional headers to be added to the message.
+ adv_attr_accessor :headers
+
+ # Specify the order in which parts should be sorted, based on content-type.
+ # This defaults to the value for the +default_implicit_parts_order+.
+ adv_attr_accessor :implicit_parts_order
+
+ # Defaults to "1.0", but may be explicitly given if needed.
+ adv_attr_accessor :mime_version
+
+ # The recipient addresses for the message, either as a string (for a single
+ # address) or an array (for multiple addresses).
+ adv_attr_accessor :recipients
+
+ # The date on which the message was sent. If not set (the default), the
+ # header will be set by the delivery agent.
+ adv_attr_accessor :sent_on
+
+ # Specify the subject of the message.
+ adv_attr_accessor :subject
+
+ # Specify the template name to use for current message. This is the "base"
+ # template name, without the extension or directory, and may be used to
+ # have multiple mailer methods share the same template.
+ adv_attr_accessor :template
+
+ # Override the mailer name, which defaults to an inflected version of the
+ # mailer's class name. If you want to use a template in a non-standard
+ # location, you can use this to specify that location.
+ def mailer_name(value = nil)
+ if value
+ self.mailer_name = value
+ else
+ self.class.mailer_name
+ end
+ end
+
+ def mailer_name=(value)
+ self.class.mailer_name = value
+ end
+
+ # The mail object instance referenced by this mailer.
+ attr_reader :mail
+
+ class << self
+ attr_writer :mailer_name
+
+ def mailer_name
+ @mailer_name ||= name.underscore
+ end
+
+ # for ActionView compatibility
+ alias_method :controller_name, :mailer_name
+ alias_method :controller_path, :mailer_name
+
+ def method_missing(method_symbol, *parameters)#:nodoc:
+ case method_symbol.id2name
+ when /^create_([_a-z]\w*)/ then new($1, *parameters).mail
+ when /^deliver_([_a-z]\w*)/ then new($1, *parameters).deliver!
+ when "new" then nil
+ else super
+ end
+ end
+
+ # Receives a raw email, parses it into an email object, decodes it,
+ # instantiates a new mailer, and passes the email object to the mailer
+ # object's #receive method. If you want your mailer to be able to
+ # process incoming messages, you'll need to implement a #receive
+ # method that accepts the email object as a parameter:
+ #
+ # class MyMailer < ActionMailer::Base
+ # def receive(mail)
+ # ...
+ # end
+ # end
+ def receive(raw_email)
+ logger.info "Received mail:\n #{raw_email}" unless logger.nil?
+ mail = TMail::Mail.parse(raw_email)
+ mail.base64_decode
+ new.receive(mail)
+ end
+
+ # Deliver the given mail object directly. This can be used to deliver
+ # a preconstructed mail object, like:
+ #
+ # email = MyMailer.create_some_mail(parameters)
+ # email.set_some_obscure_header "frobnicate"
+ # MyMailer.deliver(email)
+ def deliver(mail)
+ new.deliver!(mail)
+ end
+
+ # Register a template extension so mailer templates written in a
+ # templating language other than rhtml or rxml are supported.
+ # To use this, include in your template-language plugin's init
+ # code or on a per-application basis, this can be invoked from
+ # config/environment.rb:
+ #
+ # ActionMailer::Base.register_template_extension('haml')
+ def register_template_extension(extension)
+ template_extensions << extension
+ end
+ end
+
+ # Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
+ # will be initialized according to the named method. If not, the mailer will
+ # remain uninitialized (useful when you only need to invoke the "receive"
+ # method, for instance).
+ def initialize(method_name=nil, *parameters) #:nodoc:
+ create!(method_name, *parameters) if method_name
+ end
+
+ # Initialize the mailer via the given +method_name+. The body will be
+ # rendered and a new TMail::Mail object created.
+ def create!(method_name, *parameters) #:nodoc:
+ initialize_defaults(method_name)
+ __send__(method_name, *parameters)
+
+ # If an explicit, textual body has not been set, we check assumptions.
+ unless String === @body
+ # First, we look to see if there are any likely templates that match,
+ # which include the content-type in their file name (i.e.,
+ # "the_template_file.text.html.erb", etc.). Only do this if parts
+ # have not already been specified manually.
+ if @parts.empty?
+ templates = Dir.glob("#{template_path}/#{@template}.*")
+ templates.each do |path|
+ basename = File.basename(path)
+ template_regex = Regexp.new("^([^\\\.]+)\\\.([^\\\.]+\\\.[^\\\.]+)\\\.(" + template_extensions.join('|') + ")$")
+ next unless md = template_regex.match(basename)
+ template_name = basename
+ content_type = md.captures[1].gsub('.', '/')
+ @parts << Part.new(:content_type => content_type,
+ :disposition => "inline", :charset => charset,
+ :body => render_message(template_name, @body))
+ end
+ unless @parts.empty?
+ @content_type = "multipart/alternative"
+ @parts = sort_parts(@parts, @implicit_parts_order)
+ end
+ end
+
+ # Then, if there were such templates, we check to see if we ought to
+ # also render a "normal" template (without the content type). If a
+ # normal template exists (or if there were no implicit parts) we render
+ # it.
+ template_exists = @parts.empty?
+ template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| File.basename(i).split(".").length == 2 }
+ @body = render_message(@template, @body) if template_exists
+
+ # Finally, if there are other message parts and a textual body exists,
+ # we shift it onto the front of the parts and set the body to nil (so
+ # that create_mail doesn't try to render it in addition to the parts).
+ if !@parts.empty? && String === @body
+ @parts.unshift Part.new(:charset => charset, :body => @body)
+ @body = nil
+ end
+ end
+
+ # If this is a multipart e-mail add the mime_version if it is not
+ # already set.
+ @mime_version ||= "1.0" if !@parts.empty?
+
+ # build the mail object itself
+ @mail = create_mail
+ end
+
+ # Delivers a TMail::Mail object. By default, it delivers the cached mail
+ # object (from the #create! method). If no cached mail object exists, and
+ # no alternate has been given as the parameter, this will fail.
+ def deliver!(mail = @mail)
+ raise "no mail object available for delivery!" unless mail
+ logger.info "Sent mail:\n #{mail.encoded}" unless logger.nil?
+
+ begin
+ __send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries
+ rescue Exception => e # Net::SMTP errors or sendmail pipe errors
+ raise e if raise_delivery_errors
+ end
+
+ return mail
+ end
+
+ private
+ # 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)
+ @charset ||= @@default_charset.dup
+ @content_type ||= @@default_content_type.dup
+ @implicit_parts_order ||= @@default_implicit_parts_order.dup
+ @template ||= method_name
+ @mailer_name ||= Inflector.underscore(self.class.name)
+ @parts ||= []
+ @headers ||= {}
+ @body ||= {}
+ @mime_version = @@default_mime_version.dup if @@default_mime_version
+ end
+
+ def render_message(method_name, body)
+ render :file => method_name, :body => body
+ end
+
+ def render(opts)
+ body = opts.delete(:body)
+ if opts[:file] && opts[:file] !~ /\//
+ opts[:file] = "#{mailer_name}/#{opts[:file]}"
+ end
+ initialize_template_class(body).render(opts)
+ end
+
+ def template_path
+ "#{template_root}/#{mailer_name}"
+ end
+
+ def initialize_template_class(assigns)
+ ActionView::Base.new([template_root], assigns, self)
+ end
+
+ def sort_parts(parts, order = [])
+ order = order.collect { |s| s.downcase }
+
+ parts = parts.sort do |a, b|
+ a_ct = a.content_type.downcase
+ b_ct = b.content_type.downcase
+
+ a_in = order.include? a_ct
+ b_in = order.include? b_ct
+
+ s = case
+ when a_in && b_in
+ order.index(a_ct) <=> order.index(b_ct)
+ when a_in
+ -1
+ when b_in
+ 1
+ else
+ a_ct <=> b_ct
+ end
+
+ # reverse the ordering because parts that come last are displayed
+ # first in mail clients
+ (s * -1)
+ end
+
+ parts
+ end
+
+ def create_mail
+ m = TMail::Mail.new
+
+ m.subject, = quote_any_if_necessary(charset, subject)
+ m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
+ m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
+ m.cc = quote_address_if_necessary(cc, charset) unless cc.nil?
+
+ m.mime_version = mime_version unless mime_version.nil?
+ m.date = sent_on.to_time rescue sent_on if sent_on
+ headers.each { |k, v| m[k] = v }
+
+ real_content_type, ctype_attrs = parse_content_type
+
+ if @parts.empty?
+ m.set_content_type(real_content_type, nil, ctype_attrs)
+ m.body = Utils.normalize_new_lines(body)
+ else
+ if String === body
+ part = TMail::Mail.new
+ part.body = Utils.normalize_new_lines(body)
+ part.set_content_type(real_content_type, nil, ctype_attrs)
+ part.set_content_disposition "inline"
+ m.parts << part
+ end
+
+ @parts.each do |p|
+ part = (TMail::Mail === p ? p : p.to_mail(self))
+ m.parts << part
+ end
+
+ if real_content_type =~ /multipart/
+ ctype_attrs.delete "charset"
+ m.set_content_type(real_content_type, nil, ctype_attrs)
+ end
+ end
+
+ @mail = m
+ end
+
+ def perform_delivery_smtp(mail)
+ destinations = mail.destinations
+ mail.ready_to_send
+
+ Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
+ smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
+ smtp.sendmail(mail.encoded, mail.from, destinations)
+ end
+ end
+
+ def perform_delivery_sendmail(mail)
+ IO.popen("#{sendmail_settings[:location]} #{sendmail_settings[:arguments]}","w+") do |sm|
+ sm.print(mail.encoded.gsub(/\r/, ''))
+ sm.flush
+ end
+ end
+
+ def perform_delivery_test(mail)
+ deliveries << mail
+ end
+ end
+end
View
111 vendor/rails/actionmailer/lib/action_mailer/helpers.rb
@@ -0,0 +1,111 @@
+module ActionMailer
+ module Helpers #:nodoc:
+ def self.included(base) #:nodoc:
+ # Initialize the base module to aggregate its helpers.
+ base.class_inheritable_accessor :master_helper_module
+ base.master_helper_module = Module.new
+
+ # Extend base with class methods to declare helpers.
+ base.extend(ClassMethods)
+
+ base.class_eval do
+ # Wrap inherited to create a new master helper module for subclasses.
+ class << self
+ alias_method_chain :inherited, :helper
+ end
+
+ # Wrap initialize_template_class to extend new template class
+ # instances with the master helper module.
+ alias_method_chain :initialize_template_class, :helper
+ end
+ end
+
+ module ClassMethods
+ # Makes all the (instance) methods in the helper module available to templates rendered through this controller.
+ # See ActionView::Helpers (link:classes/ActionView/Helpers.html) for more about making your own helper modules
+ # available to the templates.
+ def add_template_helper(helper_module) #:nodoc:
+ master_helper_module.module_eval "include #{helper_module}"
+ end
+
+ # Declare a helper:
+ # helper :foo
+ # requires 'foo_helper' and includes FooHelper in the template class.
+ # helper FooHelper
+ # includes FooHelper in the template class.
+ # helper { def foo() "#{bar} is the very best" end }
+ # evaluates the block in the template class, adding method #foo.
+ # helper(:three, BlindHelper) { def mice() 'mice' end }
+ # does all three.
+ def helper(*args, &block)
+ args.flatten.each do |arg|
+ case arg
+ when Module
+ add_template_helper(arg)
+ when String, Symbol
+ file_name = arg.to_s.underscore + '_helper'
+ class_name = file_name.camelize
+
+ begin
+ require_dependency(file_name)
+ rescue LoadError => load_error
+ requiree = / -- (.*?)(\.rb)?$/.match(load_error.message).to_a[1]
+ msg = (requiree == file_name) ? "Missing helper file helpers/#{file_name}.rb" : "Can't load file: #{requiree}"
+ raise LoadError.new(msg).copy_blame!(load_error)
+ end
+
+ add_template_helper(class_name.constantize)
+ else
+ raise ArgumentError, 'helper expects String, Symbol, or Module argument'
+ end
+ end
+
+ # Evaluate block in template class if given.
+ master_helper_module.module_eval(&block) if block_given?
+ end
+
+ # Declare a controller method as a helper. For example,
+ # helper_method :link_to
+ # def link_to(name, options) ... end
+ # makes the link_to controller method available in the view.
+ def helper_method(*methods)
+ methods.flatten.each do |method|
+ master_helper_module.module_eval <<-end_eval
+ def #{method}(*args, &block)
+ controller.send!(%(#{method}), *args, &block)
+ end
+ end_eval
+ end
+ end
+
+ # Declare a controller attribute as a helper. For example,
+ # helper_attr :name
+ # attr_accessor :name
+ # makes the name and name= controller methods available in the view.
+ # The is a convenience wrapper for helper_method.
+ def helper_attr(*attrs)
+ attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") }
+ end
+
+ private
+ def inherited_with_helper(child)
+ inherited_without_helper(child)
+ begin
+ child.master_helper_module = Module.new
+ child.master_helper_module.send! :include, master_helper_module
+ child.helper child.name.underscore
+ rescue MissingSourceFile => e
+ raise unless e.is_missing?("helpers/#{child.name.underscore}_helper")
+ end
+ end
+ end
+
+ private
+ # Extend the template class instance with our controller's helper module.
+ def initialize_template_class_with_helper(assigns)
+ returning(template = initialize_template_class_without_helper(assigns)) do
+ template.extend self.class.master_helper_module
+ end
+ end
+ end
+end
View
19 vendor/rails/actionmailer/lib/action_mailer/mail_helper.rb
@@ -0,0 +1,19 @@
+require 'text/format'
+
+module MailHelper
+ # Uses Text::Format to take the text and format it, indented two spaces for
+ # each line, and wrapped at 72 columns.
+ def block_format(text)
+ formatted = text.split(/\n\r\n/).collect { |paragraph|
+ Text::Format.new(
+ :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
+end
View
110 vendor/rails/actionmailer/lib/action_mailer/part.rb
@@ -0,0 +1,110 @@
+require 'action_mailer/adv_attr_accessor'
+require 'action_mailer/part_container'
+require 'action_mailer/utils'
+
+module ActionMailer
+ # Represents a subpart of an email message. It shares many similar
+ # attributes of ActionMailer::Base. Although you can create parts manually
+ # and add them to the #parts list of the mailer, it is easier
+ # to use the helper methods in ActionMailer::PartContainer.
+ class Part
+ include ActionMailer::AdvAttrAccessor
+ include ActionMailer::PartContainer
+
+ # Represents the body of the part, as a string. This should not be a
+ # Hash (like ActionMailer::Base), but if you want a template to be rendered
+ # into the body of a subpart you can do it with the mailer's #render method
+ # and assign the result here.
+ adv_attr_accessor :body
+
+ # Specify the charset for this subpart. By default, it will be the charset
+ # of the containing part or mailer.
+ adv_attr_accessor :charset
+
+ # The content disposition of this part, typically either "inline" or
+ # "attachment".
+ adv_attr_accessor :content_disposition
+
+ # The content type of the part.
+ adv_attr_accessor :content_type
+
+ # The filename to use for this subpart (usually for attachments).
+ adv_attr_accessor :filename
+
+ # Accessor for specifying additional headers to include with this part.
+ adv_attr_accessor :headers
+
+ # The transfer encoding to use for this subpart, like "base64" or
+ # "quoted-printable".
+ adv_attr_accessor :transfer_encoding
+
+ # Create a new part from the given +params+ hash. The valid params keys
+ # correspond to the accessors.
+ def initialize(params)
+ @content_type = params[:content_type]
+ @content_disposition = params[:disposition] || "inline"
+ @charset = params[:charset]
+ @body = params[:body]
+ @filename = params[:filename]
+ @transfer_encoding = params[:transfer_encoding] || "quoted-printable"
+ @headers = params[:headers] || {}
+ @parts = []
+ end
+
+ # Convert the part to a mail object which can be included in the parts
+ # list of another mail object.
+ def to_mail(defaults)
+ part = TMail::Mail.new
+
+ real_content_type, ctype_attrs = parse_content_type(defaults)
+
+ if @parts.empty?
+ part.content_transfer_encoding = transfer_encoding || "quoted-printable"
+ case (transfer_encoding || "").downcase
+ when "base64" then
+ part.body = TMail::Base64.folding_encode(body)
+ when "quoted-printable"
+ part.body = [Utils.normalize_new_lines(body)].pack("M*")
+ else
+ part.body = body
+ end
+
+ # Always set the content_type after setting the body and or parts!
+ # Also don't set filename and name when there is none (like in
+ # non-attachment parts)
+ if content_disposition == "attachment"
+ ctype_attrs.delete "charset"
+ part.set_content_type(real_content_type, nil,
+ squish("name" => filename).merge(ctype_attrs))
+ part.set_content_disposition(content_disposition,
+ squish("filename" => filename).merge(ctype_attrs))
+ else
+ part.set_content_type(real_content_type, nil, ctype_attrs)
+ part.set_content_disposition(content_disposition)
+ end
+ else
+ if String === body
+ @parts.unshift Part.new(:charset => charset, :body => @body, :content_type => 'text/plain')
+ @body = nil
+ end
+
+ @parts.each do |p|
+ prt = (TMail::Mail === p ? p : p.to_mail(defaults))
+ part.parts << prt
+ end
+
+ part.set_content_type(real_content_type, nil, ctype_attrs) if real_content_type =~ /multipart/
+ end
+
+ headers.each { |k,v| part[k] = v }
+
+ part
+ end
+
+ private
+
+ def squish(values={})
+ values.delete_if { |k,v| v.nil? }
+ end
+ end
+end
View
51 vendor/rails/actionmailer/lib/action_mailer/part_container.rb
@@ -0,0 +1,51 @@
+module ActionMailer
+ # Accessors and helpers that ActionMailer::Base and ActionMailer::Part have
+ # in common. Using these helpers you can easily add subparts or attachments
+ # to your message:
+ #
+ # def my_mail_message(...)
+ # ...
+ # part "text/plain" do |p|
+ # p.body "hello, world"
+ # p.transfer_encoding "base64"
+ # end
+ #
+ # attachment "image/jpg" do |a|
+ # a.body = File.read("hello.jpg")
+ # a.filename = "hello.jpg"
+ # end
+ # end
+ module PartContainer
+ # The list of subparts of this container
+ attr_reader :parts
+
+ # Add a part to a multipart message, with the given content-type. The
+ # part itself is yielded to the block so that other properties (charset,
+ # body, headers, etc.) can be set on it.
+ def part(params)
+ params = {:content_type => params} if String === params
+ part = Part.new(params)
+ yield part if block_given?
+ @parts << part
+ end
+
+ # Add an attachment to a multipart message. This is simply a part with the
+ # content-disposition set to "attachment".
+ def attachment(params, &block)
+ params = { :content_type => params } if String === params
+ params = { :disposition => "attachment",
+ :transfer_encoding => "base64" }.merge(params)
+ part(params, &block)
+ end
+
+ private
+
+ def parse_content_type(defaults=nil)
+ return [defaults && defaults.content_type, {}] if content_type.blank?
+ ctype, *attrs = content_type.split(/;\s*/)
+ attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h }
+ [ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)]
+ end
+
+ end
+end
View
59 vendor/rails/actionmailer/lib/action_mailer/quoting.rb
@@ -0,0 +1,59 @@
+module ActionMailer
+ module Quoting #:nodoc:
+ # Convert the given text into quoted printable format, with an instruction
+ # that the text be eventually interpreted in the given charset.
+ def quoted_printable(text, charset)
+ text = text.gsub( /[^a-z ]/i ) { quoted_printable_encode($&) }.
+ gsub( / /, "_" )
+ "=?#{charset}?Q?#{text}?="
+ end
+
+ # Convert the given character to quoted printable format, taking into
+ # account multi-byte characters (if executing with $KCODE="u", for instance)
+ def quoted_printable_encode(character)
+ result = ""
+ character.each_byte { |b| result << "=%02x" % b }
+ result
+ end
+
+ # A quick-and-dirty regexp for determining whether a string contains any
+ # characters that need escaping.
+ if !defined?(CHARS_NEEDING_QUOTING)
+ CHARS_NEEDING_QUOTING = /[\000-\011\013\014\016-\037\177-\377]/
+ end
+
+ # Quote the given text if it contains any "illegal" characters
+ def quote_if_necessary(text, charset)
+ (text =~ CHARS_NEEDING_QUOTING) ?
+ quoted_printable(text, charset) :
+ text
+ end
+
+ # Quote any of the given strings if they contain any "illegal" characters
+ def quote_any_if_necessary(charset, *args)
+ args.map { |v| quote_if_necessary(v, charset) }
+ end
+
+ # Quote the given address if it needs to be. The address may be a
+ # regular email address, or it can be a phrase followed by an address in
+ # brackets. The phrase is the only part that will be quoted, and only if
+ # it needs to be. This allows extended characters to be used in the
+ # "to", "from", "cc", and "bcc" headers.
+ def quote_address_if_necessary(address, charset)
+ if Array === address
+ address.map { |a| quote_address_if_necessary(a, charset) }
+ elsif address =~ /^(\S.*)\s+(<.*>)$/
+ address = $2
+ phrase = quote_if_necessary($1.gsub(/^['"](.*)['"]$/, '\1'), charset)
+ "\"#{phrase}\" #{address}"
+ else
+ address
+ end
+ end
+
+ # Quote any of the given addresses, if they need to be.
+ def quote_any_address_if_necessary(charset, *args)
+ args.map { |v| quote_address_if_necessary(v, charset) }
+ end
+ end
+end
View
59 vendor/rails/actionmailer/lib/action_mailer/test_case.rb
@@ -0,0 +1,59 @@
+require 'active_support/test_case'
+
+module ActionMailer
+ class NonInferrableMailerError < ::StandardError
+ def initialize(name)
+ super "Unable to determine the mailer to test from #{name}. " +
+ "You'll need to specify it using tests YourMailer in your " +
+ "test case definition"
+ end
+ end
+ # New Test Super class for forward compatibility.
+ # To override
+ class TestCase < ActiveSupport::TestCase
+ include ActionMailer::Quoting
+
+ class << self
+ def tests(mailer)
+ write_inheritable_attribute(:mailer_class, mailer)
+ end
+
+ def mailer_class
+ if mailer = read_inheritable_attribute(:mailer_class)
+ mailer
+ else
+ tests determine_default_mailer(name)
+ end
+ end
+
+ def determine_default_mailer(name)
+ name.sub(/Test$/, '').constantize
+ rescue NameError => e
+ raise NonInferrableMailerError.new(name)
+ end
+ end
+
+ def setup
+ ActionMailer::Base.delivery_method = :test
+ ActionMailer::Base.perform_deliveries = true
+ ActionMailer::Base.deliveries = []
+
+ @expected = TMail::Mail.new
+ @expected.set_content_type "text", "plain", { "charset" => charset }
+ @expected.mime_version = '1.0'
+ end
+
+ private
+ def charset
+ "utf-8"
+ end
+
+ def encode(subject)
+ quoted_printable(subject, charset)
+ end
+
+ def read_fixture(action)
+ IO.readlines(File.join(RAILS_ROOT, 'test', 'fixtures', self.class.mailer_class.name.underscore, action))
+ end
+ end
+end
View
67 vendor/rails/actionmailer/lib/action_mailer/test_helper.rb
@@ -0,0 +1,67 @@
+module ActionMailer
+ module TestHelper
+ # Asserts that the number of emails sent matches the given number.
+ #
+ # def test_emails
+ # assert_emails 0
+ # ContactMailer.deliver_contact
+ # assert_emails 1
+ # ContactMailer.deliver_contact
+ # assert_emails 2
+ # end
+ #
+ # If a block is passed, that block should cause the specified number of emails to be sent.
+ #
+ # def test_emails_again
+ # assert_emails 1 do
+ # ContactMailer.deliver_contact
+ # end
+ #
+ # assert_emails 2 do
+ # ContactMailer.deliver_contact
+ # ContactMailer.deliver_contact
+ # end
+ # end
+ def assert_emails(number)
+ if block_given?
+ original_count = ActionMailer::Base.deliveries.size
+ yield
+ new_count = ActionMailer::Base.deliveries.size
+ assert_equal original_count + number, new_count, "#{number} emails expected, but #{new_count - original_count} were sent"
+ else
+ assert_equal number, ActionMailer::Base.deliveries.size
+ end
+ end
+
+ # Assert that no emails have been sent.
+ #
+ # def test_emails
+ # assert_no_emails
+ # ContactMailer.deliver_contact
+ # assert_emails 1
+ # end
+ #
+ # If a block is passed, that block should not cause any emails to be sent.
+ #
+ # def test_emails_again
+ # assert_no_emails do
+ # # No emails should be sent from this block
+ # end
+ # end
+ #
+ # Note: This assertion is simply a shortcut for:
+ #
+ # assert_emails 0
+ def assert_no_emails(&block)
+ assert_emails 0, &block
+ end
+ end
+end
+
+module Test
+ module Unit
+ class TestCase
+ include ActionMailer::TestHelper
+ end
+ end
+end
View
8 vendor/rails/actionmailer/lib/action_mailer/utils.rb
@@ -0,0 +1,8 @@
+module ActionMailer
+ module Utils #:nodoc:
+ def normalize_new_lines(text)
+ text.to_s.gsub(/\r\n?/, "\n")
+ end
+ module_function :normalize_new_lines
+ end
+end
View
14 vendor/rails/actionmailer/lib/action_mailer/vendor.rb
@@ -0,0 +1,14 @@
+# Prefer gems to the bundled libs.
+require 'rubygems'
+
+begin
+ gem 'tmail', '~> 1.1.0'
+rescue Gem::LoadError
+ $:.unshift "#{File.dirname(__FILE__)}/vendor/tmail-1.1.0"
+end
+
+begin
+ gem 'text-format', '>= 0.6.3'
+rescue Gem::LoadError
+ $:.unshift "#{File.dirname(__FILE__)}/vendor/text-format-0.6.3"
+end
View
1,466 vendor/rails/actionmailer/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb
@@ -0,0 +1,1466 @@
+#--
+# Text::Format for Ruby
+# Version 0.63
+#
+# Copyright (c) 2002 - 2003 Austin Ziegler
+#
+# $Id: format.rb,v 1.1.1.1 2004/10/14 11:59:57 webster132 Exp $
+#
+# ==========================================================================
+# Revision History ::
+# YYYY.MM.DD Change ID Developer
+# Description
+# --------------------------------------------------------------------------
+# 2002.10.18 Austin Ziegler
+# Fixed a minor problem with tabs not being counted. Changed
+# abbreviations from Hash to Array to better suit Ruby's
+# capabilities. Fixed problems with the way that Array arguments
+# are handled in calls to the major object types, excepting in
+# Text::Format#expand and Text::Format#unexpand (these will
+# probably need to be fixed).
+# 2002.10.30 Austin Ziegler
+# Fixed the ordering of the <=> for binary tests. Fixed
+# Text::Format#expand and Text::Format#unexpand to handle array
+# arguments better.
+# 2003.01.24 Austin Ziegler
+# Fixed a problem with Text::Format::RIGHT_FILL handling where a
+# single word is larger than #columns. Removed Comparable
+# capabilities (<=> doesn't make sense; == does). Added Symbol
+# equivalents for the Hash initialization. Hash initialization has
+# been modified so that values are set as follows (Symbols are
+# highest priority; strings are middle; defaults are lowest):
+# @columns = arg[:columns] || arg['columns'] || @columns
+# Added #hard_margins, #split_rules, #hyphenator, and #split_words.
+# 2003.02.07 Austin Ziegler
+# Fixed the installer for proper case-sensitive handling.
+# 2003.03.28 Austin Ziegler
+# Added the ability for a hyphenator to receive the formatter
+# object. Fixed a bug for strings matching /\A\s*\Z/ failing
+# entirely. Fixed a test case failing under 1.6.8.
+# 2003.04.04 Austin Ziegler
+# Handle the case of hyphenators returning nil for first/rest.
+# 2003.09.17 Austin Ziegler
+# Fixed a problem where #paragraphs(" ") was raising
+# NoMethodError.
+#
+# ==========================================================================
+#++
+
+module Text #:nodoc:
+ # Text::Format for Ruby is copyright 2002 - 2005 by Austin Ziegler. It
+ # is available under Ruby's licence, the Perl Artistic licence, or the
+ # GNU GPL version 2 (or at your option, any later version). As a
+ # special exception, for use with official Rails (provided by the
+ # rubyonrails.org development team) and any project created with
+ # official Rails, the following alternative MIT-style licence may be
+ # used:
+ #
+ # == Text::Format Licence for Rails and Rails Applications
+ # Permission is hereby granted, free of charge, to any person
+ # obtaining a copy of this software and associated documentation files
+ # (the "Software"), to deal in the Software without restriction,
+ # including without limitation the rights to use, copy, modify, merge,
+ # publish, distribute, sublicense, and/or sell copies of the Software,
+ # and to permit persons to whom the Software is furnished to do so,
+ # subject to the following conditions:
+ #
+ # * The names of its contributors may not be used to endorse or
+ # promote products derived from this software without specific prior
+ # written permission.
+ #
+ # The above copyright notice and this permission notice shall be
+ # included in all copies or substantial portions of the Software.
+ #
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ # SOFTWARE.
+ class Format
+ VERSION = '0.63'
+
+ # Local abbreviations. More can be added with Text::Format.abbreviations
+ ABBREV = [ 'Mr', 'Mrs', 'Ms', 'Jr', 'Sr' ]
+
+ # Formatting values
+ LEFT_ALIGN = 0
+ RIGHT_ALIGN = 1
+ RIGHT_FILL = 2
+ JUSTIFY = 3
+
+ # Word split modes (only applies when #hard_margins is true).
+ SPLIT_FIXED = 1
+ SPLIT_CONTINUATION = 2
+ SPLIT_HYPHENATION = 4
+ SPLIT_CONTINUATION_FIXED = SPLIT_CONTINUATION | SPLIT_FIXED
+ SPLIT_HYPHENATION_FIXED = SPLIT_HYPHENATION | SPLIT_FIXED
+ SPLIT_HYPHENATION_CONTINUATION = SPLIT_HYPHENATION | SPLIT_CONTINUATION
+ SPLIT_ALL = SPLIT_HYPHENATION | SPLIT_CONTINUATION | SPLIT_FIXED
+
+ # Words forcibly split by Text::Format will be stored as split words.
+ # This class represents a word forcibly split.
+ class SplitWord
+ # The word that was split.
+ attr_reader :word
+ # The first part of the word that was split.
+ attr_reader :first
+ # The remainder of the word that was split.
+ attr_reader :rest
+
+ def initialize(word, first, rest) #:nodoc:
+ @word = word
+ @first = first
+ @rest = rest
+ end
+ end
+
+ private
+ LEQ_RE = /[.?!]['"]?$/
+
+ def brk_re(i) #:nodoc:
+ %r/((?:\S+\s+){#{i}})(.+)/
+ end
+
+ def posint(p) #:nodoc:
+ p.to_i.abs
+ end
+
+ public
+ # Compares two Text::Format objects. All settings of the objects are
+ # compared *except* #hyphenator. Generated results (e.g., #split_words)
+ # are not compared, either.
+ def ==(o)
+ (@text == o.text) &&
+ (@columns == o.columns) &&
+ (@left_margin == o.left_margin) &&
+ (@right_margin == o.right_margin) &&
+ (@hard_margins == o.hard_margins) &&
+ (@split_rules == o.split_rules) &&
+ (@first_indent == o.first_indent) &&
+ (@body_indent == o.body_indent) &&
+ (@tag_text == o.tag_text) &&
+ (@tabstop == o.tabstop) &&
+ (@format_style == o.format_style) &&
+ (@extra_space == o.extra_space) &&
+ (@tag_paragraph == o.tag_paragraph) &&
+ (@nobreak == o.nobreak) &&
+ (@abbreviations == o.abbreviations) &&
+ (@nobreak_regex == o.nobreak_regex)
+ end
+
+ # The text to be manipulated. Note that value is optional, but if the
+ # formatting functions are called without values, this text is what will
+ # be formatted.
+ #
+ # *Default*:: <tt>[]</tt>
+ # <b>Used in</b>:: All methods
+ attr_accessor :text
+
+ # The total width of the format area. The margins, indentation, and text
+ # are formatted into this space.
+ #
+ # COLUMNS
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin indent text is formatted into here right margin
+ #
+ # *Default*:: <tt>72</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ attr_reader :columns
+
+ # The total width of the format area. The margins, indentation, and text
+ # are formatted into this space. The value provided is silently
+ # converted to a positive integer.
+ #
+ # COLUMNS
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin indent text is formatted into here right margin
+ #
+ # *Default*:: <tt>72</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ def columns=(c)
+ @columns = posint(c)
+ end
+
+ # The number of spaces used for the left margin.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # LEFT MARGIN indent text is formatted into here right margin
+ #
+ # *Default*:: <tt>0</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ attr_reader :left_margin
+
+ # The number of spaces used for the left margin. The value provided is
+ # silently converted to a positive integer value.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # LEFT MARGIN indent text is formatted into here right margin
+ #
+ # *Default*:: <tt>0</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ def left_margin=(left)
+ @left_margin = posint(left)
+ end
+
+ # The number of spaces used for the right margin.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin indent text is formatted into here RIGHT MARGIN
+ #
+ # *Default*:: <tt>0</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ attr_reader :right_margin
+
+ # The number of spaces used for the right margin. The value provided is
+ # silently converted to a positive integer value.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin indent text is formatted into here RIGHT MARGIN
+ #
+ # *Default*:: <tt>0</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>,
+ # <tt>#center</tt>
+ def right_margin=(r)
+ @right_margin = posint(r)
+ end
+
+ # The number of spaces to indent the first line of a paragraph.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin INDENT text is formatted into here right margin
+ #
+ # *Default*:: <tt>4</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>
+ attr_reader :first_indent
+
+ # The number of spaces to indent the first line of a paragraph. The
+ # value provided is silently converted to a positive integer value.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin INDENT text is formatted into here right margin
+ #
+ # *Default*:: <tt>4</tt>
+ # <b>Used in</b>:: <tt>#format</tt>, <tt>#paragraphs</tt>
+ def first_indent=(f)
+ @first_indent = posint(f)
+ end
+
+ # The number of spaces to indent all lines after the first line of a
+ # paragraph.
+ #
+ # columns
+ # <-------------------------------------------------------------->
+ # <-----------><------><---------------------------><------------>
+ # left margin INDENT text is formatted into here right margin
+ #
+ # *Default*:: <tt>0</tt>
+ # <b>Used in</b>:: <tt