delayed_mailhopper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +35 -0
- data/Rakefile +40 -0
- data/app/models/delayed_mailhopper/email.rb +13 -0
- data/app/models/delayed_mailhopper/send_job.rb +16 -0
- data/config/routes.rb +2 -0
- data/lib/delayed_mailhopper.rb +9 -0
- data/lib/delayed_mailhopper/engine.rb +4 -0
- data/lib/delayed_mailhopper/version.rb +3 -0
- data/lib/tasks/delayed_mailhopper_tasks.rake +4 -0
- data/test/delayed_mailhopper_test.rb +7 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/sample_mailer.rb +8 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/sample_mailer/hello.text.erb +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +51 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mailhopper.rb +3 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110804223859_create_emails.rb +21 -0
- data/test/dummy/db/migrate/20110804224806_create_delayed_jobs.rb +21 -0
- data/test/dummy/db/schema.rb +43 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +18 -0
- data/test/dummy/log/test.log +1571 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/delayed_job +5 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/test_helper.rb +14 -0
- data/test/unit/email_test.rb +67 -0
- metadata +235 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
+
require File.expand_path('../../config/boot', __FILE__)
|
6
|
+
require 'rails/commands'
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
require "shoulda/rails"
|
7
|
+
|
8
|
+
Rails.backtrace_cleaner.remove_silencers!
|
9
|
+
|
10
|
+
# Load support files
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
+
|
13
|
+
# Run any available migration
|
14
|
+
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class EmailTest < ActiveSupport::TestCase
|
4
|
+
context "An email" do
|
5
|
+
setup do
|
6
|
+
@email = DelayedMailhopper::Email.new
|
7
|
+
end
|
8
|
+
|
9
|
+
should "require a from address" do
|
10
|
+
assert !@email.valid?
|
11
|
+
@email.from_address = 'user@example.com'
|
12
|
+
assert @email.valid?
|
13
|
+
end
|
14
|
+
|
15
|
+
context "generated by a mailer" do
|
16
|
+
setup do
|
17
|
+
@headers = {
|
18
|
+
:from => 'from@example.com',
|
19
|
+
:to => 'to@example.com',
|
20
|
+
:cc => 'cc@example.com',
|
21
|
+
:bcc => 'bcc@example.com',
|
22
|
+
:reply_to => 'reply_to@example.com',
|
23
|
+
:subject => 'Hiya!'
|
24
|
+
}
|
25
|
+
@content = 'Papaya'
|
26
|
+
SampleMailer.hello(@headers, @content).deliver
|
27
|
+
end
|
28
|
+
|
29
|
+
should "match the intended headers and content" do
|
30
|
+
email = DelayedMailhopper::Email.first
|
31
|
+
assert_equal email.from_address, @headers[:from]
|
32
|
+
assert_equal email.to_address, @headers[:to]
|
33
|
+
assert_equal email.cc_address, @headers[:cc]
|
34
|
+
assert_equal email.bcc_address, @headers[:bcc]
|
35
|
+
assert_equal email.reply_to_address, @headers[:reply_to]
|
36
|
+
assert_equal email.subject, @headers[:subject]
|
37
|
+
|
38
|
+
# Email content will include headers as well as content
|
39
|
+
assert email.content.include?(@content)
|
40
|
+
|
41
|
+
assert email.sent_at.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
should "be queued as a delayed job" do
|
45
|
+
assert_equal DelayedMailhopper::Email.count, 1
|
46
|
+
assert_equal Delayed::Job.count, 1
|
47
|
+
end
|
48
|
+
|
49
|
+
should "be delivered via DelayedJob" do
|
50
|
+
email = DelayedMailhopper::Email.first
|
51
|
+
assert email.sent_at.nil?
|
52
|
+
|
53
|
+
Delayed::Job.first.invoke_job
|
54
|
+
|
55
|
+
email.reload
|
56
|
+
assert !email.sent_at.nil?
|
57
|
+
end
|
58
|
+
|
59
|
+
should "be marked as sent once delivered" do
|
60
|
+
email = DelayedMailhopper::Email.first
|
61
|
+
assert email.sent_at.nil?
|
62
|
+
email.send!
|
63
|
+
assert !email.sent_at.nil?
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: delayed_mailhopper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Dan Gebhardt
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-08-05 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :runtime
|
23
|
+
name: rails
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15424111
|
31
|
+
segments:
|
32
|
+
- 3
|
33
|
+
- 1
|
34
|
+
- 0
|
35
|
+
- rc
|
36
|
+
- 5
|
37
|
+
version: 3.1.0.rc5
|
38
|
+
requirement: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
type: :runtime
|
41
|
+
name: mailhopper
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 29
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
- 0
|
52
|
+
- 1
|
53
|
+
version: 0.0.1
|
54
|
+
requirement: *id002
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
type: :runtime
|
57
|
+
name: delayed_job
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
requirement: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :development
|
71
|
+
name: sqlite3
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirement: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
type: :development
|
85
|
+
name: shoulda
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirement: *id005
|
97
|
+
description: DelayedMailhopper extends Mailhopper to deliver emails asynchronously with DelayedJob.
|
98
|
+
email:
|
99
|
+
- support@cerebris.com
|
100
|
+
executables: []
|
101
|
+
|
102
|
+
extensions: []
|
103
|
+
|
104
|
+
extra_rdoc_files: []
|
105
|
+
|
106
|
+
files:
|
107
|
+
- app/models/delayed_mailhopper/email.rb
|
108
|
+
- app/models/delayed_mailhopper/send_job.rb
|
109
|
+
- config/routes.rb
|
110
|
+
- lib/delayed_mailhopper/engine.rb
|
111
|
+
- lib/delayed_mailhopper/version.rb
|
112
|
+
- lib/delayed_mailhopper.rb
|
113
|
+
- lib/tasks/delayed_mailhopper_tasks.rake
|
114
|
+
- MIT-LICENSE
|
115
|
+
- Rakefile
|
116
|
+
- README.rdoc
|
117
|
+
- test/delayed_mailhopper_test.rb
|
118
|
+
- test/dummy/app/assets/javascripts/application.js
|
119
|
+
- test/dummy/app/assets/stylesheets/application.css
|
120
|
+
- test/dummy/app/controllers/application_controller.rb
|
121
|
+
- test/dummy/app/helpers/application_helper.rb
|
122
|
+
- test/dummy/app/mailers/sample_mailer.rb
|
123
|
+
- test/dummy/app/views/layouts/application.html.erb
|
124
|
+
- test/dummy/app/views/sample_mailer/hello.text.erb
|
125
|
+
- test/dummy/config/application.rb
|
126
|
+
- test/dummy/config/boot.rb
|
127
|
+
- test/dummy/config/database.yml
|
128
|
+
- test/dummy/config/environment.rb
|
129
|
+
- test/dummy/config/environments/development.rb
|
130
|
+
- test/dummy/config/environments/production.rb
|
131
|
+
- test/dummy/config/environments/test.rb
|
132
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
133
|
+
- test/dummy/config/initializers/inflections.rb
|
134
|
+
- test/dummy/config/initializers/mailhopper.rb
|
135
|
+
- test/dummy/config/initializers/mime_types.rb
|
136
|
+
- test/dummy/config/initializers/secret_token.rb
|
137
|
+
- test/dummy/config/initializers/session_store.rb
|
138
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
139
|
+
- test/dummy/config/locales/en.yml
|
140
|
+
- test/dummy/config/routes.rb
|
141
|
+
- test/dummy/config.ru
|
142
|
+
- test/dummy/db/development.sqlite3
|
143
|
+
- test/dummy/db/migrate/20110804223859_create_emails.rb
|
144
|
+
- test/dummy/db/migrate/20110804224806_create_delayed_jobs.rb
|
145
|
+
- test/dummy/db/schema.rb
|
146
|
+
- test/dummy/db/test.sqlite3
|
147
|
+
- test/dummy/log/development.log
|
148
|
+
- test/dummy/log/test.log
|
149
|
+
- test/dummy/public/404.html
|
150
|
+
- test/dummy/public/422.html
|
151
|
+
- test/dummy/public/500.html
|
152
|
+
- test/dummy/public/favicon.ico
|
153
|
+
- test/dummy/Rakefile
|
154
|
+
- test/dummy/script/delayed_job
|
155
|
+
- test/dummy/script/rails
|
156
|
+
- test/integration/navigation_test.rb
|
157
|
+
- test/test_helper.rb
|
158
|
+
- test/unit/email_test.rb
|
159
|
+
has_rdoc: true
|
160
|
+
homepage: https://github.com/cerebris/delayed_mailhopper
|
161
|
+
licenses: []
|
162
|
+
|
163
|
+
post_install_message:
|
164
|
+
rdoc_options: []
|
165
|
+
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
hash: 3
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
version: "0"
|
177
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
|
+
none: false
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
hash: 3
|
183
|
+
segments:
|
184
|
+
- 0
|
185
|
+
version: "0"
|
186
|
+
requirements: []
|
187
|
+
|
188
|
+
rubyforge_project:
|
189
|
+
rubygems_version: 1.4.2
|
190
|
+
signing_key:
|
191
|
+
specification_version: 3
|
192
|
+
summary: A simple solution that uses ActiveRecord and DelayedJob to queue, deliver and archive emails in Rails apps.
|
193
|
+
test_files:
|
194
|
+
- test/delayed_mailhopper_test.rb
|
195
|
+
- test/dummy/app/assets/javascripts/application.js
|
196
|
+
- test/dummy/app/assets/stylesheets/application.css
|
197
|
+
- test/dummy/app/controllers/application_controller.rb
|
198
|
+
- test/dummy/app/helpers/application_helper.rb
|
199
|
+
- test/dummy/app/mailers/sample_mailer.rb
|
200
|
+
- test/dummy/app/views/layouts/application.html.erb
|
201
|
+
- test/dummy/app/views/sample_mailer/hello.text.erb
|
202
|
+
- test/dummy/config/application.rb
|
203
|
+
- test/dummy/config/boot.rb
|
204
|
+
- test/dummy/config/database.yml
|
205
|
+
- test/dummy/config/environment.rb
|
206
|
+
- test/dummy/config/environments/development.rb
|
207
|
+
- test/dummy/config/environments/production.rb
|
208
|
+
- test/dummy/config/environments/test.rb
|
209
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
210
|
+
- test/dummy/config/initializers/inflections.rb
|
211
|
+
- test/dummy/config/initializers/mailhopper.rb
|
212
|
+
- test/dummy/config/initializers/mime_types.rb
|
213
|
+
- test/dummy/config/initializers/secret_token.rb
|
214
|
+
- test/dummy/config/initializers/session_store.rb
|
215
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
216
|
+
- test/dummy/config/locales/en.yml
|
217
|
+
- test/dummy/config/routes.rb
|
218
|
+
- test/dummy/config.ru
|
219
|
+
- test/dummy/db/development.sqlite3
|
220
|
+
- test/dummy/db/migrate/20110804223859_create_emails.rb
|
221
|
+
- test/dummy/db/migrate/20110804224806_create_delayed_jobs.rb
|
222
|
+
- test/dummy/db/schema.rb
|
223
|
+
- test/dummy/db/test.sqlite3
|
224
|
+
- test/dummy/log/development.log
|
225
|
+
- test/dummy/log/test.log
|
226
|
+
- test/dummy/public/404.html
|
227
|
+
- test/dummy/public/422.html
|
228
|
+
- test/dummy/public/500.html
|
229
|
+
- test/dummy/public/favicon.ico
|
230
|
+
- test/dummy/Rakefile
|
231
|
+
- test/dummy/script/delayed_job
|
232
|
+
- test/dummy/script/rails
|
233
|
+
- test/integration/navigation_test.rb
|
234
|
+
- test/test_helper.rb
|
235
|
+
- test/unit/email_test.rb
|