gman 6.0.1 → 7.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +3 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
  5. data/.github/config.yml +23 -0
  6. data/.github/funding.yml +1 -0
  7. data/.github/no-response.yml +15 -0
  8. data/.github/release-drafter.yml +4 -0
  9. data/.github/settings.yml +33 -0
  10. data/.github/stale.yml +29 -0
  11. data/.gitignore +1 -0
  12. data/.rspec +2 -0
  13. data/.rubocop.yml +17 -5
  14. data/.rubocop_todo.yml +84 -0
  15. data/.ruby-version +1 -1
  16. data/Gemfile +2 -0
  17. data/bin/gman +6 -4
  18. data/bin/gman_filter +5 -7
  19. data/config/domains.txt +8446 -173
  20. data/config/vendor/academic.txt +8038 -0
  21. data/config/vendor/dotgovs.csv +5786 -5560
  22. data/docs/CODE_OF_CONDUCT.md +46 -0
  23. data/docs/CONTRIBUTING.md +92 -0
  24. data/{README.md → docs/README.md} +3 -3
  25. data/docs/SECURITY.md +3 -0
  26. data/docs/_config.yml +2 -0
  27. data/gman.gemspec +18 -17
  28. data/lib/gman.rb +25 -21
  29. data/lib/gman/country_codes.rb +17 -17
  30. data/lib/gman/domain_list.rb +123 -41
  31. data/lib/gman/identifier.rb +59 -21
  32. data/lib/gman/importer.rb +39 -40
  33. data/lib/gman/locality.rb +23 -21
  34. data/lib/gman/version.rb +3 -1
  35. data/script/add +2 -0
  36. data/script/alphabetize +2 -0
  37. data/script/cibuild +1 -1
  38. data/script/dedupe +2 -1
  39. data/script/profile +2 -1
  40. data/script/prune +5 -3
  41. data/script/reconcile-us +6 -3
  42. data/script/vendor +1 -1
  43. data/script/vendor-federal-de +3 -3
  44. data/script/vendor-municipal-de +3 -3
  45. data/script/vendor-nl +4 -1
  46. data/script/vendor-public-suffix +7 -6
  47. data/script/vendor-se +3 -3
  48. data/script/vendor-swot +43 -0
  49. data/script/vendor-us +8 -5
  50. data/spec/fixtures/domains.txt +4 -0
  51. data/{test → spec}/fixtures/obama.txt +0 -0
  52. data/spec/gman/bin_spec.rb +101 -0
  53. data/spec/gman/country_code_spec.rb +39 -0
  54. data/spec/gman/domain_list_spec.rb +110 -0
  55. data/spec/gman/domains_spec.rb +25 -0
  56. data/spec/gman/identifier_spec.rb +218 -0
  57. data/spec/gman/importer_spec.rb +236 -0
  58. data/spec/gman/locality_spec.rb +24 -0
  59. data/spec/gman_spec.rb +74 -0
  60. data/spec/spec_helper.rb +31 -0
  61. metadata +86 -73
  62. data/CONTRIBUTING.md +0 -22
  63. data/Rakefile +0 -22
  64. data/test/fixtures/domains.txt +0 -2
  65. data/test/helper.rb +0 -40
  66. data/test/test_gman.rb +0 -62
  67. data/test/test_gman_bin.rb +0 -75
  68. data/test/test_gman_country_codes.rb +0 -18
  69. data/test/test_gman_domains.rb +0 -33
  70. data/test/test_gman_filter.rb +0 -17
  71. data/test/test_gman_identifier.rb +0 -106
  72. data/test/test_gman_importer.rb +0 -250
  73. data/test/test_gman_locality.rb +0 -10
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Gman::Locality do
4
+ context 'valid domains' do
5
+ ['foo.state.il.us', 'ci.foo.il.us'].each do |domain|
6
+ context "the #{domain} domain" do
7
+ it 'is valid' do
8
+ expect(described_class.valid?(domain)).to be(true)
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ context 'invalid domains' do
15
+ ['state.foo.il.us', 'foo.ci.il.us',
16
+ 'k12.il.us', 'ci.foo.zx.us'].each do |domain|
17
+ context "the #{domain} domain" do
18
+ it 'is invalid' do
19
+ expect(described_class.valid?(domain)).to be(false)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Gman do
4
+ context 'valid domains' do
5
+ ['foo.gov', 'http://foo.mil', 'foo@bar.gc.ca', 'foo.gov.au',
6
+ 'https://www.foo.gouv.fr', 'foo@ci.champaign.il.us',
7
+ 'foo.bar.baz.gov.au', 'foo@bar.gov.uk', 'foo.gov',
8
+ 'foo.fed.us', 'foo.state.il.us', 'state.il.us',
9
+ 'foo@af.mil', 'foo.gov.in'].each do |domain|
10
+ subject { described_class.new(domain) }
11
+
12
+ it "knows #{domain.inspect} is valid government domain" do
13
+ expect(described_class.valid?(domain)).to be(true)
14
+ expect(subject.valid?).to be(true)
15
+ end
16
+ end
17
+ end
18
+
19
+ context 'invalid domains' do
20
+ ['foo.bar.com', 'bar@foo.biz', 'http://www.foo.biz',
21
+ 'foo.uk', 'gov', 'foo@k12.champaign.il.us', 'foo@kii.gov.by',
22
+ 'foo', '', nil, ' ', 'foo.city.il.us', 'foo.ci.il.us',
23
+ 'foo.zx.us', 'foo@mail.gov.ua', 'foo@gwu.edu'].each do |domain|
24
+ subject { described_class.new(domain) }
25
+
26
+ it "knows #{domain.inspect} is not a valid government domain" do
27
+ expect(described_class.valid?(domain)).to be(false)
28
+ expect(subject.valid?).to be(false)
29
+ end
30
+ end
31
+ end
32
+
33
+ context 'localities' do
34
+ subject { described_class.new(domain) }
35
+
36
+ context 'when given github.gov' do
37
+ let(:domain) { 'github.gov' }
38
+
39
+ it "knows it's not a locality" do
40
+ expect(subject.locality?).to be(false)
41
+ end
42
+ end
43
+
44
+ context 'when given foo.state.il.us' do
45
+ let(:domain) { 'foo.state.il.us' }
46
+
47
+ it "knows it's a locality" do
48
+ expect(subject.locality?).to be(true)
49
+ end
50
+ end
51
+ end
52
+
53
+ context 'class methods' do
54
+ it 'returns the domain list' do
55
+ expect(described_class.list).to be_a(Gman::DomainList)
56
+ end
57
+
58
+ it 'returns the academic list' do
59
+ expect(described_class.academic_list).to be_a(Gman::DomainList)
60
+ end
61
+
62
+ it 'returns the config path' do
63
+ expect(Dir.exist?(described_class.config_path)).to be(true)
64
+ end
65
+
66
+ it 'returns the list path' do
67
+ expect(File.exist?(described_class.list_path)).to be(true)
68
+ end
69
+
70
+ it 'returns the academic list path' do
71
+ expect(File.exist?(described_class.academic_list_path)).to be(true)
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'parallel'
4
+ require 'open3'
5
+
6
+ RSpec.configure do |config|
7
+ config.example_status_persistence_file_path = 'spec/examples.txt'
8
+ config.disable_monkey_patching!
9
+ config.default_formatter = 'doc' if config.files_to_run.one?
10
+ config.order = :random
11
+ Kernel.srand config.seed
12
+ end
13
+
14
+ require_relative '../lib/gman'
15
+ require_relative '../lib/gman/domain_list'
16
+ require_relative '../lib/gman/importer'
17
+
18
+ def fixture_path(fixture)
19
+ File.expand_path "./fixtures/#{fixture}", File.dirname(__FILE__)
20
+ end
21
+
22
+ def stubbed_list_path
23
+ File.expand_path './fixtures/domains.txt', File.dirname(__FILE__)
24
+ end
25
+
26
+ def with_env(key, value)
27
+ old_env = ENV[key]
28
+ ENV[key] = value
29
+ yield
30
+ ENV[key] = old_env
31
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gman
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 7.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-22 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: swot
14
+ name: colored
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: iso_country_codes
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,142 +42,142 @@ dependencies:
42
42
  name: naughty_or_nice
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: 2.1.1
48
48
  type: :runtime
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: '2.0'
54
+ version: 2.1.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: colored
56
+ name: public_suffix
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '1.2'
61
+ version: '3.0'
62
62
  type: :runtime
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: '1.2'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: addressable
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.4'
75
+ version: '2.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.4'
82
+ version: '2.3'
83
83
  - !ruby/object:Gem::Dependency
84
- name: shoulda
84
+ name: mechanize
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.5'
89
+ version: '2.7'
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.5'
96
+ version: '2.7'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rdoc
98
+ name: parallel
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '4.2'
103
+ version: '1.6'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '4.2'
110
+ version: '1.6'
111
111
  - !ruby/object:Gem::Dependency
112
- name: bundler
112
+ name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.10'
117
+ version: '0.10'
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: '0.10'
125
125
  - !ruby/object:Gem::Dependency
126
- name: pry
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.10'
131
+ version: '3.5'
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: '0.10'
138
+ version: '3.5'
139
139
  - !ruby/object:Gem::Dependency
140
- name: parallel
140
+ name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '1.6'
145
+ version: '1.0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '1.6'
152
+ version: '1.0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: mechanize
154
+ name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '2.7'
159
+ version: '1.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: '2.7'
166
+ version: '1.5'
167
167
  - !ruby/object:Gem::Dependency
168
- name: addressable
168
+ name: rubocop-rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: '2.3'
173
+ version: '2.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: '2.3'
180
+ version: '2.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: ruby-prof
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -193,19 +193,19 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.15'
195
195
  - !ruby/object:Gem::Dependency
196
- name: rubocop
196
+ name: swot
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '0.37'
201
+ version: '1.0'
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: '0.37'
208
+ version: '1.0'
209
209
  description: |2
210
210
  A ruby gem to check if the owner of a given email address is working for
211
211
  THE MAN.
@@ -216,19 +216,33 @@ executables:
216
216
  extensions: []
217
217
  extra_rdoc_files: []
218
218
  files:
219
+ - ".github/CODEOWNERS"
220
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
221
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
222
+ - ".github/config.yml"
223
+ - ".github/funding.yml"
224
+ - ".github/no-response.yml"
225
+ - ".github/release-drafter.yml"
226
+ - ".github/settings.yml"
227
+ - ".github/stale.yml"
219
228
  - ".gitignore"
229
+ - ".rspec"
220
230
  - ".rubocop.yml"
231
+ - ".rubocop_todo.yml"
221
232
  - ".ruby-version"
222
233
  - ".travis.yml"
223
- - CONTRIBUTING.md
224
234
  - Gemfile
225
235
  - LICENSE
226
- - README.md
227
- - Rakefile
228
236
  - bin/gman
229
237
  - bin/gman_filter
230
238
  - config/domains.txt
239
+ - config/vendor/academic.txt
231
240
  - config/vendor/dotgovs.csv
241
+ - docs/CODE_OF_CONDUCT.md
242
+ - docs/CONTRIBUTING.md
243
+ - docs/README.md
244
+ - docs/SECURITY.md
245
+ - docs/_config.yml
232
246
  - gman.gemspec
233
247
  - lib/gman.rb
234
248
  - lib/gman/country_codes.rb
@@ -254,23 +268,24 @@ files:
254
268
  - script/vendor-nl
255
269
  - script/vendor-public-suffix
256
270
  - script/vendor-se
271
+ - script/vendor-swot
257
272
  - script/vendor-us
258
- - test/fixtures/domains.txt
259
- - test/fixtures/obama.txt
260
- - test/helper.rb
261
- - test/test_gman.rb
262
- - test/test_gman_bin.rb
263
- - test/test_gman_country_codes.rb
264
- - test/test_gman_domains.rb
265
- - test/test_gman_filter.rb
266
- - test/test_gman_identifier.rb
267
- - test/test_gman_importer.rb
268
- - test/test_gman_locality.rb
273
+ - spec/fixtures/domains.txt
274
+ - spec/fixtures/obama.txt
275
+ - spec/gman/bin_spec.rb
276
+ - spec/gman/country_code_spec.rb
277
+ - spec/gman/domain_list_spec.rb
278
+ - spec/gman/domains_spec.rb
279
+ - spec/gman/identifier_spec.rb
280
+ - spec/gman/importer_spec.rb
281
+ - spec/gman/locality_spec.rb
282
+ - spec/gman_spec.rb
283
+ - spec/spec_helper.rb
269
284
  homepage: https://github.com/benbalter/gman
270
285
  licenses:
271
286
  - MIT
272
287
  metadata: {}
273
- post_install_message:
288
+ post_install_message:
274
289
  rdoc_options: []
275
290
  require_paths:
276
291
  - lib
@@ -278,28 +293,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
293
  requirements:
279
294
  - - "~>"
280
295
  - !ruby/object:Gem::Version
281
- version: '2.0'
296
+ version: '2.5'
282
297
  required_rubygems_version: !ruby/object:Gem::Requirement
283
298
  requirements:
284
299
  - - ">="
285
300
  - !ruby/object:Gem::Version
286
301
  version: '0'
287
302
  requirements: []
288
- rubyforge_project:
289
- rubygems_version: 2.6.2
290
- signing_key:
303
+ rubygems_version: 3.0.3
304
+ signing_key:
291
305
  specification_version: 4
292
306
  summary: Check if a given domain or email address belong to a governemnt entity
293
307
  test_files:
294
- - test/fixtures/domains.txt
295
- - test/fixtures/obama.txt
296
- - test/helper.rb
297
- - test/test_gman.rb
298
- - test/test_gman_bin.rb
299
- - test/test_gman_country_codes.rb
300
- - test/test_gman_domains.rb
301
- - test/test_gman_filter.rb
302
- - test/test_gman_identifier.rb
303
- - test/test_gman_importer.rb
304
- - test/test_gman_locality.rb
305
- has_rdoc:
308
+ - spec/fixtures/domains.txt
309
+ - spec/fixtures/obama.txt
310
+ - spec/gman/bin_spec.rb
311
+ - spec/gman/country_code_spec.rb
312
+ - spec/gman/domain_list_spec.rb
313
+ - spec/gman/domains_spec.rb
314
+ - spec/gman/identifier_spec.rb
315
+ - spec/gman/importer_spec.rb
316
+ - spec/gman/locality_spec.rb
317
+ - spec/gman_spec.rb
318
+ - spec/spec_helper.rb