sanitize_email 2.0.0 → 2.0.1
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/.gitignore +1 -0
- data/.rubocop.yml +73 -0
- data/.rubocop_rspec.yml +35 -0
- data/.rubocop_todo.yml +21 -0
- data/Appraisals +48 -46
- data/Gemfile +14 -1
- data/Rakefile +24 -22
- data/gemfiles/rails_4_2.gemfile +8 -6
- data/gemfiles/rails_5_0.gemfile +8 -6
- data/gemfiles/rails_5_1.gemfile +8 -6
- data/gemfiles/rails_5_2.gemfile +8 -6
- data/init.rb +2 -1
- data/lib/sanitize_email.rb +23 -22
- data/lib/sanitize_email/bleach.rb +24 -24
- data/lib/sanitize_email/config.rb +23 -15
- data/lib/sanitize_email/deprecation.rb +3 -2
- data/lib/sanitize_email/engine.rb +2 -2
- data/lib/sanitize_email/mail_ext.rb +2 -0
- data/lib/sanitize_email/mail_header_tools.rb +16 -17
- data/lib/sanitize_email/overridden_addresses.rb +52 -52
- data/lib/sanitize_email/railtie.rb +2 -2
- data/lib/sanitize_email/rspec_matchers.rb +17 -16
- data/lib/sanitize_email/test_helpers.rb +10 -12
- data/lib/sanitize_email/version.rb +3 -1
- data/sanitize_email.gemspec +34 -32
- data/spec/sanitize_email_spec.rb +476 -480
- data/spec/spec_helper.rb +11 -10
- metadata +42 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01fa948760859a93fec72f7222ef550a8d14fb1366181977d5c951c127b3c5f5
|
4
|
+
data.tar.gz: 0c39cdac07dad7125f8644e69a10ce019e645f75cfde524f0ef389bb00bc2453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8d523a93e0ddb26df9d244b93e4a11256fe8da667b88a08af0fad36da07b3adac86a9b2c82404805cbb532d17718cd3788691e103b903fe88527e510e37278e
|
7
|
+
data.tar.gz: 5a29e1bb4b70cd51ae401d7d789484a904881ae2431f3296fcc89c8daf7d055d05cc4ed191763aab3a2962cdbd8e34ace6434ed4fdc97f93bfef2ca84a397cc3
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
inherit_from:
|
3
|
+
- .rubocop_todo.yml
|
4
|
+
- .rubocop_rspec.yml
|
5
|
+
AllCops:
|
6
|
+
DisplayCopNames: true # Display the name of the failing cops
|
7
|
+
TargetRubyVersion: 2.3
|
8
|
+
Exclude:
|
9
|
+
- 'gemfiles/vendor/**/*'
|
10
|
+
- 'vendor/**/*'
|
11
|
+
- '**/.irbrc'
|
12
|
+
|
13
|
+
Gemspec/RequiredRubyVersion:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/BlockNesting:
|
20
|
+
Max: 2
|
21
|
+
|
22
|
+
Metrics/LineLength:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/MethodLength:
|
26
|
+
Max: 15
|
27
|
+
|
28
|
+
Metrics/ParameterLists:
|
29
|
+
Max: 4
|
30
|
+
|
31
|
+
Layout/AccessModifierIndentation:
|
32
|
+
EnforcedStyle: outdent
|
33
|
+
|
34
|
+
Layout/DotPosition:
|
35
|
+
EnforcedStyle: trailing
|
36
|
+
|
37
|
+
Layout/SpaceInsideHashLiteralBraces:
|
38
|
+
EnforcedStyle: no_space
|
39
|
+
|
40
|
+
Lint/UnusedBlockArgument:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/**/*.rb'
|
43
|
+
- 'gemfiles/vendor/**/*'
|
44
|
+
- 'vendor/**/*'
|
45
|
+
- '**/.irbrc'
|
46
|
+
|
47
|
+
Style/ClassVars:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Style/CollectionMethods:
|
51
|
+
PreferredMethods:
|
52
|
+
map: 'collect'
|
53
|
+
reduce: 'inject'
|
54
|
+
find: 'detect'
|
55
|
+
find_all: 'select'
|
56
|
+
|
57
|
+
Style/Documentation:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Style/DoubleNegation:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/EmptyMethod:
|
64
|
+
EnforcedStyle: expanded
|
65
|
+
|
66
|
+
Style/Encoding:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
Style/TrailingCommaInArrayLiteral:
|
70
|
+
EnforcedStyleForMultiline: comma
|
71
|
+
|
72
|
+
Style/TrailingCommaInHashLiteral:
|
73
|
+
EnforcedStyleForMultiline: comma
|
data/.rubocop_rspec.yml
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
RSpec/FilePath:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
RSpec/MultipleExpectations:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
RSpec/NamedSubject:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
RSpec/ExampleLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
RSpec/VerifiedDoubles:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
RSpec/MessageSpies:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
RSpec/InstanceVariable:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
RSpec/NestedGroups:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
RSpec/ContextWording:
|
26
|
+
Enabled: false
|
27
|
+
|
28
|
+
RSpec/RepeatedExample:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Metrics/AbcSize:
|
32
|
+
Enabled: false
|
33
|
+
|
34
|
+
Style/ClassAndModuleChildren:
|
35
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Style/HashSyntax:
|
2
|
+
EnforcedStyle: hash_rockets
|
3
|
+
|
4
|
+
Style/Lambda:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/SymbolArray:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Style/EachWithObject:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Once we drop Rubies that lack support for __dir__ we can turn this on.
|
14
|
+
Style/ExpandPathArguments:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Style/CommentedKeyword:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/MethodMissing:
|
21
|
+
Enabled: false
|
data/Appraisals
CHANGED
@@ -1,55 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
appraise 'rails-3-0' do
|
4
|
+
gem 'rails', '~> 3.0.0'
|
5
|
+
gem 'reek', '~> 2.0' # for Ruby < 2.0
|
6
|
+
gem 'tins', '~> 1.6.0' # for Ruby < 2.0
|
7
|
+
gem 'json', '~> 1.8.3'
|
8
|
+
gem 'rake', '~> 11.2.2'
|
9
|
+
gem 'rest-client', '~> 1.8.0'
|
8
10
|
end
|
9
|
-
appraise
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
appraise 'rails-3-1' do
|
12
|
+
gem 'actionmailer', '~> 3.1.0'
|
13
|
+
gem 'railties', '~> 3.1.0'
|
14
|
+
gem 'reek', '~> 2.0' # for Ruby < 2.0
|
15
|
+
gem 'tins', '~> 1.6.0' # for Ruby < 2.0
|
16
|
+
gem 'json', '~> 1.8.3'
|
17
|
+
gem 'rake', '~> 11.2.2'
|
18
|
+
gem 'rest-client', '~> 1.8.0'
|
17
19
|
end
|
18
|
-
appraise
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
appraise 'rails-3-2' do
|
21
|
+
gem 'actionmailer', '~> 3.2.0'
|
22
|
+
gem 'railties', '~> 3.2.0'
|
23
|
+
# reek >= 4.0 requires Ruby 2.1 minimum
|
24
|
+
gem 'reek', '~>3.11.0'
|
25
|
+
gem 'json', '~> 1.8.3'
|
26
|
+
gem 'rake', '~> 11.2.2'
|
25
27
|
end
|
26
28
|
|
27
|
-
appraise
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
appraise 'rails-4-0' do
|
30
|
+
gem 'actionmailer', '~> 4.0.0'
|
31
|
+
gem 'railties', '~> 4.0.0'
|
32
|
+
# reek >= 4.0 requires Ruby 2.1 minimum
|
33
|
+
gem 'reek', '~>3.11.0'
|
34
|
+
gem 'json', '~> 1.8.3'
|
35
|
+
gem 'rake', '~> 11.2.2'
|
34
36
|
end
|
35
|
-
appraise
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
appraise 'rails-4-1' do
|
38
|
+
gem 'actionmailer', '~> 4.1.0'
|
39
|
+
gem 'railties', '~> 4.1.0'
|
40
|
+
# reek >= 4.0 requires Ruby 2.1 minimum
|
41
|
+
gem 'reek', '~>3.11.0'
|
42
|
+
gem 'json', '~> 1.8.3'
|
43
|
+
gem 'rake', '~> 11.2.2'
|
42
44
|
end
|
43
|
-
appraise
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
appraise 'rails-4-2' do
|
46
|
+
gem 'actionmailer', '~> 4.2.0'
|
47
|
+
gem 'railties', '~> 4.2.0'
|
48
|
+
gem 'json', '~> 1.8.3'
|
49
|
+
gem 'rake', '~> 11.2.2'
|
48
50
|
end
|
49
51
|
|
50
|
-
appraise
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
appraise 'rails-5-0' do
|
53
|
+
gem 'actionmailer', '~> 5.0.0'
|
54
|
+
gem 'railties', '~> 5.0.0'
|
55
|
+
gem 'json', '~> 2.0.2'
|
56
|
+
gem 'rake', '~> 11.2.2'
|
55
57
|
end
|
data/Gemfile
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
9
|
+
if ruby_version >= Gem::Version.new('2.1')
|
10
|
+
gem 'rubocop', '~> 0.53.0'
|
11
|
+
gem 'rubocop-rspec', '~> 1.24.0'
|
12
|
+
end
|
13
|
+
gem 'byebug' if ruby_version >= Gem::Version.new('2.0')
|
14
|
+
end
|
2
15
|
|
3
16
|
# Specify your gem's dependencies in sanitize_email.gemspec
|
4
17
|
gemspec
|
data/Rakefile
CHANGED
@@ -1,50 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require
|
6
|
-
require
|
1
|
+
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# !/usr/bin/env rake
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
require 'bundler/gem_tasks'
|
8
|
+
require 'rake'
|
7
9
|
|
8
10
|
begin
|
9
|
-
require
|
10
|
-
require
|
11
|
+
require 'wwtd/tasks'
|
12
|
+
require 'rspec/core/rake_task'
|
11
13
|
RSpec::Core::RakeTask.new(:spec)
|
12
14
|
task :default => :spec
|
13
15
|
task :test => :spec
|
14
16
|
rescue LoadError
|
15
|
-
warn
|
17
|
+
warn 'Failed to load rspec or wwtd'
|
16
18
|
end
|
17
19
|
|
18
20
|
begin
|
19
|
-
require
|
21
|
+
require 'reek/rake/task'
|
20
22
|
Reek::Rake::Task.new do |t|
|
21
23
|
t.fail_on_error = true
|
22
24
|
t.verbose = false
|
23
|
-
t.source_files =
|
25
|
+
t.source_files = 'lib/**/*.rb'
|
24
26
|
end
|
25
27
|
rescue LoadError
|
26
|
-
warn
|
28
|
+
warn 'Failed to load reek'
|
27
29
|
end
|
28
30
|
|
29
31
|
begin
|
30
|
-
require
|
31
|
-
require
|
32
|
+
require 'roodi'
|
33
|
+
require 'roodi_task'
|
32
34
|
RoodiTask.new do |t|
|
33
35
|
t.verbose = false
|
34
36
|
end
|
35
37
|
rescue LoadError
|
36
|
-
warn
|
38
|
+
warn 'Failed to load roodi'
|
37
39
|
end
|
38
40
|
|
39
|
-
require File.expand_path(
|
40
|
-
require
|
41
|
-
require
|
41
|
+
require File.expand_path('lib/sanitize_email/version', __dir__)
|
42
|
+
require 'rdoc'
|
43
|
+
require 'rdoc/task'
|
42
44
|
RDoc::Task.new do |rdoc|
|
43
|
-
rdoc.rdoc_dir =
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
46
|
rdoc.title = "SanitizeEmail #{SanitizeEmail::VERSION}"
|
45
|
-
rdoc.options <<
|
46
|
-
rdoc.rdoc_files.include(
|
47
|
-
rdoc.rdoc_files.include(
|
47
|
+
rdoc.options << '--line-numbers'
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
48
50
|
end
|
49
51
|
|
50
52
|
Bundler::GemHelper.install_tasks
|
data/gemfiles/rails_4_2.gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file was generated by Appraisal
|
2
4
|
|
3
|
-
source
|
5
|
+
source 'http://rubygems.org'
|
4
6
|
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
7
|
+
gem 'actionmailer', '~> 4.2.0'
|
8
|
+
gem 'json', '~> 2.1'
|
9
|
+
gem 'railties', '~> 4.2.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
9
11
|
|
10
|
-
gemspec :path =>
|
12
|
+
gemspec :path => '../'
|
data/gemfiles/rails_5_0.gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file was generated by Appraisal
|
2
4
|
|
3
|
-
source
|
5
|
+
source 'http://rubygems.org'
|
4
6
|
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
7
|
+
gem 'actionmailer', '~> 5.0.0'
|
8
|
+
gem 'json', '~> 2.1'
|
9
|
+
gem 'railties', '~> 5.0.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
9
11
|
|
10
|
-
gemspec :path =>
|
12
|
+
gemspec :path => '../'
|
data/gemfiles/rails_5_1.gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file was generated by Appraisal
|
2
4
|
|
3
|
-
source
|
5
|
+
source 'http://rubygems.org'
|
4
6
|
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
7
|
+
gem 'actionmailer', '~> 5.1.0'
|
8
|
+
gem 'json', '~> 2.1'
|
9
|
+
gem 'railties', '~> 5.1.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
9
11
|
|
10
|
-
gemspec :path =>
|
12
|
+
gemspec :path => '../'
|
data/gemfiles/rails_5_2.gemfile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file was generated by Appraisal
|
2
4
|
|
3
|
-
source
|
5
|
+
source 'http://rubygems.org'
|
4
6
|
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
7
|
+
gem 'actionmailer', '5.2.0'
|
8
|
+
gem 'json', '~> 2.1'
|
9
|
+
gem 'railties', '5.2.0'
|
10
|
+
gem 'rake', '~> 12.0'
|
9
11
|
|
10
|
-
gemspec :path =>
|
12
|
+
gemspec :path => '../'
|
data/init.rb
CHANGED
data/lib/sanitize_email.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Copyright (c) 2008-16 Peter H. Boling of RailsBling.com
|
2
4
|
# Released under the MIT license
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require "sanitize_email/bleach"
|
6
|
+
require 'sanitize_email/version'
|
7
|
+
require 'sanitize_email/deprecation'
|
8
|
+
require 'sanitize_email/config'
|
9
|
+
require 'sanitize_email/mail_header_tools'
|
10
|
+
require 'sanitize_email/overridden_addresses'
|
11
|
+
require 'sanitize_email/bleach'
|
11
12
|
|
13
|
+
module SanitizeEmail
|
12
14
|
# Error is raised when a block parameter is required and not provided to a method
|
13
15
|
class MissingBlockParameter < StandardError; end
|
14
16
|
|
15
17
|
# Allow non-rails implementations to use this gem
|
16
18
|
if defined?(::Rails)
|
17
19
|
if defined?(::Rails::Engine)
|
18
|
-
require
|
19
|
-
elsif ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR
|
20
|
-
require
|
20
|
+
require 'sanitize_email/engine'
|
21
|
+
elsif ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR.zero?
|
22
|
+
require 'sanitize_email/railtie'
|
21
23
|
else
|
22
|
-
raise
|
24
|
+
raise 'Please use the 0.X.X versions of sanitize_email for Rails 2.X and below.'
|
23
25
|
end
|
24
26
|
else
|
25
27
|
if defined?(Mailer)
|
@@ -30,7 +32,7 @@ module SanitizeEmail
|
|
30
32
|
if mailer.respond_to?(:register_interceptor)
|
31
33
|
mailer.register_interceptor(SanitizeEmail::Bleach)
|
32
34
|
else
|
33
|
-
warn
|
35
|
+
warn 'SanitizeEmail was unable to detect a compatible Mail class to register an interceptor on.'
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
@@ -39,7 +41,7 @@ module SanitizeEmail
|
|
39
41
|
SanitizeEmail::Config.config[key.to_sym]
|
40
42
|
end
|
41
43
|
|
42
|
-
def self.method_missing(name, *
|
44
|
+
def self.method_missing(name, *_args)
|
43
45
|
SanitizeEmail[name]
|
44
46
|
end
|
45
47
|
|
@@ -80,9 +82,9 @@ module SanitizeEmail
|
|
80
82
|
# end
|
81
83
|
# end
|
82
84
|
#
|
83
|
-
def self.sanitary(config_options = {}
|
84
|
-
raise MissingBlockParameter,
|
85
|
-
janitor(
|
85
|
+
def self.sanitary(config_options = {})
|
86
|
+
raise MissingBlockParameter, 'SanitizeEmail.sanitary must be called with a block' unless block_given?
|
87
|
+
janitor(:forcing => true) do
|
86
88
|
original = SanitizeEmail::Config.config.dup
|
87
89
|
SanitizeEmail::Config.config.merge!(config_options)
|
88
90
|
yield
|
@@ -102,15 +104,15 @@ module SanitizeEmail
|
|
102
104
|
# end
|
103
105
|
# end
|
104
106
|
#
|
105
|
-
def self.unsanitary
|
106
|
-
raise MissingBlockParameter,
|
107
|
-
janitor(
|
107
|
+
def self.unsanitary
|
108
|
+
raise MissingBlockParameter, 'SanitizeEmail.unsanitary must be called with a block' unless block_given?
|
109
|
+
janitor(:forcing => false) do
|
108
110
|
yield
|
109
111
|
end
|
110
112
|
end
|
111
113
|
|
112
|
-
def self.janitor(options
|
113
|
-
raise MissingBlockParameter,
|
114
|
+
def self.janitor(options)
|
115
|
+
raise MissingBlockParameter, 'SanitizeEmail.janitor must be called with a block' unless block_given?
|
114
116
|
original = SanitizeEmail.force_sanitize
|
115
117
|
SanitizeEmail.force_sanitize = options[:forcing]
|
116
118
|
yield
|
@@ -123,5 +125,4 @@ module SanitizeEmail
|
|
123
125
|
deprecated_alias :sanitized_recipients, :sanitized_to
|
124
126
|
deprecated :local_environments, :activation_proc
|
125
127
|
end
|
126
|
-
|
127
128
|
end
|