ar_mailer_revised 0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -0
  3. data/README.md +54 -70
  4. data/ar_mailer_revised.gemspec +7 -2
  5. data/bin/ar_sendmail +2 -7
  6. data/lib/action_mailer/ar_mailer.rb +45 -18
  7. data/lib/ar_mailer_revised.rb +3 -2
  8. data/lib/ar_mailer_revised/email_scaffold.rb +17 -11
  9. data/lib/ar_mailer_revised/helpers/command_line.rb +198 -0
  10. data/lib/ar_mailer_revised/helpers/general.rb +81 -0
  11. data/lib/ar_mailer_revised/mailman.rb +263 -0
  12. data/lib/ar_mailer_revised/version.rb +1 -1
  13. data/lib/generators/ar_mailer_revised/install_generator.rb +37 -0
  14. data/{generators → lib/generators}/ar_mailer_revised/templates/migration.rb +0 -0
  15. data/{generators → lib/generators}/ar_mailer_revised/templates/model.rb +1 -0
  16. data/test/dummy/README.rdoc +28 -0
  17. data/test/dummy/Rakefile +6 -0
  18. data/test/dummy/app/assets/images/.keep +0 -0
  19. data/test/dummy/app/assets/javascripts/application.js +13 -0
  20. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  21. data/test/dummy/app/controllers/application_controller.rb +5 -0
  22. data/test/dummy/app/controllers/concerns/.keep +0 -0
  23. data/test/dummy/app/helpers/application_helper.rb +2 -0
  24. data/test/dummy/app/mailers/.keep +0 -0
  25. data/test/dummy/app/mailers/test_mailer.rb +32 -0
  26. data/test/dummy/app/models/.keep +0 -0
  27. data/test/dummy/app/models/concerns/.keep +0 -0
  28. data/test/dummy/app/models/email.rb +31 -0
  29. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/test/dummy/bin/bundle +3 -0
  31. data/test/dummy/bin/rails +4 -0
  32. data/test/dummy/bin/rake +4 -0
  33. data/test/dummy/config.ru +4 -0
  34. data/test/dummy/config/application.rb +23 -0
  35. data/test/dummy/config/boot.rb +5 -0
  36. data/test/dummy/config/database.yml +25 -0
  37. data/test/dummy/config/environment.rb +5 -0
  38. data/test/dummy/config/environments/development.rb +37 -0
  39. data/test/dummy/config/environments/production.rb +83 -0
  40. data/test/dummy/config/environments/test.rb +34 -0
  41. data/{generators/ar_mailer_revised/templates/initializer.rb → test/dummy/config/initializers/ar_mailer_revised.rb} +2 -2
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  44. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/test/dummy/config/initializers/inflections.rb +16 -0
  46. data/test/dummy/config/initializers/mime_types.rb +4 -0
  47. data/test/dummy/config/initializers/session_store.rb +3 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +23 -0
  50. data/test/dummy/config/routes.rb +56 -0
  51. data/test/dummy/config/secrets.yml +22 -0
  52. data/test/dummy/db/development.sqlite3 +0 -0
  53. data/test/dummy/db/migrate/20140518140150_create_emails.rb +35 -0
  54. data/test/dummy/db/schema.rb +28 -0
  55. data/test/dummy/db/test.sqlite3 +0 -0
  56. data/test/dummy/lib/assets/.keep +0 -0
  57. data/test/dummy/log/.keep +0 -0
  58. data/test/dummy/log/development.log +119 -0
  59. data/test/dummy/public/404.html +67 -0
  60. data/test/dummy/public/422.html +67 -0
  61. data/test/dummy/public/500.html +66 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/dummy/test/mailers/previews/test_mailer_preview.rb +4 -0
  64. data/test/dummy/test/mailers/test_mailer_test.rb +54 -0
  65. data/test/generators/install_generator_test.rb +14 -0
  66. metadata +184 -12
  67. data/generators/ar_mailer_revised/ar_mailer_revised_generator.rb +0 -23
File without changes
@@ -0,0 +1,4 @@
1
+ # Preview all emails at http://localhost:3000/rails/mailers/test_mailer
2
+ class TestMailerPreview < ActionMailer::Preview
3
+
4
+ end
@@ -0,0 +1,54 @@
1
+ require 'test_helper'
2
+
3
+ class TestMailerTest < ActionMailer::TestCase
4
+
5
+ context 'ActionMailer::Base.deliver' do
6
+ setup do
7
+ #@todo: Check if there is a way to set this in the dummy application itself,
8
+ # neither config/application.rb nor config/environments/* seems to be working.
9
+ ActionMailer::Base.delivery_method = :activerecord
10
+
11
+ #Make sure there is not yet an email record in the database (test test)
12
+ assert !Email.first
13
+ end
14
+
15
+ should 'create a new email record in the database' do
16
+ assert TestMailer.basic_email.deliver
17
+ assert email = Email.first, 'No new record was created'
18
+ assert email.from = 'from@example.com', "Wrong sender email address set: #{email.from}"
19
+ assert email.to = 'basic_email@example.com', "Wrong recipient email address set: #{email.to}"
20
+ end
21
+
22
+ should 'set custom delivery times in the created email record' do
23
+ assert TestMailer.delayed_email.deliver
24
+ assert email = Email.first
25
+ assert email.delivery_time
26
+
27
+ #As we don't know how fast these tests run through, we simply check
28
+ #the generated delivery time with an error margin of 1 minute
29
+ assert email.delivery_time >= (Time.now + 1.hour + 59.minutes)
30
+ assert email.delivery_time <= (Time.now + 2.hours)
31
+ end
32
+
33
+ should 'set custom SMTP settings in the email record' do
34
+ assert TestMailer.custom_smtp_email.deliver
35
+ assert email = Email.first
36
+ assert email.smtp_settings
37
+ assert_equal email.smtp_settings, {
38
+ :address => 'localhost',
39
+ :port => 25,
40
+ :domain => 'localhost.localdomain',
41
+ :user_name => 'some.user',
42
+ :password => 'some.password',
43
+ :authentication => :plain,
44
+ :enable_starttls_auto => true
45
+ }
46
+ end
47
+
48
+ should 'set custom attributes in the email record' do
49
+ assert TestMailer.custom_attribute_email.deliver
50
+ assert email = Email.first
51
+ assert_equal 42, email.a_number
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,14 @@
1
+ require 'test_helper'
2
+
3
+ class InstallGeneratorTest < Rails::Generators::TestCase
4
+ tests ArMailerRevised::Generators::InstallGenerator
5
+ destination File.expand_path('../dummy/tmp', File.dirname(__FILE__))
6
+ setup :prepare_destination
7
+
8
+ test 'Assert all files are properly created' do
9
+ run_generator
10
+ assert_file 'config/initializers/ar_mailer_revised.rb'
11
+ assert_file 'app/models/email.rb'
12
+ assert_migration 'db/migrate/create_emails.rb'
13
+ end
14
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_mailer_revised
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Exner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-27 00:00:00.000000000 Z
11
+ date: 2014-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,20 +66,90 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: shoulda
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
69
111
  - !ruby/object:Gem::Dependency
70
112
  name: rails
71
113
  requirement: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - "~>"
74
116
  - !ruby/object:Gem::Version
75
- version: '2.3'
117
+ version: '4'
76
118
  type: :runtime
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
- version: '2.3'
124
+ version: '4'
125
+ - !ruby/object:Gem::Dependency
126
+ name: log4r
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: hirb
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
83
153
  description: Extension of the great ArMailer gem by Eric Hodel.
84
154
  email:
85
155
  - stex@sterex.de
@@ -90,6 +160,7 @@ extra_rdoc_files: []
90
160
  files:
91
161
  - ".gitignore"
92
162
  - ".ruby-version"
163
+ - ".travis.yml"
93
164
  - ".yardopts"
94
165
  - Gemfile
95
166
  - LICENSE.txt
@@ -98,16 +169,68 @@ files:
98
169
  - Rakefile
99
170
  - ar_mailer_revised.gemspec
100
171
  - bin/ar_sendmail
101
- - generators/ar_mailer_revised/ar_mailer_revised_generator.rb
102
- - generators/ar_mailer_revised/templates/initializer.rb
103
- - generators/ar_mailer_revised/templates/migration.rb
104
- - generators/ar_mailer_revised/templates/model.rb
105
172
  - lib/action_mailer/ar_mailer.rb
106
173
  - lib/ar_mailer_revised.rb
107
174
  - lib/ar_mailer_revised/email_scaffold.rb
175
+ - lib/ar_mailer_revised/helpers/command_line.rb
176
+ - lib/ar_mailer_revised/helpers/general.rb
177
+ - lib/ar_mailer_revised/mailman.rb
108
178
  - lib/ar_mailer_revised/version.rb
179
+ - lib/generators/ar_mailer_revised/install_generator.rb
180
+ - lib/generators/ar_mailer_revised/templates/migration.rb
181
+ - lib/generators/ar_mailer_revised/templates/model.rb
109
182
  - lib/tasks/ar_mailer_revised_tasks.rake
110
183
  - test/ar_mailer_revised_test.rb
184
+ - test/dummy/README.rdoc
185
+ - test/dummy/Rakefile
186
+ - test/dummy/app/assets/images/.keep
187
+ - test/dummy/app/assets/javascripts/application.js
188
+ - test/dummy/app/assets/stylesheets/application.css
189
+ - test/dummy/app/controllers/application_controller.rb
190
+ - test/dummy/app/controllers/concerns/.keep
191
+ - test/dummy/app/helpers/application_helper.rb
192
+ - test/dummy/app/mailers/.keep
193
+ - test/dummy/app/mailers/test_mailer.rb
194
+ - test/dummy/app/models/.keep
195
+ - test/dummy/app/models/concerns/.keep
196
+ - test/dummy/app/models/email.rb
197
+ - test/dummy/app/views/layouts/application.html.erb
198
+ - test/dummy/bin/bundle
199
+ - test/dummy/bin/rails
200
+ - test/dummy/bin/rake
201
+ - test/dummy/config.ru
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/ar_mailer_revised.rb
210
+ - test/dummy/config/initializers/backtrace_silencers.rb
211
+ - test/dummy/config/initializers/cookies_serializer.rb
212
+ - test/dummy/config/initializers/filter_parameter_logging.rb
213
+ - test/dummy/config/initializers/inflections.rb
214
+ - test/dummy/config/initializers/mime_types.rb
215
+ - test/dummy/config/initializers/session_store.rb
216
+ - test/dummy/config/initializers/wrap_parameters.rb
217
+ - test/dummy/config/locales/en.yml
218
+ - test/dummy/config/routes.rb
219
+ - test/dummy/config/secrets.yml
220
+ - test/dummy/db/development.sqlite3
221
+ - test/dummy/db/migrate/20140518140150_create_emails.rb
222
+ - test/dummy/db/schema.rb
223
+ - test/dummy/db/test.sqlite3
224
+ - test/dummy/lib/assets/.keep
225
+ - test/dummy/log/.keep
226
+ - test/dummy/log/development.log
227
+ - test/dummy/public/404.html
228
+ - test/dummy/public/422.html
229
+ - test/dummy/public/500.html
230
+ - test/dummy/public/favicon.ico
231
+ - test/dummy/test/mailers/previews/test_mailer_preview.rb
232
+ - test/dummy/test/mailers/test_mailer_test.rb
233
+ - test/generators/install_generator_test.rb
111
234
  - test/test_helper.rb
112
235
  homepage: http://www.github.com/stex/ar_mailer_revised
113
236
  licenses:
@@ -119,9 +242,9 @@ require_paths:
119
242
  - lib
120
243
  required_ruby_version: !ruby/object:Gem::Requirement
121
244
  requirements:
122
- - - ">="
245
+ - - "~>"
123
246
  - !ruby/object:Gem::Version
124
- version: 1.8.7
247
+ version: '2'
125
248
  required_rubygems_version: !ruby/object:Gem::Requirement
126
249
  requirements:
127
250
  - - ">="
@@ -129,11 +252,60 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
252
  version: '0'
130
253
  requirements: []
131
254
  rubyforge_project:
132
- rubygems_version: 2.4.2
255
+ rubygems_version: 2.2.2
133
256
  signing_key:
134
257
  specification_version: 4
135
258
  summary: Batch email sending for rails applications
136
259
  test_files:
137
260
  - test/ar_mailer_revised_test.rb
261
+ - test/dummy/README.rdoc
262
+ - test/dummy/Rakefile
263
+ - test/dummy/app/assets/images/.keep
264
+ - test/dummy/app/assets/javascripts/application.js
265
+ - test/dummy/app/assets/stylesheets/application.css
266
+ - test/dummy/app/controllers/application_controller.rb
267
+ - test/dummy/app/controllers/concerns/.keep
268
+ - test/dummy/app/helpers/application_helper.rb
269
+ - test/dummy/app/mailers/.keep
270
+ - test/dummy/app/mailers/test_mailer.rb
271
+ - test/dummy/app/models/.keep
272
+ - test/dummy/app/models/concerns/.keep
273
+ - test/dummy/app/models/email.rb
274
+ - test/dummy/app/views/layouts/application.html.erb
275
+ - test/dummy/bin/bundle
276
+ - test/dummy/bin/rails
277
+ - test/dummy/bin/rake
278
+ - test/dummy/config.ru
279
+ - test/dummy/config/application.rb
280
+ - test/dummy/config/boot.rb
281
+ - test/dummy/config/database.yml
282
+ - test/dummy/config/environment.rb
283
+ - test/dummy/config/environments/development.rb
284
+ - test/dummy/config/environments/production.rb
285
+ - test/dummy/config/environments/test.rb
286
+ - test/dummy/config/initializers/ar_mailer_revised.rb
287
+ - test/dummy/config/initializers/backtrace_silencers.rb
288
+ - test/dummy/config/initializers/cookies_serializer.rb
289
+ - test/dummy/config/initializers/filter_parameter_logging.rb
290
+ - test/dummy/config/initializers/inflections.rb
291
+ - test/dummy/config/initializers/mime_types.rb
292
+ - test/dummy/config/initializers/session_store.rb
293
+ - test/dummy/config/initializers/wrap_parameters.rb
294
+ - test/dummy/config/locales/en.yml
295
+ - test/dummy/config/routes.rb
296
+ - test/dummy/config/secrets.yml
297
+ - test/dummy/db/development.sqlite3
298
+ - test/dummy/db/migrate/20140518140150_create_emails.rb
299
+ - test/dummy/db/schema.rb
300
+ - test/dummy/db/test.sqlite3
301
+ - test/dummy/lib/assets/.keep
302
+ - test/dummy/log/.keep
303
+ - test/dummy/log/development.log
304
+ - test/dummy/public/404.html
305
+ - test/dummy/public/422.html
306
+ - test/dummy/public/500.html
307
+ - test/dummy/public/favicon.ico
308
+ - test/dummy/test/mailers/previews/test_mailer_preview.rb
309
+ - test/dummy/test/mailers/test_mailer_test.rb
310
+ - test/generators/install_generator_test.rb
138
311
  - test/test_helper.rb
139
- has_rdoc:
@@ -1,23 +0,0 @@
1
- class ArMailerRevisedGenerator < Rails::Generator::NamedBase
2
- def manifest
3
- record do |m|
4
- model_name = (name || 'Email').classify
5
-
6
- #Create the model
7
- m.template 'model.rb', "app/models/#{model_name.downcase.underscore}.rb", :assigns => {:model_name => model_name}
8
-
9
- #Create the migration
10
- m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "create_#{model_name.downcase.underscore.pluralize}",
11
- :assigns => {:model_name => model_name}
12
-
13
- #Create the initializer
14
- m.template 'initializer.rb', 'config/initializers/ar_mailer_revised.rb', :assigns => {:model_name => model_name}
15
- end
16
- end
17
-
18
- protected
19
-
20
- def banner
21
- "Usage: #{$0} ar_mailer_revised MODEL_NAME"
22
- end
23
- end