sanitize_email 2.0.5 → 2.0.6

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: 1d655a119fcfed21733da3b6d086904bed64ee290930b63cd2ef36c7f918e882
4
- data.tar.gz: '08de77ba87e5f93b0096b3646aa7512dee49ada51b4972b68dc3ca37c700109a'
3
+ metadata.gz: ab280a496e5f7c676c9f34a0d9c947e79015cc1001fb64dd9c9d7240d140eeea
4
+ data.tar.gz: 455e2718f6bc3cf995b444768c2fcb855ff15685077d234c4887c829cb3b36ca
5
5
  SHA512:
6
- metadata.gz: 8304c15db70e464ad886a752b91d3b60444e36b8865f62442fe642eb687afea0ea00741e685537b1d3bd87cd50f70501a5890de0b946dbae2e50ce5c9dcc7b94
7
- data.tar.gz: 1c693f4d770f5517e4b904e73edcd814a71b2ab6e4fa96fc1eff734d9d0db0246a64282257cf16eeb69d68b46980cb149cce9e27fae5635e60ab0cb8a51e856e
6
+ metadata.gz: 847a73eb85a827ff002f26e0108f3bd5ad4f9750d3de08e8461363e6effe31058fe92dee7ea7b1d3fa0260ad4f00b0f52d6df285ab0dc9fc029faac34ccca380
7
+ data.tar.gz: 1e53fb956e7bb1223192164e151509c45c6f2c7e653c5b9d194925164e1141ae969a8364209e3fd5a7db4c5d833146016a9fbdfe2c7b8f38a17be1b4c6d04004
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Fixed
11
11
  ### Removed
12
12
 
13
+ ## [2.0.6] - 2024-04-25 ([tag][2.0.6t])
14
+ ### Added
15
+ * Appraisals & Combustion for comprehensive testing across versions of Rails (@pboling)
16
+ * Rails 3.0 to Test Matrix (@pboling)
17
+ * Rails 3.1 to Test Matrix (@pboling)
18
+ * Rails 3.2 to Test Matrix (@pboling)
19
+ * Rails 4.0 to Test Matrix (@pboling)
20
+ * Rails 4.1 to Test Matrix (@pboling)
21
+ * Rails 4.2 to Test Matrix (@pboling)
22
+ * Rails 5.0 to Test Matrix (@pboling)
23
+ * Rails 5.1 to Test Matrix (@pboling)
24
+ * More Documentation (@pboling)
25
+ ### Fixed
26
+ * Compatibility with Rails 3.0, 3.1, 3.2 (@pboling)
27
+ * Compatibility with Rails 6.0, 6.1, 7.0, 7.1 (@pboling)
28
+
13
29
  ## [2.0.5] - 2024-04-18 ([tag][2.0.5t])
14
30
  ### Added
15
31
  * New RSpec matcher (@pboling)
@@ -275,7 +291,11 @@ Old version?
275
291
  * Fixed require paths
276
292
  * added about.yml and this CHANGELOG
277
293
 
278
- [Unreleased]: https://github.com/pboling/sanitize_email/compare/v2.0.4...HEAD
294
+ [Unreleased]: https://github.com/pboling/sanitize_email/compare/v2.0.6...HEAD
295
+ [2.0.6]: https://github.com/pboling/sanitize_email/compare/v2.0.5...v2.0.6
296
+ [2.0.6t]: https://github.com/pboling/sanitize_email/tags/v2.0.6
297
+ [2.0.5]: https://github.com/pboling/sanitize_email/compare/v2.0.4...v2.0.5
298
+ [2.0.5t]: https://github.com/pboling/sanitize_email/tags/v2.0.5
279
299
  [2.0.4]: https://github.com/pboling/sanitize_email/compare/v2.0.3...v2.0.4
280
300
  [2.0.4t]: https://github.com/pboling/sanitize_email/tags/v2.0.4
281
301
  [2.0.3]: https://github.com/pboling/sanitize_email/compare/v2.0.2...v2.0.3
data/CONTRIBUTING.md CHANGED
@@ -7,6 +7,14 @@ the [code of conduct][🤝conduct].
7
7
  To submit a patch, please fork the project and create a patch with tests. Once you're happy with it send a pull request
8
8
  and post a message to the [gitter chat][🏘chat].
9
9
 
10
+ ## Appraisal & Combustion
11
+
12
+ ### Generate a new set of Appraisal gemfiles:
13
+
14
+ ```sh
15
+ BUNDLE_GEMFILE=gemfiles/vanilla.gemfile appraisal generate
16
+ ```
17
+
10
18
  ## Release
11
19
 
12
20
  To release a new version:
data/README.md CHANGED
@@ -63,13 +63,15 @@ then this is the gem for you.
63
63
 
64
64
  ## Compatibility
65
65
 
66
- ⚙️ Compatible with all versions of Ruby >= 2.3.
66
+ ⚙️ Compatible with all versions of Ruby >= 2.3, plus JRuby and Truffleruby.
67
67
  ⚙️ Compatible with all Ruby web Frameworks (Hanami, Roda, Sinatra, Rails).
68
68
  ⚙️ Compatible with all versions of Rails from 3.0 - 7.1+.
69
69
  ⚙️ Compatible with scripted usage of Mail gem outside a web framework.
70
70
  ⚙️ Compatible with [`sendgrid-actionmailer`](https://github.com/eddiezane/sendgrid-actionmailer)'s support for personalizations, and will override email addresses there according to the configuration.
71
71
  ⚙️ If this gem is not compatible with your use case, and you'd like it to be, I'd like to hear about it!
72
72
 
73
+ It was a slog getting (very nearly) the entire compatibility matrix working with Github Actions, [`appraisal`](https://github.com/thoughtbot/appraisal), and [`combustion`](https://github.com/pat/combustion), and I'm very interested in hearing about ways to improve it!
74
+
73
75
  ## 🛞 DVCS
74
76
 
75
77
  This project does not trust any one version control system,
@@ -228,7 +230,7 @@ The link tokens in the following sections should be kept ordered by the row and
228
230
  It's particularly helpful when you want to prevent the delivery of email (e.g. in development/test environments) or alter the to/cc/bcc (e.g. in staging or demo environments) of all email generated from your application.
229
231
 
230
232
  * compatible without Rails! Can work with just the `mail` gem.
231
- * compatible with Rails >= 4.2. See gem versions 1.x for older versions of Rails.
233
+ * compatible with Rails >= 3.0. See gem versions 1.x for older versions of Rails.
232
234
  * compatible with Ruby >= 2.3. See gem versions 1.x for older versions of Ruby.
233
235
  * compatible with any Ruby app with a mail handler that uses the `register_interceptor` API (a la ActionMailer and `mail` gems)
234
236
  * configure it and forget it
@@ -674,15 +676,18 @@ Learn more about, or become one of, our 🎖 contributors on:
674
676
  ## Running Specs
675
677
 
676
678
  The basic compatibility matrix:
677
- ```
679
+ ```sh
678
680
  appraisal install
679
681
  appraisal rake test
680
682
  ```
681
683
 
682
684
  Sometimes also:
685
+ ```sh
686
+ BUNDLE_GEMFILE=gemfiles/vanilla.gemfile appraisal update
683
687
  ```
684
- appraisal update
685
- ```
688
+
689
+ Except, is unlikely to be possible to install all of the supported Rubies & Railsies in a single container...
690
+ See the various github action workflows for more inspiration on running certain oldies.
686
691
 
687
692
  ### Code Coverage
688
693
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Copyright (c) 2008 - 2018, 2020, 2022, 2024 Peter H. Boling of RailsBling.com
4
4
  # Released under the MIT license
5
+ require "rails/engine"
5
6
 
6
7
  module SanitizeEmail
7
8
  # For Rails >= 3.1, < 6.0
@@ -2,14 +2,15 @@
2
2
 
3
3
  # Copyright (c) 2008 - 2018, 2020, 2022, 2024 Peter H. Boling of RailsBling.com
4
4
  # Released under the MIT license
5
+ require "rails/engine"
5
6
 
6
7
  module SanitizeEmail
7
8
  # For Rails >= 6.0
8
- class EngineV5 < ::Rails::Engine
9
+ class EngineV6 < ::Rails::Engine
9
10
  config.to_prepare do
10
11
  # For the reasoning behind the difference between v5 and v6 engines,
11
12
  # - see: https://github.com/rails/rails/issues/36546#issuecomment-850888284
12
- config.action_mailer.register_interceptor(SanitizeEmail::Bleach)
13
+ Rails.application.config.action_mailer.register_interceptor(SanitizeEmail::Bleach)
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Copyright (c) 2008 - 2018, 2020, 2022, 2024 Peter H. Boling of RailsBling.com
4
+ # Released under the MIT license
3
5
  require "mail"
4
6
 
5
7
  # Cribbed from email_spec gem
@@ -55,10 +55,15 @@ module SanitizeEmail
55
55
  @overridden_cc = tempmail[:cc].decoded
56
56
  @overridden_bcc = tempmail[:bcc].decoded
57
57
 
58
- if message["personalizations"].nil?
58
+ actual_personalizations = message["personalizations"]
59
+ if actual_personalizations.nil?
59
60
  raise MissingRecipients, "No recipients left post-sanitization" if (tempmail.to + tempmail.cc + tempmail.bcc).empty?
61
+ elsif actual_personalizations.respond_to?(:unparsed_value)
62
+ @overridden_personalizations = personalizations_override(actual_personalizations)
60
63
  else
61
- @overridden_personalizations = personalizations_override(message["personalizations"])
64
+ # TODO: Remove check when dropping Rails 3.x
65
+ # undefined method `unparsed_value' for #<Mail::OptionalField>
66
+ raise MissingRecipients, "Mail version is too old to use personalizations"
62
67
  end
63
68
  end
64
69
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Copyright (c) 2008 - 2018, 2020, 2022, 2024 Peter H. Boling of RailsBling.com
4
4
  # Released under the MIT license
5
+ require "rails/railtie"
5
6
 
6
7
  module SanitizeEmail
7
8
  # For Rails 3.0, which didn't yet support Engines
@@ -5,6 +5,6 @@
5
5
 
6
6
  module SanitizeEmail
7
7
  module Version
8
- VERSION = "2.0.5"
8
+ VERSION = "2.0.6"
9
9
  end
10
10
  end
@@ -18,6 +18,9 @@ module SanitizeEmail
18
18
  # Error is raised when a block parameter is required and not provided to a method
19
19
  class MissingBlockParameter < StandardError; end
20
20
 
21
+ # Load order matters here!
22
+ # This gem must be loaded **after** Rails in order for the Engine/Railtie to register itself automatically.
23
+ # Otherwise, you'd have to manually require what you need from below.
21
24
  # Allow non-rails implementations to use this gem
22
25
  if defined?(::Rails) && defined?(::Rails::VERSION)
23
26
  if defined?(::Rails::Engine)
@@ -48,95 +51,101 @@ module SanitizeEmail
48
51
  end
49
52
  end
50
53
 
51
- def self.[](key)
52
- return unless key.respond_to?(:to_sym)
53
- SanitizeEmail::Config.config[key.to_sym]
54
- end
54
+ class << self
55
+ extend SanitizeEmail::Deprecation
55
56
 
56
- def self.method_missing(name, *_args)
57
- SanitizeEmail[name]
58
- end
57
+ attr_accessor :force_sanitize
59
58
 
60
- # NOTE: Deprecated method
61
- # We have to actually define because we can't deprecate methods that are hooked up via method_missing
62
- def self.sanitized_recipients
63
- # NOOP - This method is never actually executed, because the deprecations redirects the call to sanitized_to
64
- end
59
+ def [](key)
60
+ return unless key.respond_to?(:to_sym)
61
+ SanitizeEmail::Config.config[key.to_sym]
62
+ end
65
63
 
66
- # NOTE: Deprecated method
67
- # We have to actually define because we can't deprecate methods that are hooked up via method_missing
68
- def self.local_environments
69
- SanitizeEmail::Config.config[:local_environments]
70
- end
64
+ def method_missing(name, *_args)
65
+ if name
66
+ SanitizeEmail[name]
67
+ else
68
+ super
69
+ end
70
+ end
71
71
 
72
- def self.activate?(message)
73
- proc = SanitizeEmail::Config.config[:activation_proc]
74
- proc.call(message) if proc.respond_to?(:call)
75
- end
72
+ def respond_to_missing?(method_name, include_private = false)
73
+ method_name ? method_name : super
74
+ end
76
75
 
77
- class << self
78
- attr_accessor :force_sanitize
79
- end
80
- @force_sanitize = nil
76
+ # NOTE: Deprecated method
77
+ # We have to actually define because we can't deprecate methods that are hooked up via method_missing
78
+ def sanitized_recipients
79
+ # NOOP - This method is never actually executed, because the deprecations redirects the call to sanitized_to
80
+ end
81
81
 
82
- # Regardless of the Config settings of SanitizeEmail you can do a local
83
- # override to send sanitary email in any environment.
84
- # You have access to all the same configuration options in the parameter hash
85
- # as you can set in the actual SanitizeEmail.configure block.
86
- #
87
- # SanitizeEmail.sanitary({:sanitized_to => "boo@example.com"}) do
88
- # Mail.deliver do
89
- # from "from@example.org"
90
- # # Will actually be sent to the override addresses, not this one:
91
- # to "to@example.org"
92
- # reply_to "reply_to@example.org"
93
- # subject "subject"
94
- # end
95
- # end
96
- #
97
- def self.sanitary(config_options = {})
98
- raise MissingBlockParameter, "SanitizeEmail.sanitary must be called with a block" unless block_given?
99
- janitor(forcing: true) do
100
- original = SanitizeEmail::Config.config.dup
101
- SanitizeEmail::Config.config.merge!(config_options)
102
- yield
103
- SanitizeEmail::Config.config = original
82
+ # NOTE: Deprecated method
83
+ # We have to actually define because we can't deprecate methods that are hooked up via method_missing
84
+ def local_environments
85
+ SanitizeEmail::Config.config[:local_environments]
104
86
  end
105
- end
106
87
 
107
- # Regardless of the Config settings of SanitizeEmail you can do a local
108
- # override to force unsanitary email in any environment.
109
- #
110
- # SanitizeEmail.unsanitary do
111
- # Mail.deliver do
112
- # from "from@example.org"
113
- # to "to@example.org"
114
- # reply_to "reply_to@example.org"
115
- # subject "subject"
116
- # end
117
- # end
118
- #
119
- def self.unsanitary
120
- raise MissingBlockParameter, "SanitizeEmail.unsanitary must be called with a block" unless block_given?
121
- janitor(forcing: false) do
122
- yield
88
+ def activate?(message)
89
+ proc = SanitizeEmail::Config.config[:activation_proc]
90
+ proc.call(message) if proc.respond_to?(:call)
123
91
  end
124
- end
125
92
 
126
- def self.janitor(options)
127
- raise MissingBlockParameter, "SanitizeEmail.janitor must be called with a block" unless block_given?
128
- original = SanitizeEmail.force_sanitize
129
- SanitizeEmail.force_sanitize = options[:forcing]
130
- yield
131
- SanitizeEmail.force_sanitize = original
132
- end
93
+ # Regardless of the Config settings of SanitizeEmail you can do a local
94
+ # override to send sanitary email in any environment.
95
+ # You have access to all the same configuration options in the parameter hash
96
+ # as you can set in the actual SanitizeEmail.configure block.
97
+ #
98
+ # SanitizeEmail.sanitary({:sanitized_to => "boo@example.com"}) do
99
+ # Mail.deliver do
100
+ # from "from@example.org"
101
+ # # Will actually be sent to the override addresses, not this one:
102
+ # to "to@example.org"
103
+ # reply_to "reply_to@example.org"
104
+ # subject "subject"
105
+ # end
106
+ # end
107
+ #
108
+ def sanitary(config_options = {})
109
+ raise MissingBlockParameter, "SanitizeEmail.sanitary must be called with a block" unless block_given?
110
+ janitor(forcing: true) do
111
+ original = SanitizeEmail::Config.config.dup
112
+ SanitizeEmail::Config.config.merge!(config_options)
113
+ yield
114
+ SanitizeEmail::Config.config = original
115
+ end
116
+ end
117
+
118
+ # Regardless of the Config settings of SanitizeEmail you can do a local
119
+ # override to force unsanitary email in any environment.
120
+ #
121
+ # SanitizeEmail.unsanitary do
122
+ # Mail.deliver do
123
+ # from "from@example.org"
124
+ # to "to@example.org"
125
+ # reply_to "reply_to@example.org"
126
+ # subject "subject"
127
+ # end
128
+ # end
129
+ #
130
+ def unsanitary
131
+ raise MissingBlockParameter, "SanitizeEmail.unsanitary must be called with a block" unless block_given?
132
+ janitor(forcing: false) do
133
+ yield
134
+ end
135
+ end
136
+
137
+ def janitor(options)
138
+ raise MissingBlockParameter, "SanitizeEmail.janitor must be called with a block" unless block_given?
139
+ original = SanitizeEmail.force_sanitize
140
+ SanitizeEmail.force_sanitize = options[:forcing]
141
+ yield
142
+ SanitizeEmail.force_sanitize = original
143
+ end
133
144
 
134
- # Setup Deprecations!
135
- class << self
136
- extend SanitizeEmail::Deprecation
137
145
  deprecated_alias :sanitized_recipients, :sanitized_to
138
146
  deprecated :local_environments, :activation_proc
139
147
  end
148
+ @force_sanitize = nil
140
149
  end
141
150
 
142
151
  SanitizeEmail::Version.class_eval do
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitize_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -38,7 +38,7 @@ cert_chain:
38
38
  KuxrfYrN+9HvMdm+nZ6TypmKftHY3Gj+/uu+g8Icm/zrvTWAEE0mcJOkfrIoNPJb
39
39
  pF8dMA==
40
40
  -----END CERTIFICATE-----
41
- date: 2024-04-18 00:00:00.000000000 Z
41
+ date: 2024-04-25 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: mail
@@ -74,82 +74,62 @@ dependencies:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: 1.1.4
77
- - !ruby/object:Gem::Dependency
78
- name: actionmailer
79
- requirement: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '3'
84
- type: :development
85
- prerelease: false
86
- version_requirements: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: '3'
91
77
  - !ruby/object:Gem::Dependency
92
78
  name: appraisal
93
79
  requirement: !ruby/object:Gem::Requirement
94
80
  requirements:
95
81
  - - "~>"
96
82
  - !ruby/object:Gem::Version
97
- version: '2'
83
+ version: '2.5'
98
84
  type: :development
99
85
  prerelease: false
100
86
  version_requirements: !ruby/object:Gem::Requirement
101
87
  requirements:
102
88
  - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: '2'
90
+ version: '2.5'
105
91
  - !ruby/object:Gem::Dependency
106
- name: rails
92
+ name: json
107
93
  requirement: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - ">="
110
96
  - !ruby/object:Gem::Version
111
- version: '3.0'
112
- - - "<="
113
- - !ruby/object:Gem::Version
114
- version: '8'
97
+ version: 1.7.7
115
98
  type: :development
116
99
  prerelease: false
117
100
  version_requirements: !ruby/object:Gem::Requirement
118
101
  requirements:
119
102
  - - ">="
120
103
  - !ruby/object:Gem::Version
121
- version: '3.0'
122
- - - "<="
123
- - !ruby/object:Gem::Version
124
- version: '8'
104
+ version: 1.7.7
125
105
  - !ruby/object:Gem::Dependency
126
106
  name: rake
127
107
  requirement: !ruby/object:Gem::Requirement
128
108
  requirements:
129
109
  - - ">="
130
110
  - !ruby/object:Gem::Version
131
- version: '12'
111
+ version: 0.8.7
132
112
  type: :development
133
113
  prerelease: false
134
114
  version_requirements: !ruby/object:Gem::Requirement
135
115
  requirements:
136
116
  - - ">="
137
117
  - !ruby/object:Gem::Version
138
- version: '12'
118
+ version: 0.8.7
139
119
  - !ruby/object:Gem::Dependency
140
120
  name: rdoc
141
121
  requirement: !ruby/object:Gem::Requirement
142
122
  requirements:
143
123
  - - ">="
144
124
  - !ruby/object:Gem::Version
145
- version: '3.12'
125
+ version: '3'
146
126
  type: :development
147
127
  prerelease: false
148
128
  version_requirements: !ruby/object:Gem::Requirement
149
129
  requirements:
150
130
  - - ">="
151
131
  - !ruby/object:Gem::Version
152
- version: '3.12'
132
+ version: '3'
153
133
  - !ruby/object:Gem::Dependency
154
134
  name: rspec
155
135
  requirement: !ruby/object:Gem::Requirement
@@ -237,10 +217,10 @@ licenses:
237
217
  - MIT
238
218
  metadata:
239
219
  homepage_uri: https://github.com/pboling/sanitize_email
240
- source_code_uri: https://github.com/pboling/sanitize_email/tree/v2.0.5
241
- changelog_uri: https://github.com/pboling/sanitize_email/blob/v2.0.5/CHANGELOG.md
220
+ source_code_uri: https://github.com/pboling/sanitize_email/tree/v2.0.6
221
+ changelog_uri: https://github.com/pboling/sanitize_email/blob/v2.0.6/CHANGELOG.md
242
222
  bug_tracker_uri: https://github.com/pboling/sanitize_email/issues
243
- documentation_uri: https://www.rubydoc.info/gems/sanitize_email/2.0.5
223
+ documentation_uri: https://www.rubydoc.info/gems/sanitize_email/2.0.6
244
224
  wiki_uri: https://github.com/pboling/sanitize_email/wiki
245
225
  funding_uri: https://liberapay.com/pboling
246
226
  rubygems_mfa_required: 'true'
metadata.gz.sig CHANGED
Binary file