hello_mail 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
4
+ .rvmrc
5
+ **.swp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in hello_mail.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hello_mail (0.0.1)
5
+ rails (~> 3.0.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ abstract (1.0.0)
11
+ actionmailer (3.0.3)
12
+ actionpack (= 3.0.3)
13
+ mail (~> 2.2.9)
14
+ actionpack (3.0.3)
15
+ activemodel (= 3.0.3)
16
+ activesupport (= 3.0.3)
17
+ builder (~> 2.1.2)
18
+ erubis (~> 2.6.6)
19
+ i18n (~> 0.4)
20
+ rack (~> 1.2.1)
21
+ rack-mount (~> 0.6.13)
22
+ rack-test (~> 0.5.6)
23
+ tzinfo (~> 0.3.23)
24
+ activemodel (3.0.3)
25
+ activesupport (= 3.0.3)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.4)
28
+ activerecord (3.0.3)
29
+ activemodel (= 3.0.3)
30
+ activesupport (= 3.0.3)
31
+ arel (~> 2.0.2)
32
+ tzinfo (~> 0.3.23)
33
+ activeresource (3.0.3)
34
+ activemodel (= 3.0.3)
35
+ activesupport (= 3.0.3)
36
+ activesupport (3.0.3)
37
+ arel (2.0.4)
38
+ builder (2.1.2)
39
+ erubis (2.6.6)
40
+ abstract (>= 1.0.0)
41
+ i18n (0.5.0)
42
+ mail (2.2.11)
43
+ activesupport (>= 2.3.6)
44
+ i18n (~> 0.5.0)
45
+ mime-types (~> 1.16)
46
+ treetop (~> 1.4.8)
47
+ mime-types (1.16)
48
+ polyglot (0.3.1)
49
+ rack (1.2.1)
50
+ rack-mount (0.6.13)
51
+ rack (>= 1.0.0)
52
+ rack-test (0.5.6)
53
+ rack (>= 1.0)
54
+ rails (3.0.3)
55
+ actionmailer (= 3.0.3)
56
+ actionpack (= 3.0.3)
57
+ activerecord (= 3.0.3)
58
+ activeresource (= 3.0.3)
59
+ activesupport (= 3.0.3)
60
+ bundler (~> 1.0)
61
+ railties (= 3.0.3)
62
+ railties (3.0.3)
63
+ actionpack (= 3.0.3)
64
+ activesupport (= 3.0.3)
65
+ rake (>= 0.8.7)
66
+ thor (~> 0.14.4)
67
+ rake (0.8.7)
68
+ thor (0.14.6)
69
+ treetop (1.4.9)
70
+ polyglot (>= 0.3.1)
71
+ tzinfo (0.3.23)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ hello_mail!
78
+ rails (~> 3.0.0)
79
+ rake (~> 0.8)
data/README.markdown ADDED
@@ -0,0 +1,45 @@
1
+ # Hello Mail
2
+
3
+ So I was tired of doing different stuff to test email configuration on
4
+ my many environments so I came up with this simple Rake task to send
5
+ me a test email.
6
+
7
+ ## Installation
8
+
9
+ ### Rails 3
10
+
11
+ Include it on your Gemfile
12
+
13
+ gem 'hello_mail'
14
+
15
+ And then run:
16
+
17
+ bundler install
18
+
19
+ ### Other versions of Rails
20
+
21
+ Nope, this gem is just for Rails 3
22
+
23
+ ## Usage
24
+
25
+ Simply run the rake task passing the destination mail address as a
26
+ parameter, for example:
27
+
28
+ rake hello_mail:deliver[david@crowdint.com]
29
+
30
+ If your mail configuration works, you shall receive a message
31
+ immediately.
32
+
33
+ Be careful if you have different environments configured on your server.
34
+ If you run your app in production mode, then you should run the rake
35
+ task as:
36
+
37
+ RAILS_ENV=production rake hello_mail:deliver[david@crowdint.com]
38
+
39
+ That's it!
40
+
41
+ # About the Author
42
+
43
+ [Crowd Interactive](http://www.crowdint.com) is an American web design and development company that happens to work in Colima, Mexico.
44
+ We specialize in building and growing online retail stores. We don’t work with everyone – just companies we believe in. Call us today to see if there’s a fit.
45
+ Find more info [here](http://www.crowdint.com)!
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/test_*.rb'
8
+ test.verbose = true
9
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "hello_mail/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "hello_mail"
7
+ s.version = HelloMail::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["David Padilla"]
10
+ s.email = ["david@crowdint.com"]
11
+ s.homepage = "http://rubygems.org/gems/hello_mail"
12
+ s.summary = %q{Add a rake task to test your mail configuration on Rails 3}
13
+ s.description = %q{Add a rake task to test your mail configuration on Rails 3}
14
+
15
+ s.add_dependency('rails', '~>3.0.0')
16
+ s.add_development_dependency('rake', '~>0.8')
17
+
18
+ s.rubyforge_project = "hello_mail"
19
+
20
+ s.files = `git ls-files`.split("\n")
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+ end
data/lib/hello_mail.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'rails'
2
+ require 'action_mailer'
3
+ require 'mailers/hello_mail_mailer'
4
+ require 'hello_mail/railtie'
@@ -0,0 +1,7 @@
1
+ module HelloMail
2
+ class Railtie < Rails::Railtie
3
+ rake_tasks do
4
+ load File.join(File.dirname(__FILE__), '..', 'rails', 'railties', 'tasks.rake')
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module HelloMail
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ class HelloMailMailer < ActionMailer::Base
2
+ default :from => 'test@test.com'
3
+
4
+ def test_email(to)
5
+ mail(:to => to, :subject => "This is a test email", :body => "Hello Mail!")
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ namespace :hello_mail do
2
+
3
+ desc "Send a test email"
4
+ task :deliver, :to, :needs => :environment do |t, to|
5
+ HelloMailMailer.test_email(to).deliver
6
+ end
7
+
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'bundler/setup'
4
+ require 'hello_mail'
5
+ require 'action_mailer'
6
+
7
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+
3
+ class MailerTest < Test::Unit::TestCase
4
+ def setup
5
+ ActionMailer::Base.delivery_method = :test
6
+ ActionMailer::Base.perform_deliveries = true
7
+ ActionMailer::Base.deliveries = []
8
+
9
+ @expected = Mail::Message.new
10
+ end
11
+
12
+ def test_hello_mail
13
+ result = HelloMailMailer.test_email("test@test.com")
14
+ @expected.to = "test@test.com"
15
+ @expected.subject = "This is a test email"
16
+ @expected.body = "Hello Mail!"
17
+
18
+ assert_equal(@expected.to, result.to)
19
+ assert_equal(@expected.subject, result.subject)
20
+ assert_match(/Hello Mail!/, result.body)
21
+ end
22
+
23
+ def test_delivery
24
+ HelloMailMailer.test_email("test@test.com").deliver
25
+ assert_equal 1, ActionMailer::Base.deliveries.size
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hello_mail
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - David Padilla
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-30 00:00:00 -06:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 27
46
+ segments:
47
+ - 0
48
+ - 8
49
+ version: "0.8"
50
+ type: :development
51
+ version_requirements: *id002
52
+ description: Add a rake task to test your mail configuration on Rails 3
53
+ email:
54
+ - david@crowdint.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - README.markdown
66
+ - Rakefile
67
+ - hello_mail.gemspec
68
+ - lib/hello_mail.rb
69
+ - lib/hello_mail/railtie.rb
70
+ - lib/hello_mail/version.rb
71
+ - lib/mailers/hello_mail_mailer.rb
72
+ - lib/rails/railties/tasks.rake
73
+ - test/test_helper.rb
74
+ - test/unit/test_mailer.rb
75
+ has_rdoc: true
76
+ homepage: http://rubygems.org/gems/hello_mail
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options: []
81
+
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ hash: 3
90
+ segments:
91
+ - 0
92
+ version: "0"
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
102
+ requirements: []
103
+
104
+ rubyforge_project: hello_mail
105
+ rubygems_version: 1.3.7
106
+ signing_key:
107
+ specification_version: 3
108
+ summary: Add a rake task to test your mail configuration on Rails 3
109
+ test_files:
110
+ - test/test_helper.rb
111
+ - test/unit/test_mailer.rb