Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Nov 24, 2004
0 parents commit db045db
Show file tree
Hide file tree
Showing 296 changed files with 30,881 additions and 0 deletions.
19 changes: 19 additions & 0 deletions actionmailer/CHANGELOG
@@ -0,0 +1,19 @@
*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. [bitsweat]

* 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
21 changes: 21 additions & 0 deletions actionmailer/MIT-LICENSE
@@ -0,0 +1,21 @@
Copyright (c) 2004 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.

102 changes: 102 additions & 0 deletions actionmailer/README
@@ -0,0 +1,102 @@
= Action Mailer -- Easy email delivery and testing

Action Mailer is framework for designing email-service layers. These layers
are used to consolidate code for sending out forgotten passwords, welcoming
wishes on signup, invoices for billing, and any other use case that requires
a written notification to either a person or another system.

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"
@sent_on = Time.local(2004, 12, 12)

@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 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!


== 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://actionmailer.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.

For other information, feel free to ask on the ruby-talk mailing list (which
is mirrored to comp.lang.ruby) or contact mailto:david@loudthinking.com.
107 changes: 107 additions & 0 deletions actionmailer/Rakefile
@@ -0,0 +1,107 @@
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'

PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
PKG_NAME = 'actionmailer'
PKG_VERSION = '0.4.0' + PKG_BUILD
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"

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
}


# Genereate 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 --main README'
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://actionmailer.rubyonrails.org"

s.add_dependency('actionpack', '>= 0.9.5')

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?( "CVS" ) }
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "CVS" ) }
end

Rake::GemPackageTask.new(spec) do |p|
p.gem_spec = spec
p.need_tar = true
p.need_zip = true
end


# Publish beta gem
desc "Publish the API documentation"
task :pgem => [:package] do
Rake::SshFilePublisher.new("davidhh@one.textdrive.com", "domains/rubyonrails.org/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
end

# Publish documentation
desc "Publish the API documentation"
task :pdoc => [:rdoc] do
Rake::SshDirPublisher.new("davidhh@one.textdrive.com", "domains/rubyonrails.org/am", "doc").upload
end

desc "Publish to RubyForge"
task :rubyforge do
Rake::RubyForgePublisher.new('actionmailer', 'webster132').upload
end


desc "Count lines in the main rake file"
task :lines do
lines = 0
codelines = 0
Dir.foreach("lib/action_mailer") { |file_name|
next unless file_name =~ /.*rb/

f = File.open("lib/action_mailer/" + file_name)

while line = f.gets
lines += 1
next if line =~ /^\s*$/
next if line =~ /^\s*#/
codelines += 1
end
}
puts "Lines #{lines}, LOC #{codelines}"
end
61 changes: 61 additions & 0 deletions actionmailer/install.rb
@@ -0,0 +1,61 @@
require 'rbconfig'
require 'find'
require 'ftools'

include Config

# this was adapted from rdoc's install.rb by ways 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

makedirs = %w{ action_mailer/vendor action_mailer/vendor/text action_mailer/vendor/tmail }
makedirs.each {|f| File::makedirs(File.join($sitedir, *f.split(/\//)))}

# deprecated files that should be removed
# deprecated = %w{ }

# files to install in library path
files = %w-
action_mailer.rb
action_mailer/base.rb
action_mailer/mail_helper.rb
action_mailer/vendor/text/format.rb
action_mailer/vendor/tmail.rb
action_mailer/vendor/tmail/address.rb
action_mailer/vendor/tmail/base64.rb
action_mailer/vendor/tmail/config.rb
action_mailer/vendor/tmail/encode.rb
action_mailer/vendor/tmail/facade.rb
action_mailer/vendor/tmail/header.rb
action_mailer/vendor/tmail/info.rb
action_mailer/vendor/tmail/loader.rb
action_mailer/vendor/tmail/mail.rb
action_mailer/vendor/tmail/mailbox.rb
action_mailer/vendor/tmail/mbox.rb
action_mailer/vendor/tmail/net.rb
action_mailer/vendor/tmail/obsolete.rb
action_mailer/vendor/tmail/parser.rb
action_mailer/vendor/tmail/port.rb
action_mailer/vendor/tmail/scanner.rb
action_mailer/vendor/tmail/scanner_r.rb
action_mailer/vendor/tmail/stringio.rb
action_mailer/vendor/tmail/tmail.rb
action_mailer/vendor/tmail/utils.rb
-

# the acual gruntwork
Dir.chdir("lib")
# File::safe_unlink *deprecated.collect{|f| File.join($sitedir, f.split(/\//))}
files.each {|f|
File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
}
43 changes: 43 additions & 0 deletions actionmailer/lib/action_mailer.rb
@@ -0,0 +1,43 @@
#--
# Copyright (c) 2004 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.
#++

begin
require 'action_controller'
rescue LoadError
# Action Pack is not already available, try RubyGems
require 'rubygems'
require_gem 'actionpack', '>= 0.9.0'
end

$:.unshift(File.dirname(__FILE__) + "/action_mailer/vendor/")

require 'action_mailer/base'
require 'action_mailer/mail_helper'
require 'action_mailer/vendor/tmail'
require 'net/smtp'

ActionView::Base.class_eval { include MailHelper }

old_verbose, $VERBOSE = $VERBOSE, nil
TMail::Encoder.const_set("MAX_LINE_LEN", 200)
$VERBOSE = old_verbose

21 comments on commit db045db

@paulmillr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epic!

@resure
Copy link

@resure resure commented on db045db Jan 26, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Root commit)

@courthead
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool.

@chenyun
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@cburnette
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this commit looks like it might have legs. I think I'll follow it.

@msroot
Copy link

@msroot msroot commented on db045db Aug 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

epic!

@dmitry
Copy link
Contributor

@dmitry dmitry commented on db045db Feb 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anniversary of 10 years will be in a half year. Seems cool!

@rorhug
Copy link

@rorhug rorhug commented on db045db May 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Twitter, GitHub, Yammer, Scribd, Groupon, Shopify, Hulu, Basecamp...

@briandiaz
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is one of the greatest in web development.

Thanks @dhh

@cschell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy Birthday!!!

@simi
Copy link
Contributor

@simi simi commented on db045db Nov 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎊 🎂

@dmitry
Copy link
Contributor

@dmitry dmitry commented on db045db Nov 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhh should definitely comment this commit today!

@dhh
Copy link
Member Author

@dhh dhh commented on db045db Nov 24, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the nice comments! We've all built an amazing community together. Actual development for Rails started in the summer of 2003, but back then I was on CVS, and we didn't carry that history over when we switched to SVN. Wish we did!

@pedrolopez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still today this commit seems awesome. I started to follow early RoR development to get deep understanding of the evolution of the framework itself and it is fabulous. It's a shame the very beginning CVS commit history is lost. Thanks @dhh

@steverob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow 👍

@altuzar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/ Feels like visiting Graceland \o/

@ArthurLuisLimaBender
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, bro!

@onesup
Copy link

@onesup onesup commented on db045db Jun 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

성지순례 왔습니다. 저와 제 주위 모든 분들 모두 건강하게 살게 해 주세요~~~

@okyanusoz
Copy link

@okyanusoz okyanusoz commented on db045db Aug 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still legendary in 2022

@jpheos
Copy link

@jpheos jpheos commented on db045db Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, a large part of my code relies on this commit :-)

@northeastprince
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's amazing how much has changed and how much has stayed the same.

Please sign in to comment.