postmortem 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30402889e14ab2f3f3610b81e9c9599e62386069b4661d3b9d37705dbf6f005e
4
- data.tar.gz: b7ebefa76d21b584fb9e9518944e820c1946d108c6dd804b4afab57c10029022
3
+ metadata.gz: 780f61b6eb5f86e5bfdb462a7956b5153621a65b2d52df46391cca4c7717136f
4
+ data.tar.gz: 1e455516c635c912c2effbce4781529abdd036196092f9d16eaea4ec1a17e5f2
5
5
  SHA512:
6
- metadata.gz: fcf088bc9e0df4f23ef3ef95180269cc72572abf056bf7b7af5eda5047f4d04c27764b9ea20bae7621d1d40aa296fa18a4632f1eb742b71e634da4ab101b93af
7
- data.tar.gz: 3d443e64524fbc3a594f1d042b8a8d384993f8ee27061b1fc5835795b7019e70aebe2e79d7c4ace3c35074a99d4c6f5b1443877283858f6c6e51d585429a2c68
6
+ metadata.gz: d023d75793d8d8da14f24e2dfa8b1748087c719e2f92df80de5568babb8f3efe89c21d0456e556d2830df50bbe46ab30dadaaabfe1760420a32f1c45b2d14835
7
+ data.tar.gz: 07bab3669ab537e92532f58d7cfa6b66465e0c3b39af5f73e544cc8099165960e2e7a214ff00d15ad8df05c311fbf4efc76c05ad3205756cf8df8e16397c1cd5
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
1
+ 2.6.9
data/README.md CHANGED
@@ -27,7 +27,7 @@ Add the gem to your application's Gemfile:
27
27
 
28
28
  ```ruby
29
29
  group :development, :test do
30
- gem 'postmortem', '~> 0.3.1'
30
+ gem 'postmortem', '~> 0.3.2'
31
31
  end
32
32
  ```
33
33
 
data/layout/layout.js CHANGED
@@ -375,8 +375,9 @@
375
375
  const modifiedHtml = [html.substring(0, start), html.substring(end + 1, html.length)].join('');
376
376
  const blob = new Blob([modifiedHtml], { type: 'application/octet-stream' });
377
377
  const uri = window.URL.createObjectURL(blob);
378
+ const subject = mail.subject || '(No subject)'
378
379
  $("#download-link").attr('href', uri);
379
- $("#download-link").attr('download', mail.subject.replace(/[^0-9a-zA-Z_ -]/gi, '') + '.html');
380
+ $("#download-link").attr('download', subject.replace(/[^0-9a-zA-Z_ -]/gi, '') + '.html');
380
381
  };
381
382
 
382
383
  const loadUploadLink = (email) => {
@@ -8,8 +8,7 @@ module Postmortem
8
8
 
9
9
  def adapted
10
10
  %i[from reply_to to cc subject message_id]
11
- .map { |field| [field, mail.public_send(field)] }
12
- .to_h
11
+ .to_h { |field| [field, mail.public_send(field)] }
13
12
  .merge({ text_body: text_part, html_body: html_part, bcc: normalized_bcc })
14
13
  end
15
14
 
@@ -16,7 +16,7 @@ module Postmortem
16
16
  end
17
17
 
18
18
  def serializable
19
- (%i[id] + FIELDS).map { |field| [camelize(field.to_s), public_send(field)] }.to_h
19
+ (%i[id] + FIELDS).to_h { |field| [camelize(field.to_s), public_send(field)] }
20
20
  end
21
21
 
22
22
  def id
@@ -8,8 +8,7 @@ module Postmortem
8
8
 
9
9
  def adapted
10
10
  %i[from reply_to to cc bcc subject message_id]
11
- .map { |field| [field, mail.public_send(field)] }
12
- .to_h
11
+ .to_h { |field| [field, mail.public_send(field)] }
13
12
  .merge({ text_body: text_part, html_body: html_part })
14
13
  end
15
14
 
@@ -41,7 +41,7 @@ module Postmortem
41
41
  end
42
42
 
43
43
  def safe_subject
44
- subject.tr(' ', '_').split('').select { |char| safe_chars.include?(char) }.join
44
+ subject.tr(' ', '_').chars.select { |char| safe_chars.include?(char) }.join
45
45
  end
46
46
 
47
47
  def safe_chars
@@ -4,7 +4,7 @@ module Postmortem
4
4
  # Provides an HTML document that announces a unique ID to a parent page via JS message events.
5
5
  class Identity
6
6
  def content
7
- ERB.new(File.read(path), nil, '-').result(binding)
7
+ ERB.new(File.read(path), trim_mode: '-').result(binding)
8
8
  end
9
9
 
10
10
  private
@@ -11,7 +11,7 @@ module Postmortem
11
11
 
12
12
  def content
13
13
  mail_path = @mail_path
14
- ERB.new(File.read(template_path), nil, '-').result(binding)
14
+ ERB.new(File.read(template_path), trim_mode: '-').result(binding)
15
15
  end
16
16
 
17
17
  def size
@@ -54,7 +54,7 @@ module Postmortem
54
54
  def with_inlined_images(body)
55
55
  parsed = Nokogiri::HTML.parse(body)
56
56
  parsed.css('img').each do |img|
57
- uri = try_uri(img['src'])
57
+ uri = extract_image_uri(img)
58
58
  next unless local_file?(uri)
59
59
 
60
60
  path = located_image(uri)
@@ -63,6 +63,16 @@ module Postmortem
63
63
  parsed.to_s
64
64
  end
65
65
 
66
+ def extract_image_uri(img)
67
+ src_uri = try_uri(img['src'])
68
+ return src_uri if src_uri&.path.present?
69
+
70
+ original_src_uri = try_uri(img['data-originalsrc'])
71
+ return original_src_uri if original_src_uri&.path.present?
72
+
73
+ nil
74
+ end
75
+
66
76
  def local_file?(uri)
67
77
  return false if uri.nil?
68
78
  return true if uri.host.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Postmortem
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.3'
5
5
  end
data/postmortem.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Preview HTML emails in your browser during development'
13
13
  spec.homepage = 'https://github.com/bobf/postmortem'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = spec.homepage
@@ -27,14 +27,15 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_runtime_dependency 'mail', '~> 2.7'
29
29
 
30
- spec.add_development_dependency 'actionmailer', '~> 6.0'
31
- spec.add_development_dependency 'devpack', '~> 0.3.2'
32
- spec.add_development_dependency 'faker', '~> 2.17'
30
+ spec.add_development_dependency 'actionmailer', '~> 6.1'
31
+ spec.add_development_dependency 'devpack', '~> 0.4.0'
32
+ spec.add_development_dependency 'faker', '~> 2.21'
33
33
  spec.add_development_dependency 'pony', '~> 1.13'
34
- spec.add_development_dependency 'rspec', '~> 3.9'
34
+ spec.add_development_dependency 'rspec', '~> 3.11'
35
35
  spec.add_development_dependency 'rspec-its', '~> 1.3'
36
- spec.add_development_dependency 'rubocop', '~> 1.10'
37
- spec.add_development_dependency 'rubocop-rspec', '~> 2.2'
36
+ spec.add_development_dependency 'rubocop', '~> 1.30'
37
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.11'
38
38
  spec.add_development_dependency 'strong_versions', '~> 0.4.5'
39
- spec.add_development_dependency 'timecop', '~> 0.9.1'
39
+ spec.add_development_dependency 'timecop', '~> 0.9.5'
40
+ spec.metadata['rubygems_mfa_required'] = 'true'
40
41
  end
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.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Farrell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-18 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail
@@ -30,42 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
33
+ version: '6.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '6.0'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: devpack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.3.2
47
+ version: 0.4.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.2
54
+ version: 0.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faker
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.17'
61
+ version: '2.21'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.17'
68
+ version: '2.21'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pony
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.9'
89
+ version: '3.11'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.9'
96
+ version: '3.11'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec-its
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.10'
117
+ version: '1.30'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.10'
124
+ version: '1.30'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rubocop-rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.2'
131
+ version: '2.11'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.2'
138
+ version: '2.11'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: strong_versions
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.9.1
159
+ version: 0.9.5
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.9.1
166
+ version: 0.9.5
167
167
  description: Preview HTML emails in your browser during development
168
168
  email:
169
169
  - git@bob.frl
@@ -214,6 +214,7 @@ metadata:
214
214
  homepage_uri: https://github.com/bobf/postmortem
215
215
  source_code_uri: https://github.com/bobf/postmortem
216
216
  changelog_uri: https://github.com/bobf/postmortem/blob/master/README.md
217
+ rubygems_mfa_required: 'true'
217
218
  post_install_message:
218
219
  rdoc_options: []
219
220
  require_paths:
@@ -222,15 +223,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
222
223
  requirements:
223
224
  - - ">="
224
225
  - !ruby/object:Gem::Version
225
- version: 2.5.0
226
+ version: 2.6.0
226
227
  required_rubygems_version: !ruby/object:Gem::Requirement
227
228
  requirements:
228
229
  - - ">="
229
230
  - !ruby/object:Gem::Version
230
231
  version: '0'
231
232
  requirements: []
232
- rubyforge_project:
233
- rubygems_version: 2.7.6.2
233
+ rubygems_version: 3.2.3
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: Development HTML Email Inspection Tool