email_data 1601260789 → 1602964602
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/.github/workflows/tests.yml +67 -0
- data/.gitignore +1 -1
- data/.rubocop.yml +14 -1
- data/.tool-versions +1 -1
- data/Gemfile.lock +89 -0
- data/README.md +132 -0
- data/Rakefile +4 -1
- data/VERSION +1 -1
- data/bin/helpers.rb +2 -0
- data/bin/publish +20 -1
- data/bin/publish-gem +2 -6
- data/bin/publish-npm +1 -1
- data/bin/sync-disposable-emails +5 -5
- data/data/country_tlds.txt +1 -0
- data/data/disposable_domains.txt +1823 -29
- data/data/disposable_emails.txt +10 -0
- data/data/free_email_domains.txt +307 -0
- data/data/tlds.txt +0 -1
- data/email_data.gemspec +2 -1
- data/lib/email_data.rb +20 -25
- data/lib/email_data/source/active_record.rb +73 -0
- data/lib/email_data/source/file_system.rb +37 -0
- data/package.json +1 -1
- metadata +22 -5
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68a57adbf3234a937d344be152e4de4473d279de1d2a9afc5039cb7e49b14ea0
|
4
|
+
data.tar.gz: 5f5cba8455f02f644ebb66c68621cd51c14cda3fbbcc9930526f31f74352a5b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba343c31cca846cabfb19cf009bf1664a9cc30ee45389e9620bc2486fd82a3d3bb70fe0cea4de056a79ff80cb9c7e9f7039809ff4a9c9666f72c8241eb0d556
|
7
|
+
data.tar.gz: 546e18b43810c3e3f194ee855af176bf480bf4100c1dc4d6e12cb3d3ae7f634b97e90cc3073e9fcacd67c4212bfae2dca73633680ac435c12ac4829538350bc6
|
@@ -0,0 +1,67 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- main
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
build:
|
13
|
+
name: Tests with Ruby ${{ matrix.ruby }}
|
14
|
+
runs-on: "ubuntu-latest"
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby: ["2.7.x", "2.6.x", "2.5.x"]
|
19
|
+
|
20
|
+
services:
|
21
|
+
postgres:
|
22
|
+
image: postgres:11.5
|
23
|
+
ports: ["5432:5432"]
|
24
|
+
options:
|
25
|
+
--health-cmd pg_isready --health-interval 10s --health-timeout 5s
|
26
|
+
--health-retries 5
|
27
|
+
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v1
|
30
|
+
|
31
|
+
- uses: actions/cache@v2
|
32
|
+
with:
|
33
|
+
path: vendor/bundle
|
34
|
+
key: >
|
35
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
|
36
|
+
hashFiles('**/Gemfile.lock') }}
|
37
|
+
restore-keys: >
|
38
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
|
39
|
+
hashFiles('**/Gemfile.lock') }}
|
40
|
+
|
41
|
+
- name: Set up Ruby
|
42
|
+
uses: actions/setup-ruby@v1
|
43
|
+
with:
|
44
|
+
ruby-version: ${{ matrix.ruby }}
|
45
|
+
|
46
|
+
- name: Install PostgreSQL 11 client
|
47
|
+
run: |
|
48
|
+
sudo apt-get -yqq install libpq-dev
|
49
|
+
|
50
|
+
- name: Install gem dependencies
|
51
|
+
env:
|
52
|
+
PGHOST: localhost
|
53
|
+
PGUSER: postgres
|
54
|
+
RAILS_ENV: test
|
55
|
+
run: |
|
56
|
+
gem install bundler
|
57
|
+
bundle config path vendor/bundle
|
58
|
+
bundle install --jobs 4 --retry 3
|
59
|
+
|
60
|
+
- name: Run Tests
|
61
|
+
env:
|
62
|
+
PGHOST: localhost
|
63
|
+
PGUSER: postgres
|
64
|
+
RAILS_ENV: test
|
65
|
+
run: |
|
66
|
+
psql -U postgres -c "create database test"
|
67
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,5 +3,18 @@ inherit_gem:
|
|
3
3
|
rubocop-fnando: .rubocop.yml
|
4
4
|
|
5
5
|
AllCops:
|
6
|
-
TargetRubyVersion: 2.
|
6
|
+
TargetRubyVersion: 2.5
|
7
7
|
NewCops: enable
|
8
|
+
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Exclude:
|
11
|
+
- test/support/**/*
|
12
|
+
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Exclude:
|
15
|
+
- test/support/**/*
|
16
|
+
|
17
|
+
Metrics/BlockLength:
|
18
|
+
Exclude:
|
19
|
+
- email_data.gemspec
|
20
|
+
- test/support/**/*
|
data/.tool-versions
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
ruby 2.7.
|
1
|
+
ruby 2.7.2
|
2
2
|
nodejs 12.18.4
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
email_data (1602964602)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (6.0.3.4)
|
10
|
+
activesupport (= 6.0.3.4)
|
11
|
+
activerecord (6.0.3.4)
|
12
|
+
activemodel (= 6.0.3.4)
|
13
|
+
activesupport (= 6.0.3.4)
|
14
|
+
activesupport (6.0.3.4)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 0.7, < 2)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
20
|
+
aitch (1.1.0)
|
21
|
+
nokogiri
|
22
|
+
ast (2.4.1)
|
23
|
+
concurrent-ruby (1.1.7)
|
24
|
+
docile (1.3.2)
|
25
|
+
i18n (1.8.5)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
mini_portile2 (2.4.0)
|
28
|
+
minitest (5.14.2)
|
29
|
+
minitest-utils (0.4.6)
|
30
|
+
minitest
|
31
|
+
nokogiri (1.10.10)
|
32
|
+
mini_portile2 (~> 2.4.0)
|
33
|
+
parallel (1.19.2)
|
34
|
+
parser (2.7.2.0)
|
35
|
+
ast (~> 2.4.1)
|
36
|
+
pg (1.2.3)
|
37
|
+
rainbow (3.0.0)
|
38
|
+
rake (13.0.1)
|
39
|
+
regexp_parser (1.8.2)
|
40
|
+
rexml (3.2.4)
|
41
|
+
root_domain (0.1.0)
|
42
|
+
simpleidn
|
43
|
+
rubocop (0.93.1)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 2.7.1.5)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
regexp_parser (>= 1.8)
|
48
|
+
rexml
|
49
|
+
rubocop-ast (>= 0.6.0)
|
50
|
+
ruby-progressbar (~> 1.7)
|
51
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
52
|
+
rubocop-ast (0.8.0)
|
53
|
+
parser (>= 2.7.1.5)
|
54
|
+
rubocop-fnando (0.0.13)
|
55
|
+
ruby-progressbar (1.10.1)
|
56
|
+
simplecov (0.19.0)
|
57
|
+
docile (~> 1.1)
|
58
|
+
simplecov-html (~> 0.11)
|
59
|
+
simplecov-html (0.12.3)
|
60
|
+
simpleidn (0.1.1)
|
61
|
+
unf (~> 0.1.4)
|
62
|
+
thread_safe (0.3.6)
|
63
|
+
tzinfo (1.2.7)
|
64
|
+
thread_safe (~> 0.1)
|
65
|
+
unf (0.1.4)
|
66
|
+
unf_ext
|
67
|
+
unf_ext (0.0.7.7)
|
68
|
+
unicode-display_width (1.7.0)
|
69
|
+
zeitwerk (2.4.0)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
ruby
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
activerecord
|
76
|
+
aitch
|
77
|
+
bundler
|
78
|
+
email_data!
|
79
|
+
minitest
|
80
|
+
minitest-utils
|
81
|
+
pg
|
82
|
+
rake
|
83
|
+
root_domain
|
84
|
+
rubocop
|
85
|
+
rubocop-fnando
|
86
|
+
simplecov
|
87
|
+
|
88
|
+
BUNDLED WITH
|
89
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# EmailData
|
2
2
|
|
3
|
+
- Ruby:
|
4
|
+
[](https://github.com/fnando/email_data/actions?query=workflow%3ATests)
|
5
|
+
[](https://rubygems.org/gems/email_data)
|
6
|
+
[](https://rubygems.org/gems/email_data)
|
7
|
+
- NPM:
|
8
|
+
[](https://www.npmjs.com/package/@fnando/email_data)
|
9
|
+
[](https://www.npmjs.com/package/@fnando/email_data)
|
10
|
+
- License:
|
11
|
+

|
12
|
+
|
3
13
|
This project is a compilation of datasets related to emails.
|
4
14
|
|
5
15
|
- Disposable emails
|
@@ -46,6 +56,128 @@ EmailData.disposable_emails
|
|
46
56
|
EmailData.free_email_domains
|
47
57
|
```
|
48
58
|
|
59
|
+
#### Data sources
|
60
|
+
|
61
|
+
By default, Ruby will load data from filesystem. You may want to load this data
|
62
|
+
from the database instead. `email-data` has support for ActiveRecord out of the
|
63
|
+
box. To use the ActiveRecord adapter, you must load
|
64
|
+
`email_data/source/active_record.rb`. You can easily do it so with Bundler's
|
65
|
+
`require` key.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
gem "email_data", require: "email_data/source/active_record"
|
69
|
+
```
|
70
|
+
|
71
|
+
Then, you need to assign the new data source.
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
EmailData.source = EmailData::Source::ActiveRecord
|
75
|
+
```
|
76
|
+
|
77
|
+
If you need to configure a different database connection than the one defined by
|
78
|
+
`ActiveRecord::Base`, use `EmailData::Source::ActiveRecord::ApplicationRecord`
|
79
|
+
for that.
|
80
|
+
|
81
|
+
##### Creating the tables
|
82
|
+
|
83
|
+
To create the tables, use the migration code below (tweak it accordingly if you
|
84
|
+
use something different than PostgreSQL, or don't want to use `citext`).
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
class SetupEmailData < ActiveRecord::Migration[6.1]
|
88
|
+
def change
|
89
|
+
enable_extension "citext"
|
90
|
+
|
91
|
+
create_table :tlds do |t|
|
92
|
+
t.citext :name, null: false
|
93
|
+
end
|
94
|
+
|
95
|
+
add_index :tlds, :name, unique: true
|
96
|
+
|
97
|
+
create_table :country_tlds do |t|
|
98
|
+
t.citext :name, null: false
|
99
|
+
end
|
100
|
+
|
101
|
+
add_index :country_tlds, :name, unique: true
|
102
|
+
|
103
|
+
create_table :disposable_emails do |t|
|
104
|
+
t.citext :name, null: false
|
105
|
+
end
|
106
|
+
|
107
|
+
add_index :disposable_emails, :name, unique: true
|
108
|
+
|
109
|
+
create_table :disposable_domains do |t|
|
110
|
+
t.citext :name, null: false
|
111
|
+
end
|
112
|
+
|
113
|
+
add_index :disposable_domains, :name, unique: true
|
114
|
+
|
115
|
+
create_table :free_email_domains do |t|
|
116
|
+
t.citext :name, null: false
|
117
|
+
end
|
118
|
+
|
119
|
+
add_index :free_email_domains, :name, unique: true
|
120
|
+
end
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
##### Loading the data
|
125
|
+
|
126
|
+
With PostgreSQL, you load the data using the `COPY` command. First, you'll need
|
127
|
+
to discover where your gems are being installed. Use `gem list` for that.
|
128
|
+
|
129
|
+
```console
|
130
|
+
$ gem list email_data -d
|
131
|
+
|
132
|
+
*** LOCAL GEMS ***
|
133
|
+
|
134
|
+
email_data (1601479967, 1601260789)
|
135
|
+
Author: Nando Vieira
|
136
|
+
Homepage: https://github.com/fnando/email_data
|
137
|
+
License: MIT
|
138
|
+
Installed at (1601479967): /usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0
|
139
|
+
This project is a compilation of datasets related to emails.
|
140
|
+
Includes disposable emails, disposable domains, and free email
|
141
|
+
services.
|
142
|
+
```
|
143
|
+
|
144
|
+
The you can load each dataset using `COPY`:
|
145
|
+
|
146
|
+
```sql
|
147
|
+
COPY tlds (name) FROM '/usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/email_data-1601479967/data/tlds.txt';
|
148
|
+
COPY country_tlds (name) FROM '/usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/email_data-1601479967/data/country_tlds.txt';
|
149
|
+
COPY disposable_emails (name) FROM '/usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/email_data-1601479967/data/disposable_emails.txt';
|
150
|
+
COPY disposable_domains (name) FROM '/usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/email_data-1601479967/data/disposable_domains.txt';
|
151
|
+
COPY free_email_domains (name) FROM '/usr/local/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/email_data-1601479967/data/free_email_domains.txt';
|
152
|
+
```
|
153
|
+
|
154
|
+
Alternatively, you could create a migrate that executes that same command; given
|
155
|
+
that you'd be running Ruby code, you can replace the steps to find the gem path
|
156
|
+
with `EmailData.data_dir`.
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
class LoadEmailData < ActiveRecord::Migration[6.1]
|
160
|
+
def change
|
161
|
+
copy = lambda do |table_name|
|
162
|
+
connection = ActiveRecord::Base.connection
|
163
|
+
data_path = EmailData.data_dir
|
164
|
+
|
165
|
+
connection.execute <<~PG
|
166
|
+
COPY #{table_name} (name)
|
167
|
+
FROM '#{data_path.join(table_name)}.txt'
|
168
|
+
(FORMAT CSV)
|
169
|
+
PG
|
170
|
+
end
|
171
|
+
|
172
|
+
copy.call(:tlds)
|
173
|
+
copy.call(:country_tlds)
|
174
|
+
copy.call(:disposable_emails)
|
175
|
+
copy.call(:disposable_domains)
|
176
|
+
copy.call(:free_email_domains)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
```
|
180
|
+
|
49
181
|
### Node.js
|
50
182
|
|
51
183
|
```console
|
data/Rakefile
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
5
6
|
|
6
7
|
Rake::TestTask.new(:test) do |t|
|
7
8
|
t.libs << "test"
|
@@ -9,4 +10,6 @@ Rake::TestTask.new(:test) do |t|
|
|
9
10
|
t.test_files = FileList["test/**/*_test.rb"]
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i[test rubocop]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1602964602
|
data/bin/helpers.rb
CHANGED
@@ -6,6 +6,7 @@ Encoding.default_external = Encoding.find("UTF-8")
|
|
6
6
|
Thread.abort_on_exception = false
|
7
7
|
Thread.report_on_exception = false
|
8
8
|
|
9
|
+
require "bundler/setup"
|
9
10
|
require "open-uri"
|
10
11
|
require "json"
|
11
12
|
require "aitch"
|
@@ -14,6 +15,7 @@ require "simpleidn"
|
|
14
15
|
require "timeout"
|
15
16
|
require "active_support/all"
|
16
17
|
require "root_domain"
|
18
|
+
require "email_data"
|
17
19
|
|
18
20
|
USER_AGENT = [
|
19
21
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15",
|
data/bin/publish
CHANGED
@@ -5,6 +5,20 @@ set -e
|
|
5
5
|
source $HOME/.zsh/exports.sh
|
6
6
|
source $HOME/.zsh/asdf.sh
|
7
7
|
|
8
|
+
lockfile=$(dirname $0)/../LOCK
|
9
|
+
|
10
|
+
if [[ -f "$lockfile" ]]; then
|
11
|
+
terminal-notifier \
|
12
|
+
-message "Skipping script; repository is locked." \
|
13
|
+
-ignoreDnD \
|
14
|
+
-title "email_data" \
|
15
|
+
-group homebrew \
|
16
|
+
&> /dev/null
|
17
|
+
exit 1
|
18
|
+
fi
|
19
|
+
|
20
|
+
git reset --hard
|
21
|
+
git checkout main
|
8
22
|
git pull --rebase
|
9
23
|
git push
|
10
24
|
|
@@ -19,7 +33,7 @@ if [[ "$git_status" =~ "nothing to commit" ]]; then
|
|
19
33
|
-title "email_data" \
|
20
34
|
-group homebrew \
|
21
35
|
&> /dev/null
|
22
|
-
exit
|
36
|
+
exit 1
|
23
37
|
fi
|
24
38
|
|
25
39
|
date "+%s" > VERSION
|
@@ -29,6 +43,11 @@ package_json=$(cat package.json | jq --arg version "${version}.0.0" '.version =
|
|
29
43
|
|
30
44
|
echo $package_json | jq --tab > package.json
|
31
45
|
|
46
|
+
asdf local ruby 2.7.2
|
47
|
+
|
48
|
+
gem install bundler
|
49
|
+
bundle update
|
50
|
+
|
32
51
|
git add .
|
33
52
|
git commit -m "Bump up version."
|
34
53
|
git push
|
data/bin/publish-gem
CHANGED
@@ -5,16 +5,12 @@ set -e
|
|
5
5
|
source $HOME/.zsh/exports.sh
|
6
6
|
source $HOME/.zsh/asdf.sh
|
7
7
|
|
8
|
-
asdf local ruby 2.7.
|
9
|
-
|
10
|
-
gem install bundler
|
11
|
-
bundle update
|
12
|
-
|
8
|
+
asdf local ruby 2.7.2
|
13
9
|
rake release
|
14
10
|
|
15
11
|
terminal-notifier \
|
16
12
|
-message "Just published a new gem version." \
|
17
13
|
-ignoreDnD \
|
18
14
|
-title "email_data" \
|
19
|
-
-group
|
15
|
+
-group email_data_gem \
|
20
16
|
&> /dev/null
|