padrino-mailer 0.18.0 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/padrino-mailer/helpers.rb +12 -9
- data/padrino-mailer.gemspec +8 -3
- data/test/test_email.rb +59 -0
- metadata +11 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ac2d83b55958d57fb6cced02c2ec08e3613982594069bc9b08036bd95f02e63b
|
|
4
|
+
data.tar.gz: 0500d718cf0f13ca82fd90097cec7548eb4e824e0e72678bb1cffff87f947955
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae82b89755b7e13c0c66b629ff060f3e24ea509fba47b0e9259ec8a637230021f109bdb8edb70b56f31c2cc8b54c09ad4185240f5f8cbcf0e3cbcf93d72bf713
|
|
7
|
+
data.tar.gz: 98d1b6fd13eb78d43fac67b5e1372ed01fe4bb6d5312b5fd73bdb0df0cf1ebaffd89ab44d22ab03fcdd9b3c1a4f25f685f0b1aacc618e5ca16c9fab13e8210aa
|
|
@@ -148,16 +148,19 @@ module Padrino
|
|
|
148
148
|
# Returns the parsed delivery method options.
|
|
149
149
|
#
|
|
150
150
|
def delivery_settings
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
raise 'To use mailers on Windows you must set a :delivery_method, see http://padrinorb.com/guides/features/padrino-mailer/#configuration'
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
return [:sendmail, { location: `which sendmail`.chomp }] unless respond_to?(:delivery_method)
|
|
157
|
-
return [delivery_method.keys[0], delivery_method.values[0]] if delivery_method.is_a?(Hash)
|
|
158
|
-
return [delivery_method, {}] if delivery_method.is_a?(Symbol)
|
|
159
|
-
[nil, {}]
|
|
151
|
+
if Gem.win_platform? && !respond_to?(:delivery_method)
|
|
152
|
+
raise 'To use mailers on Windows you must set a :delivery_method, see http://padrinorb.com/guides/features/padrino-mailer/#configuration'
|
|
160
153
|
end
|
|
154
|
+
|
|
155
|
+
# Only the sendmail lookup spawns a process, so only it is memoised.
|
|
156
|
+
# The rest is read from the setting each time, so a changed
|
|
157
|
+
# :delivery_method is picked up. Concurrent first calls at worst
|
|
158
|
+
# repeat the same lookup.
|
|
159
|
+
return [:sendmail, { location: (@_sendmail_location ||= `which sendmail`.chomp) }] unless respond_to?(:delivery_method)
|
|
160
|
+
return [delivery_method.keys[0], delivery_method.values[0]] if delivery_method.is_a?(Hash)
|
|
161
|
+
return [delivery_method, {}] if delivery_method.is_a?(Symbol)
|
|
162
|
+
|
|
163
|
+
[nil, {}]
|
|
161
164
|
end
|
|
162
165
|
end
|
|
163
166
|
end
|
data/padrino-mailer.gemspec
CHANGED
|
@@ -8,16 +8,21 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.authors = ['Padrino Team', 'Nathan Esquenazi', "Davide D'Agostino", 'Arthur Chiu']
|
|
9
9
|
s.email = 'padrinorb@gmail.com'
|
|
10
10
|
s.summary = 'Mailer system for padrino'
|
|
11
|
-
s.homepage = '
|
|
11
|
+
s.homepage = 'https://padrinorb.com'
|
|
12
12
|
s.description = 'Mailer system for padrino allowing easy delivery of application emails'
|
|
13
|
+
s.required_ruby_version = '>= 2.7.8'
|
|
13
14
|
s.required_rubygems_version = '>= 1.3.6'
|
|
14
15
|
s.version = Padrino.version
|
|
15
|
-
s.date = Time.now.strftime('%Y-%m-%d')
|
|
16
16
|
s.license = 'MIT'
|
|
17
|
+
s.metadata = {
|
|
18
|
+
'bug_tracker_uri' => 'https://github.com/padrino/padrino-framework/issues',
|
|
19
|
+
'changelog_uri' => 'https://github.com/padrino/padrino-framework/blob/master/CHANGES.rdoc',
|
|
20
|
+
'documentation_uri' => 'https://padrinorb.com/guides/',
|
|
21
|
+
'source_code_uri' => 'https://github.com/padrino/padrino-framework'
|
|
22
|
+
}
|
|
17
23
|
|
|
18
24
|
s.extra_rdoc_files = Dir['*.rdoc']
|
|
19
25
|
s.files = `git ls-files`.split("\n")
|
|
20
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
21
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
22
27
|
s.require_paths = ['lib']
|
|
23
28
|
s.rdoc_options = ['--charset=UTF-8']
|
data/test/test_email.rb
CHANGED
|
@@ -287,4 +287,63 @@ describe 'Email' do
|
|
|
287
287
|
assert_equal(['gamma plain', 'gamma html'], email.parts.map { |part| part.body.to_s })
|
|
288
288
|
end
|
|
289
289
|
end
|
|
290
|
+
|
|
291
|
+
describe 'delivery settings' do
|
|
292
|
+
def counted_app
|
|
293
|
+
mock_app do
|
|
294
|
+
register Padrino::Mailer
|
|
295
|
+
@sendmail_lookups = 0
|
|
296
|
+
class << self
|
|
297
|
+
attr_reader :sendmail_lookups
|
|
298
|
+
|
|
299
|
+
def `(command)
|
|
300
|
+
@sendmail_lookups += 1
|
|
301
|
+
"/fake/#{command.split.last}\n"
|
|
302
|
+
end
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
it 'should look up sendmail once when no delivery method is set' do
|
|
308
|
+
app = counted_app
|
|
309
|
+
first = app.send(:delivery_settings)
|
|
310
|
+
second = app.send(:delivery_settings)
|
|
311
|
+
assert_equal [:sendmail, { location: '/fake/sendmail' }], first
|
|
312
|
+
assert_equal first, second
|
|
313
|
+
assert_equal 1, app.sendmail_lookups
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
it 'should follow a delivery method changed after the first call' do
|
|
317
|
+
app = counted_app
|
|
318
|
+
assert_equal :sendmail, app.send(:delivery_settings).first
|
|
319
|
+
app.set :delivery_method, :test
|
|
320
|
+
assert_equal [:test, {}], app.send(:delivery_settings)
|
|
321
|
+
app.set :delivery_method, smtp: { address: 'localhost' }
|
|
322
|
+
assert_equal [:smtp, { address: 'localhost' }], app.send(:delivery_settings)
|
|
323
|
+
app.set :delivery_method, 'unusual'
|
|
324
|
+
assert_equal [nil, {}], app.send(:delivery_settings)
|
|
325
|
+
assert_equal 1, app.sendmail_lookups
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
it 'should read a Symbol and a Hash delivery method on repeated calls' do
|
|
329
|
+
app = counted_app
|
|
330
|
+
app.set :delivery_method, :test
|
|
331
|
+
2.times { assert_equal [:test, {}], app.send(:delivery_settings) }
|
|
332
|
+
app.set :delivery_method, smtp: { port: 25 }
|
|
333
|
+
2.times { assert_equal [:smtp, { port: 25 }], app.send(:delivery_settings) }
|
|
334
|
+
assert_equal 0, app.sendmail_lookups
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
it 'should still raise on Windows without a delivery method' do
|
|
338
|
+
app = counted_app
|
|
339
|
+
original = Gem.method(:win_platform?)
|
|
340
|
+
Gem.define_singleton_method(:win_platform?) { true }
|
|
341
|
+
begin
|
|
342
|
+
2.times { assert_raises(RuntimeError) { app.send(:delivery_settings) } }
|
|
343
|
+
ensure
|
|
344
|
+
Gem.define_singleton_method(:win_platform?, original)
|
|
345
|
+
end
|
|
346
|
+
assert_equal 0, app.sendmail_lookups
|
|
347
|
+
end
|
|
348
|
+
end
|
|
290
349
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: padrino-mailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.18.
|
|
4
|
+
version: 0.18.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Padrino Team
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-
|
|
14
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: padrino-core
|
|
@@ -19,14 +19,14 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - '='
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.18.
|
|
22
|
+
version: 0.18.2
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
27
|
- - '='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.18.
|
|
29
|
+
version: 0.18.2
|
|
30
30
|
- !ruby/object:Gem::Dependency
|
|
31
31
|
name: mime-types
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -109,10 +109,14 @@ files:
|
|
|
109
109
|
- test/test_message.rb
|
|
110
110
|
- test/test_padrino_mailer.rb
|
|
111
111
|
- test/test_part.rb
|
|
112
|
-
homepage:
|
|
112
|
+
homepage: https://padrinorb.com
|
|
113
113
|
licenses:
|
|
114
114
|
- MIT
|
|
115
|
-
metadata:
|
|
115
|
+
metadata:
|
|
116
|
+
bug_tracker_uri: https://github.com/padrino/padrino-framework/issues
|
|
117
|
+
changelog_uri: https://github.com/padrino/padrino-framework/blob/master/CHANGES.rdoc
|
|
118
|
+
documentation_uri: https://padrinorb.com/guides/
|
|
119
|
+
source_code_uri: https://github.com/padrino/padrino-framework
|
|
116
120
|
post_install_message:
|
|
117
121
|
rdoc_options:
|
|
118
122
|
- "--charset=UTF-8"
|
|
@@ -122,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
122
126
|
requirements:
|
|
123
127
|
- - ">="
|
|
124
128
|
- !ruby/object:Gem::Version
|
|
125
|
-
version:
|
|
129
|
+
version: 2.7.8
|
|
126
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
131
|
requirements:
|
|
128
132
|
- - ">="
|