postmortem 0.1.1 → 0.1.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/README.md +5 -4
- data/lib/postmortem.rb +1 -0
- data/lib/postmortem/adapters.rb +1 -0
- data/lib/postmortem/adapters/action_mailer.rb +2 -2
- data/lib/postmortem/adapters/mail.rb +21 -0
- data/lib/postmortem/adapters/pony.rb +1 -1
- data/lib/postmortem/configuration.rb +3 -3
- data/lib/postmortem/plugins/mail.rb +11 -0
- data/lib/postmortem/plugins/pony.rb +5 -2
- data/lib/postmortem/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e05359d9e039f6e44c0e89decaac3c5c72fe3447f7a96fdb8ac1667fe93d537
|
4
|
+
data.tar.gz: 651d2b986f6b9b07e8fe311cd163865490005da3376c95c4ce05a4110a313e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66a929b9cfa7043ebce54eda09c4168e4adfd485d24e32720dc68238c6ea578030c89ad90181d770b22b33d358c2945bae12cc5df9a8f3d3019989b6a72cc8ca
|
7
|
+
data.tar.gz: 82478c5ef6a04531776023947b39b3c1c04a003185a602199a4460e2ba4b6759a87493475666f4056d0bcc759b7de3a5765db8b3356d28e863e71ed445ca7e2a
|
data/README.md
CHANGED
@@ -10,7 +10,8 @@ _Postmortem_ should only be enabled in test or development environments.
|
|
10
10
|
|
11
11
|
## Features
|
12
12
|
|
13
|
-
* Seamless integration with [_ActionMailer_](https://guides.rubyonrails.org/action_mailer_basics.html)
|
13
|
+
* Seamless integration with [_ActionMailer_](https://guides.rubyonrails.org/action_mailer_basics.html), [_Pony_](https://github.com/benprew/pony), [_Mail_](https://github.com/mikel/mail), etc.
|
14
|
+
* Email deliveries are always intercepted (can be configured to pass through).
|
14
15
|
* Preview email content as well as typical email headers (recipients, subject, etc.).
|
15
16
|
* View rendered _HTML_, plaintext, or _HTML_ source with syntax highlighting (courtesy of [highlight.js](https://highlightjs.org/)).
|
16
17
|
* Dual or single column view to suit your requirements.
|
@@ -22,7 +23,7 @@ Add the gem to your application's Gemfile:
|
|
22
23
|
|
23
24
|
```ruby
|
24
25
|
group :development, :test do
|
25
|
-
gem 'postmortem', '~> 0.1.
|
26
|
+
gem 'postmortem', '~> 0.1.2'
|
26
27
|
end
|
27
28
|
```
|
28
29
|
|
@@ -80,8 +81,8 @@ Postmortem.configure do |config|
|
|
80
81
|
# See `layout/default.html.erb` for implementation reference.
|
81
82
|
config.layout = '/path/to/layout'
|
82
83
|
|
83
|
-
# Skip delivery of emails when using Pony (default: true).
|
84
|
-
config.
|
84
|
+
# Skip delivery of emails when using Pony, Mail, etc. (default: true).
|
85
|
+
config.mail_skip_delivery = true
|
85
86
|
end
|
86
87
|
```
|
87
88
|
|
data/lib/postmortem.rb
CHANGED
data/lib/postmortem/adapters.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Postmortem
|
4
|
+
module Adapters
|
5
|
+
# Mail adapter.
|
6
|
+
class Mail < Base
|
7
|
+
private
|
8
|
+
|
9
|
+
def adapted
|
10
|
+
%i[from reply_to to cc bcc subject]
|
11
|
+
.map { |field| [field, @data.public_send(field)] }
|
12
|
+
.to_h
|
13
|
+
.merge({ text_body: @data.text_part, html_body: @data.html_part })
|
14
|
+
end
|
15
|
+
|
16
|
+
def mail
|
17
|
+
@mail ||= @data
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Postmortem
|
4
4
|
# Provides interface for configuring Postmortem and implements sensible defaults.
|
5
5
|
class Configuration
|
6
|
-
attr_writer :colorize, :timestamp, :
|
6
|
+
attr_writer :colorize, :timestamp, :mail_skip_delivery
|
7
7
|
attr_accessor :log_path
|
8
8
|
|
9
9
|
def timestamp
|
@@ -32,8 +32,8 @@ module Postmortem
|
|
32
32
|
@preview_directory ||= Pathname.new(File.join(Dir.tmpdir, 'postmortem'))
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
defined?(@
|
35
|
+
def mail_skip_delivery
|
36
|
+
defined?(@mail_skip_delivery) ? @mail_skip_delivery : true
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Mail::SMTP.class_eval do
|
4
|
+
alias_method :_original_deliver!, :deliver!
|
5
|
+
|
6
|
+
def deliver!(mail)
|
7
|
+
result = _original_deliver!(mail) unless Postmortem.config.mail_skip_delivery
|
8
|
+
Postmortem.record_delivery(Postmortem::Adapters::Mail.new(mail))
|
9
|
+
result
|
10
|
+
end
|
11
|
+
end
|
@@ -3,10 +3,13 @@
|
|
3
3
|
# Pony monkey-patch.
|
4
4
|
module Pony
|
5
5
|
class << self
|
6
|
-
alias
|
6
|
+
alias _original_mail mail
|
7
7
|
|
8
8
|
def mail(options)
|
9
|
-
|
9
|
+
# SMTP delivery is handled by Mail plugin further down the stack
|
10
|
+
return _original_mail(options) if options[:via].to_s == 'smtp'
|
11
|
+
|
12
|
+
result = _original_mail(options) unless Postmortem.config.mail_skip_delivery
|
10
13
|
Postmortem.record_delivery(Postmortem::Adapters::Pony.new(options))
|
11
14
|
result
|
12
15
|
end
|
data/lib/postmortem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmortem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mail
|
@@ -145,11 +145,13 @@ files:
|
|
145
145
|
- lib/postmortem/adapters.rb
|
146
146
|
- lib/postmortem/adapters/action_mailer.rb
|
147
147
|
- lib/postmortem/adapters/base.rb
|
148
|
+
- lib/postmortem/adapters/mail.rb
|
148
149
|
- lib/postmortem/adapters/pony.rb
|
149
150
|
- lib/postmortem/configuration.rb
|
150
151
|
- lib/postmortem/delivery.rb
|
151
152
|
- lib/postmortem/layout.rb
|
152
153
|
- lib/postmortem/plugins/action_mailer.rb
|
154
|
+
- lib/postmortem/plugins/mail.rb
|
153
155
|
- lib/postmortem/plugins/pony.rb
|
154
156
|
- lib/postmortem/version.rb
|
155
157
|
- postmortem.gemspec
|
@@ -160,7 +162,7 @@ metadata:
|
|
160
162
|
homepage_uri: https://github.com/bobf/postmortem
|
161
163
|
source_code_uri: https://github.com/bobf/postmortem
|
162
164
|
changelog_uri: https://github.com/bobf/postmortem/blob/master/README.md
|
163
|
-
post_install_message:
|
165
|
+
post_install_message:
|
164
166
|
rdoc_options: []
|
165
167
|
require_paths:
|
166
168
|
- lib
|
@@ -176,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
178
|
version: '0'
|
177
179
|
requirements: []
|
178
180
|
rubygems_version: 3.1.2
|
179
|
-
signing_key:
|
181
|
+
signing_key:
|
180
182
|
specification_version: 4
|
181
183
|
summary: Development HTML Email Inspection Tool
|
182
184
|
test_files: []
|