email_assessor 0.8.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/blacklisted_domains/_prioritization.txt +1 -0
  3. data/assets/data/disposable_domains/0.txt +723 -0
  4. data/assets/data/disposable_domains/1.txt +1500 -0
  5. data/assets/data/disposable_domains/2.txt +1267 -0
  6. data/assets/data/disposable_domains/3.txt +1078 -0
  7. data/assets/data/disposable_domains/4.txt +854 -0
  8. data/assets/data/disposable_domains/5.txt +793 -0
  9. data/assets/data/disposable_domains/6.txt +900 -0
  10. data/assets/data/disposable_domains/7.txt +787 -0
  11. data/assets/data/disposable_domains/8.txt +979 -0
  12. data/assets/data/disposable_domains/9.txt +843 -0
  13. data/assets/data/disposable_domains/_prioritization.txt +1 -0
  14. data/assets/data/disposable_domains/a.txt +10167 -0
  15. data/assets/data/disposable_domains/b.txt +10443 -0
  16. data/assets/data/disposable_domains/c.txt +10152 -0
  17. data/assets/data/disposable_domains/d.txt +7619 -0
  18. data/assets/data/disposable_domains/e.txt +5689 -0
  19. data/assets/data/disposable_domains/f.txt +6375 -0
  20. data/assets/data/disposable_domains/g.txt +6309 -0
  21. data/assets/data/disposable_domains/h.txt +6204 -0
  22. data/assets/data/disposable_domains/i.txt +4814 -0
  23. data/assets/data/disposable_domains/j.txt +3163 -0
  24. data/assets/data/disposable_domains/k.txt +4308 -0
  25. data/assets/data/disposable_domains/l.txt +5903 -0
  26. data/assets/data/disposable_domains/m.txt +11177 -0
  27. data/assets/data/disposable_domains/n.txt +4895 -0
  28. data/assets/data/disposable_domains/o.txt +4161 -0
  29. data/assets/data/disposable_domains/p.txt +8264 -0
  30. data/assets/data/disposable_domains/q.txt +1493 -0
  31. data/assets/data/disposable_domains/r.txt +6199 -0
  32. data/assets/data/disposable_domains/s.txt +12775 -0
  33. data/assets/data/disposable_domains/t.txt +9496 -0
  34. data/assets/data/disposable_domains/u.txt +2662 -0
  35. data/assets/data/disposable_domains/v.txt +3766 -0
  36. data/assets/data/disposable_domains/w.txt +4633 -0
  37. data/assets/data/disposable_domains/x.txt +2449 -0
  38. data/assets/data/disposable_domains/y.txt +2278 -0
  39. data/assets/data/disposable_domains/z.txt +2035 -0
  40. data/assets/data/disposable_domains//351/231/270.txt +1 -0
  41. data/assets/data/disposable_domains//353/234/203.txt +1 -0
  42. data/assets/data/educational_domains/5.txt +1 -0
  43. data/assets/data/educational_domains/_prioritization.txt +1 -0
  44. data/assets/data/educational_domains/a.txt +232 -0
  45. data/assets/data/educational_domains/b.txt +112 -0
  46. data/assets/data/educational_domains/c.txt +126 -0
  47. data/assets/data/educational_domains/d.txt +90 -0
  48. data/assets/data/educational_domains/e.txt +331 -0
  49. data/assets/data/educational_domains/f.txt +156 -0
  50. data/assets/data/educational_domains/g.txt +75 -0
  51. data/assets/data/educational_domains/h.txt +147 -0
  52. data/assets/data/educational_domains/i.txt +179 -0
  53. data/assets/data/educational_domains/j.txt +26 -0
  54. data/assets/data/educational_domains/k.txt +142 -0
  55. data/assets/data/educational_domains/l.txt +88 -0
  56. data/assets/data/educational_domains/m.txt +155 -0
  57. data/assets/data/educational_domains/n.txt +98 -0
  58. data/assets/data/educational_domains/o.txt +39 -0
  59. data/assets/data/educational_domains/p.txt +128 -0
  60. data/assets/data/educational_domains/q.txt +4 -0
  61. data/assets/data/educational_domains/r.txt +69 -0
  62. data/assets/data/educational_domains/s.txt +251 -0
  63. data/assets/data/educational_domains/t.txt +146 -0
  64. data/assets/data/educational_domains/u.txt +975 -0
  65. data/assets/data/educational_domains/v.txt +78 -0
  66. data/assets/data/educational_domains/w.txt +59 -0
  67. data/assets/data/educational_domains/x.txt +1 -0
  68. data/assets/data/educational_domains/y.txt +17 -0
  69. data/assets/data/educational_domains/z.txt +13 -0
  70. data/assets/data/fastpass_domains/_prioritization.txt +1 -0
  71. data/assets/data/fastpass_domains/a.txt +2 -0
  72. data/assets/data/fastpass_domains/c.txt +3 -0
  73. data/assets/data/fastpass_domains/d.txt +1 -0
  74. data/assets/data/fastpass_domains/f.txt +1 -0
  75. data/assets/data/fastpass_domains/g.txt +5 -0
  76. data/assets/data/fastpass_domains/h.txt +33 -0
  77. data/assets/data/fastpass_domains/i.txt +1 -0
  78. data/assets/data/fastpass_domains/l.txt +6 -0
  79. data/assets/data/fastpass_domains/m.txt +4 -0
  80. data/assets/data/fastpass_domains/o.txt +28 -0
  81. data/assets/data/fastpass_domains/p.txt +3 -0
  82. data/assets/data/fastpass_domains/r.txt +1 -0
  83. data/assets/data/fastpass_domains/s.txt +3 -0
  84. data/assets/data/fastpass_domains/t.txt +1 -0
  85. data/assets/data/fastpass_domains/w.txt +2 -0
  86. data/assets/data/fastpass_domains/y.txt +42 -0
  87. data/lib/email_assessor/address.rb +27 -26
  88. data/lib/email_assessor/directory_domain_list.rb +51 -0
  89. data/lib/email_assessor/domain_token_set.rb +46 -0
  90. data/lib/email_assessor/email_validator.rb +0 -16
  91. data/lib/email_assessor/empty_domain_list.rb +23 -0
  92. data/lib/email_assessor/file_domain_list.rb +23 -0
  93. data/lib/email_assessor/version.rb +1 -1
  94. data/lib/email_assessor.rb +64 -17
  95. metadata +94 -22
  96. data/.gitignore +0 -18
  97. data/.travis.yml +0 -9
  98. data/CHANGELOG.md +0 -9
  99. data/Gemfile +0 -4
  100. data/LICENSE.txt +0 -22
  101. data/README.md +0 -132
  102. data/Rakefile +0 -10
  103. data/email_assessor.gemspec +0 -31
  104. data/gemfiles/activemodel4.gemfile +0 -5
  105. data/pull_mailchecker_emails.rb +0 -21
  106. data/spec/email_assessor_spec.rb +0 -209
  107. data/spec/spec_helper.rb +0 -19
  108. data/vendor/disposable_domains.txt +0 -55800
  109. data/vendor/educational_domains.txt +0 -3625
  110. data/vendor/fastpass_domains.txt +0 -35
  111. /data/{vendor/blacklisted_domains.txt → assets/data/blacklisted_domains/b.txt} +0 -0
@@ -1,28 +1,75 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "email_assessor/email_validator"
4
+ require "email_assessor/directory_domain_list"
5
+ require "email_assessor/file_domain_list"
6
+ require "email_assessor/empty_domain_list"
7
+ require "email_assessor/domain_token_set"
3
8
 
4
9
  module EmailAssessor
5
- DISPOSABLE_DOMAINS_FILE_NAME = File.expand_path("../../vendor/disposable_domains.txt", __FILE__)
6
- FASTPASS_DOMAINS_FILE_NAME = File.expand_path("../../vendor/fastpass_domains.txt", __FILE__)
7
- EDUCATIONAL_DOMAINS_FILE_NAME = File.expand_path("../../vendor/educational_domains.txt", __FILE__)
8
- BLACKLISTED_DOMAINS_FILE_NAME = File.expand_path("vendor/blacklisted_domains.txt")
10
+ class << self
11
+ def tokenize_domain(domain)
12
+ EmailAssessor::DomainTokenSet.parse(domain)
13
+ end
9
14
 
10
- def self.domain_is_disposable?(domain)
11
- domain_in_file?(domain, DISPOSABLE_DOMAINS_FILE_NAME)
12
- end
15
+ def [](pathname)
16
+ @domain_list_cache ||= {
17
+ # {pathname} => {domain list}
18
+ }
13
19
 
14
- def self.domain_is_blacklisted?(domain)
15
- domain_in_file?(domain, BLACKLISTED_DOMAINS_FILE_NAME)
16
- end
20
+ return @domain_list_cache[pathname] if @domain_list_cache.key?(pathname)
21
+
22
+ list = if File.directory?(pathname)
23
+ DirectoryDomainList.new(pathname)
24
+ elsif File.file?(pathname)
25
+ FileDomainList.new(pathname)
26
+ end
27
+
28
+ @domain_list_cache[pathname] = list
29
+
30
+ list
31
+ end
32
+
33
+ def disposable_domains
34
+ @disposable_domains ||= default_domain_list("disposable_domains")
35
+ end
36
+
37
+ def disposable_domains=(pathname)
38
+ @disposable_domains = self[pathname]
39
+ end
40
+
41
+ def blacklisted_domains
42
+ @blacklisted_domains ||= default_domain_list("blacklisted_domains")
43
+ end
44
+
45
+ def blacklisted_domains=(pathname)
46
+ @blacklisted_domains = self[pathname]
47
+ end
48
+
49
+ def educational_domains
50
+ @educational_domains ||= default_domain_list("educational_domains")
51
+ end
52
+
53
+ def educational_domains=(pathname)
54
+ @educational_domains = self[pathname]
55
+ end
56
+
57
+ def fastpass_domains
58
+ @fastpass_domains ||= default_domain_list("fastpass_domains")
59
+ end
60
+
61
+ def fastpass_domains=(pathname)
62
+ @fastpass_domains = self[pathname]
63
+ end
17
64
 
18
- def self.domain_in_file?(domain, file_name)
19
- file_name ||= ""
20
- domain = domain.downcase
65
+ private
21
66
 
22
- File.foreach(file_name, chomp: true).any? do |line|
23
- # String#end_with? is used as a cheaper initial check but due to potential false positives
24
- # (hotmail.com is valid but tmail.com is not) regex is also necessary.
25
- domain.end_with?(line) && domain.match?(%r{\A(?:.*\.)?#{Regexp.escape(line)}\z}i)
67
+ def default_domain_list(category)
68
+ self[File.expand_path("../../vendor/#{category}.txt", __FILE__)] ||
69
+ self[File.expand_path("../../vendor/#{category}", __FILE__)] ||
70
+ self[File.expand_path("../../assets/data/#{category}.txt", __FILE__)] ||
71
+ self[File.expand_path("../../assets/data/#{category}", __FILE__)] ||
72
+ EmptyDomainList.instance
26
73
  end
27
74
  end
28
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_assessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wolfe Millard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-10 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,26 +87,100 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - ".gitignore"
91
- - ".travis.yml"
92
- - CHANGELOG.md
93
- - Gemfile
94
- - LICENSE.txt
95
- - README.md
96
- - Rakefile
97
- - email_assessor.gemspec
98
- - gemfiles/activemodel4.gemfile
90
+ - assets/data/blacklisted_domains/_prioritization.txt
91
+ - assets/data/blacklisted_domains/b.txt
92
+ - assets/data/disposable_domains/0.txt
93
+ - assets/data/disposable_domains/1.txt
94
+ - assets/data/disposable_domains/2.txt
95
+ - assets/data/disposable_domains/3.txt
96
+ - assets/data/disposable_domains/4.txt
97
+ - assets/data/disposable_domains/5.txt
98
+ - assets/data/disposable_domains/6.txt
99
+ - assets/data/disposable_domains/7.txt
100
+ - assets/data/disposable_domains/8.txt
101
+ - assets/data/disposable_domains/9.txt
102
+ - assets/data/disposable_domains/_prioritization.txt
103
+ - assets/data/disposable_domains/a.txt
104
+ - assets/data/disposable_domains/b.txt
105
+ - assets/data/disposable_domains/c.txt
106
+ - assets/data/disposable_domains/d.txt
107
+ - assets/data/disposable_domains/e.txt
108
+ - assets/data/disposable_domains/f.txt
109
+ - assets/data/disposable_domains/g.txt
110
+ - assets/data/disposable_domains/h.txt
111
+ - assets/data/disposable_domains/i.txt
112
+ - assets/data/disposable_domains/j.txt
113
+ - assets/data/disposable_domains/k.txt
114
+ - assets/data/disposable_domains/l.txt
115
+ - assets/data/disposable_domains/m.txt
116
+ - assets/data/disposable_domains/n.txt
117
+ - assets/data/disposable_domains/o.txt
118
+ - assets/data/disposable_domains/p.txt
119
+ - assets/data/disposable_domains/q.txt
120
+ - assets/data/disposable_domains/r.txt
121
+ - assets/data/disposable_domains/s.txt
122
+ - assets/data/disposable_domains/t.txt
123
+ - assets/data/disposable_domains/u.txt
124
+ - assets/data/disposable_domains/v.txt
125
+ - assets/data/disposable_domains/w.txt
126
+ - assets/data/disposable_domains/x.txt
127
+ - assets/data/disposable_domains/y.txt
128
+ - assets/data/disposable_domains/z.txt
129
+ - assets/data/disposable_domains/陸.txt
130
+ - assets/data/disposable_domains/뜃.txt
131
+ - assets/data/educational_domains/5.txt
132
+ - assets/data/educational_domains/_prioritization.txt
133
+ - assets/data/educational_domains/a.txt
134
+ - assets/data/educational_domains/b.txt
135
+ - assets/data/educational_domains/c.txt
136
+ - assets/data/educational_domains/d.txt
137
+ - assets/data/educational_domains/e.txt
138
+ - assets/data/educational_domains/f.txt
139
+ - assets/data/educational_domains/g.txt
140
+ - assets/data/educational_domains/h.txt
141
+ - assets/data/educational_domains/i.txt
142
+ - assets/data/educational_domains/j.txt
143
+ - assets/data/educational_domains/k.txt
144
+ - assets/data/educational_domains/l.txt
145
+ - assets/data/educational_domains/m.txt
146
+ - assets/data/educational_domains/n.txt
147
+ - assets/data/educational_domains/o.txt
148
+ - assets/data/educational_domains/p.txt
149
+ - assets/data/educational_domains/q.txt
150
+ - assets/data/educational_domains/r.txt
151
+ - assets/data/educational_domains/s.txt
152
+ - assets/data/educational_domains/t.txt
153
+ - assets/data/educational_domains/u.txt
154
+ - assets/data/educational_domains/v.txt
155
+ - assets/data/educational_domains/w.txt
156
+ - assets/data/educational_domains/x.txt
157
+ - assets/data/educational_domains/y.txt
158
+ - assets/data/educational_domains/z.txt
159
+ - assets/data/fastpass_domains/_prioritization.txt
160
+ - assets/data/fastpass_domains/a.txt
161
+ - assets/data/fastpass_domains/c.txt
162
+ - assets/data/fastpass_domains/d.txt
163
+ - assets/data/fastpass_domains/f.txt
164
+ - assets/data/fastpass_domains/g.txt
165
+ - assets/data/fastpass_domains/h.txt
166
+ - assets/data/fastpass_domains/i.txt
167
+ - assets/data/fastpass_domains/l.txt
168
+ - assets/data/fastpass_domains/m.txt
169
+ - assets/data/fastpass_domains/o.txt
170
+ - assets/data/fastpass_domains/p.txt
171
+ - assets/data/fastpass_domains/r.txt
172
+ - assets/data/fastpass_domains/s.txt
173
+ - assets/data/fastpass_domains/t.txt
174
+ - assets/data/fastpass_domains/w.txt
175
+ - assets/data/fastpass_domains/y.txt
99
176
  - lib/email_assessor.rb
100
177
  - lib/email_assessor/address.rb
178
+ - lib/email_assessor/directory_domain_list.rb
179
+ - lib/email_assessor/domain_token_set.rb
101
180
  - lib/email_assessor/email_validator.rb
181
+ - lib/email_assessor/empty_domain_list.rb
182
+ - lib/email_assessor/file_domain_list.rb
102
183
  - lib/email_assessor/version.rb
103
- - pull_mailchecker_emails.rb
104
- - spec/email_assessor_spec.rb
105
- - spec/spec_helper.rb
106
- - vendor/blacklisted_domains.txt
107
- - vendor/disposable_domains.txt
108
- - vendor/educational_domains.txt
109
- - vendor/fastpass_domains.txt
110
184
  homepage: https://github.com/wolfemm/email_assessor
111
185
  licenses:
112
186
  - MIT
@@ -126,10 +200,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
200
  - !ruby/object:Gem::Version
127
201
  version: '0'
128
202
  requirements: []
129
- rubygems_version: 3.1.6
203
+ rubygems_version: 3.3.7
130
204
  signing_key:
131
205
  specification_version: 4
132
206
  summary: Advanced ActiveModel email validation
133
- test_files:
134
- - spec/email_assessor_spec.rb
135
- - spec/spec_helper.rb
207
+ test_files: []
data/.gitignore DELETED
@@ -1,18 +0,0 @@
1
- .DS_STORE
2
- *.gem
3
- *.rbc
4
- .bundle
5
- .config
6
- .yardoc
7
- Gemfile.lock
8
- InstalledFiles
9
- _yardoc
10
- coverage
11
- doc/
12
- lib/bundler/man
13
- pkg
14
- rdoc
15
- spec/reports
16
- test/tmp
17
- test/version_tmp
18
- tmp
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
-
5
- rvm:
6
- - 2.4.0
7
-
8
- gemfile:
9
- - gemfiles/activemodel4.gemfile
data/CHANGELOG.md DELETED
@@ -1,9 +0,0 @@
1
- ## Version 0.3.8 (November 8th, 2016)
2
- - Add more disposable domains
3
-
4
- ## Version 0.3
5
- - Refactored the logic in `EmailAssessor.domain_in_file?` to be simpler
6
- - Removed configurability in favor of convention over configuration
7
-
8
- ## Version 0.1
9
- Gave this fork its very own name: EmailAssessor
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in email_assessor.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright for portions of this project are held by Micke Lisinge, 2013, as part of valid_email2. All other copyright are held by Michael Wolfe Millard, 2016.
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,132 +0,0 @@
1
- # EmailAssessor
2
- [![Build Status](https://travis-ci.org/wolfemm/email_assessor.png?branch=master)](https://travis-ci.org/wolfemm/email_assessor)
3
- [![Gem Version](https://badge.fury.io/rb/email_assessor.png)](http://badge.fury.io/rb/email_assessor)
4
-
5
- A fork of [Micke Lisinge](https://github.com/lisinge)'s [ValidEmail2](https://github.com/lisinge/valid_email2).
6
-
7
- ValidEmail2:
8
-
9
- * Validates emails with the help of the `mail` gem instead of some clunky regexp.
10
- * Aditionally validates that the domain has a MX record.
11
- * Optionally validates against a static [list of disposable email services](vendor/disposable_domains.txt).
12
-
13
-
14
- ### Why?
15
-
16
- ValidEmail2 offers very comprehensive email validation, but it has a few pitfalls.
17
-
18
- For starters, it loads the entire list of blacklisted/disposable email domains into memory from a YAML file. In a never ending battle against spam, loading such an extremely large (and ever-growing) array into memory is far from ideal. Instead, EmailAssessor reads a text file line-by-line.
19
-
20
- Another pitfall is that subdomains are able to bypass the disposable and blacklist checks in ValidEmail2. EmailAssessor checks if a given domain *ends* with a blacklisted/disposable domain, preventing subdomains from masking an email that would otherwise be considered invalid.
21
-
22
-
23
- ## Installation
24
-
25
- Add this line to your application's Gemfile:
26
-
27
- ```ruby
28
- gem "email_assessor"
29
- ```
30
-
31
- And then execute:
32
-
33
- $ bundle
34
-
35
- Or install it yourself as:
36
-
37
- $ gem install email_assessor
38
-
39
- ## Domain List Files
40
-
41
- Domain list files, used for blacklisting and blocking disposable emails, are plain-text files with one **lower case** domain per line.
42
-
43
- Valid domain list file:
44
- ```
45
- example.com
46
- subdomain.example.org
47
- ```
48
-
49
- Invalid domain list file:
50
- ```
51
- http://example.com
52
- example.com/mail
53
- ```
54
-
55
- Be careful with subdomains. Given the following domain list file:
56
-
57
- ```
58
- sub.example.com
59
- ```
60
-
61
- A user would be able to register with the email `jake@example.com` but not `tom@sub.example.com` or `jerry@deep.sub.example.com`.
62
-
63
- ## Usage
64
-
65
- ### Use with ActiveModel
66
-
67
- If you just want to validate that it is a valid email address:
68
- ```ruby
69
- class User < ActiveRecord::Base
70
- validates :email, presence: true, email: true
71
- end
72
- ```
73
-
74
- To validate that the domain has a MX record:
75
- ```ruby
76
- validates :email, email: { mx: true }
77
- ```
78
-
79
- To validate that the domain is not a disposable email:
80
- ```ruby
81
- validates :email, email: { disposable: true }
82
- ```
83
-
84
- To validate that the domain is not blacklisted (via `vendor/blacklisted_domains.txt`):
85
- ```ruby
86
- validates :email, email: { blacklist: true }
87
- ```
88
-
89
- All together:
90
- ```ruby
91
- validates :email, email: { mx: true, disposable: true, blacklist: true }
92
- ```
93
-
94
- > Note that this gem will let an empty email pass through so you will need to
95
- > add `presence: true` if you require an email
96
-
97
- ### Use without ActiveModel
98
-
99
- ```ruby
100
- address = EmailAssessor::Address.new("lisinge@gmail.com")
101
- address.valid? => true
102
- address.disposable? => false
103
- address.valid_mx? => true
104
- ```
105
-
106
- ### Test environment
107
-
108
- If you are validating `mx` then your specs will fail without an internet connection.
109
- It is a good idea to stub out that validation in your test environment.
110
- Do so by adding this in your `spec_helper`:
111
- ```ruby
112
- config.before(:each) do
113
- allow_any_instance_of(EmailAssessor::Address).to receive(:valid_mx?) { true }
114
- end
115
- ```
116
-
117
- ## Requirements
118
-
119
- This gem requires Rails 3.2 or 4.0. It is tested against both versions using:
120
- * Ruby-1.9
121
- * Ruby-2.0
122
- * Ruby-2.1
123
- * Ruby-2.2
124
- * JRuby-1.9
125
-
126
- ## Contributing
127
-
128
- 1. Fork it
129
- 2. Create your feature branch (`git checkout -b my-new-feature`)
130
- 3. Commit your changes (`git commit -am 'Add some feature'`)
131
- 4. Push to the branch (`git push origin my-new-feature`)
132
- 5. Create new Pull Request
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- desc "Run specs"
5
- RSpec::Core::RakeTask.new do |t|
6
- t.pattern = "spec/**/*_spec.rb"
7
- end
8
-
9
- task :default => [:spec]
10
- task :build => [:spec]
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: UTF-8
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "email_assessor/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "email_assessor"
9
- spec.version = EmailAssessor::VERSION
10
- spec.summary = "Advanced ActiveModel email validation"
11
- spec.description = "Advanced ActiveModel email validation with MX lookups, domain blacklisting and disposable email blocking"
12
-
13
- spec.license = "MIT"
14
-
15
- spec.author = "Michael Wolfe Millard"
16
- spec.email = "wolfemm.development@gmail.com"
17
- spec.homepage = "https://github.com/wolfemm/email_assessor"
18
-
19
- spec.files = `git ls-files`.split($/)
20
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
- spec.require_paths = ["lib"]
23
-
24
- spec.required_ruby_version = ">= 2.4.0"
25
-
26
- spec.add_development_dependency "bundler", "~> 2.0"
27
- spec.add_development_dependency "rake"
28
- spec.add_development_dependency "rspec", "~> 3.4"
29
- spec.add_runtime_dependency "mail", "~> 2.5"
30
- spec.add_runtime_dependency "activemodel", ">= 5.0.2"
31
- end
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activemodel", "~> 5.0.2"
4
-
5
- gemspec path: "../"
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "yaml"
5
-
6
- require "json"
7
- require "net/http"
8
- require "set"
9
-
10
- whitelisted_domains = %w(poczta.onet.pl fastmail.fm hushmail.com naver.com qq.com nus.edu.sg)
11
-
12
- existing_domains = File.readlines("vendor/disposable_domains.txt")
13
-
14
- url = "https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.txt"
15
- resp = Net::HTTP.get_response(URI.parse(url))
16
-
17
- remote_domains = (resp.body.split("\n")) - whitelisted_domains
18
-
19
- result_domains = SortedSet.new((existing_domains + remote_domains).map! { |domain| domain.strip.downcase })
20
-
21
- File.open("vendor/disposable_domains.txt", "w") { |f| f.write result_domains.to_a.join("\n") }