roda-mailer_ext 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/roda/plugins/mailer_ext.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75677215c1081e0a72b05714ec0bef150b56ceb9
|
4
|
+
data.tar.gz: 69fbec14349c54876264ecce6040eaafffe95d6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4fb322de633a19f32486c8ec422f881cc9710e4a8a856b320c313146c1dea5b0b17a5f020554078222880e672efbe7f07ceda92d5ca85179ee566649cb92033
|
7
|
+
data.tar.gz: b87e60117d50241b224e886e5f9099fe77bdd0749ef52fbbdfcb8c5da124c74165b9bf8b8091f6746787a52a6dd882fdb7aef26f08f84faf6b956dfaf7c7c400
|
data/README.md
CHANGED
@@ -13,7 +13,9 @@ module Roda::RodaPlugins # :nodoc:
|
|
13
13
|
#
|
14
14
|
# The following plugin options are supported:
|
15
15
|
#
|
16
|
-
# :log ::
|
16
|
+
# :log :: When true, output the body of the email to STDOUT before delivery.
|
17
|
+
# If passed an object that responds to +call+, it will be called with
|
18
|
+
# the email object.
|
17
19
|
# :prevent_delivery :: Uses the +Mail+ test mailer instead of actually
|
18
20
|
# attempting the delivery to a SMTP server.
|
19
21
|
#
|
@@ -34,7 +36,17 @@ module Roda::RodaPlugins # :nodoc:
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def _log_mail(message)
|
37
|
-
|
39
|
+
log = roda_class.opts[:mailer_ext][:log]
|
40
|
+
|
41
|
+
if log.respond_to?(:call)
|
42
|
+
log.call(message)
|
43
|
+
else
|
44
|
+
puts(_format_mail(message))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def _format_mail(message)
|
49
|
+
<<~EOM
|
38
50
|
|
39
51
|
==> Sending email to #{message.to.join(", ")}
|
40
52
|
#{message}
|
@@ -52,7 +64,7 @@ module Roda::RodaPlugins # :nodoc:
|
|
52
64
|
end
|
53
65
|
|
54
66
|
def self.configure(app, opts = {}) # :nodoc:
|
55
|
-
app.opts[:mailer_ext] = { log: false, prevent_delivery: false }.merge(opts)
|
67
|
+
app.opts[:mailer_ext] = { log: false, prevent_delivery: false }.merge(opts)
|
56
68
|
|
57
69
|
if app.opts[:mailer_ext][:prevent_delivery]
|
58
70
|
Mail.defaults do
|