gman 7.0.1 → 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/.rubocop.yml +3 -0
- data/.ruby-version +1 -1
- data/config/domains.txt +8259 -42
- data/config/vendor/academic.txt +6 -7
- data/config/vendor/dotgovs.csv +5634 -5560
- data/contributing.json +32 -0
- data/gman.gemspec +3 -5
- data/lib/gman.rb +1 -1
- data/lib/gman/domain_list.rb +18 -6
- data/lib/gman/identifier.rb +2 -2
- data/lib/gman/importer.rb +1 -1
- data/lib/gman/version.rb +1 -1
- data/script/cibuild +1 -1
- data/script/dedupe +1 -1
- data/script/vendor-swot +1 -1
- data/spec/fixtures/domains.txt +4 -0
- data/{test → spec}/fixtures/obama.txt +0 -0
- data/spec/gman/bin_spec.rb +99 -0
- data/spec/gman/country_code_spec.rb +36 -0
- data/spec/gman/domain_list_spec.rb +108 -0
- data/spec/gman/domains_spec.rb +22 -0
- data/spec/gman/identifier_spec.rb +182 -0
- data/spec/gman/importer_spec.rb +227 -0
- data/spec/gman/locality_spec.rb +22 -0
- data/spec/gman_spec.rb +72 -0
- data/spec/spec_helper.rb +29 -0
- metadata +52 -83
- data/.rake_tasks +0 -0
- data/Rakefile +0 -22
- data/test/fixtures/domains.txt +0 -2
- data/test/helper.rb +0 -48
- data/test/test_gman.rb +0 -56
- data/test/test_gman_bin.rb +0 -75
- data/test/test_gman_country_codes.rb +0 -18
- data/test/test_gman_domain_list.rb +0 -112
- data/test/test_gman_domains.rb +0 -32
- data/test/test_gman_filter.rb +0 -17
- data/test/test_gman_identifier.rb +0 -106
- data/test/test_gman_importer.rb +0 -244
- data/test/test_gman_locality.rb +0 -10
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'parallel'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.example_status_persistence_file_path = 'spec/examples.txt'
|
6
|
+
config.disable_monkey_patching!
|
7
|
+
config.default_formatter = 'doc' if config.files_to_run.one?
|
8
|
+
config.order = :random
|
9
|
+
Kernel.srand config.seed
|
10
|
+
end
|
11
|
+
|
12
|
+
require_relative '../lib/gman'
|
13
|
+
require_relative '../lib/gman/domain_list'
|
14
|
+
require_relative '../lib/gman/importer'
|
15
|
+
|
16
|
+
def fixture_path(fixture)
|
17
|
+
File.expand_path "./fixtures/#{fixture}", File.dirname(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def stubbed_list_path
|
21
|
+
File.expand_path './fixtures/domains.txt', File.dirname(__FILE__)
|
22
|
+
end
|
23
|
+
|
24
|
+
def with_env(key, value)
|
25
|
+
old_env = ENV[key]
|
26
|
+
ENV[key] = value
|
27
|
+
yield
|
28
|
+
ENV[key] = old_env
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Balter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso_country_codes
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: naughty_or_nice
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: colored
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,75 +53,33 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.4'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: shoulda
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.5'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.5'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rdoc
|
56
|
+
name: public_suffix
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - "~>"
|
102
60
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
-
type: :
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
108
66
|
- - "~>"
|
109
67
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
68
|
+
version: '2.0'
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
70
|
+
name: swot
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - "~>"
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version: '1.
|
75
|
+
version: '1.0'
|
118
76
|
type: :development
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
80
|
- - "~>"
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version: '1.
|
82
|
+
version: '1.0'
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
84
|
name: pry
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,6 +164,20 @@ dependencies:
|
|
206
164
|
- - "~>"
|
207
165
|
- !ruby/object:Gem::Version
|
208
166
|
version: '0.37'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '3.5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '3.5'
|
209
181
|
description: |2
|
210
182
|
A ruby gem to check if the owner of a given email address is working for
|
211
183
|
THE MAN.
|
@@ -217,7 +189,7 @@ extensions: []
|
|
217
189
|
extra_rdoc_files: []
|
218
190
|
files:
|
219
191
|
- ".gitignore"
|
220
|
-
- ".
|
192
|
+
- ".rspec"
|
221
193
|
- ".rubocop.yml"
|
222
194
|
- ".ruby-version"
|
223
195
|
- ".travis.yml"
|
@@ -225,12 +197,12 @@ files:
|
|
225
197
|
- Gemfile
|
226
198
|
- LICENSE
|
227
199
|
- README.md
|
228
|
-
- Rakefile
|
229
200
|
- bin/gman
|
230
201
|
- bin/gman_filter
|
231
202
|
- config/domains.txt
|
232
203
|
- config/vendor/academic.txt
|
233
204
|
- config/vendor/dotgovs.csv
|
205
|
+
- contributing.json
|
234
206
|
- gman.gemspec
|
235
207
|
- lib/gman.rb
|
236
208
|
- lib/gman/country_codes.rb
|
@@ -258,18 +230,17 @@ files:
|
|
258
230
|
- script/vendor-se
|
259
231
|
- script/vendor-swot
|
260
232
|
- script/vendor-us
|
261
|
-
-
|
262
|
-
-
|
263
|
-
-
|
264
|
-
-
|
265
|
-
-
|
266
|
-
-
|
267
|
-
-
|
268
|
-
-
|
269
|
-
-
|
270
|
-
-
|
271
|
-
-
|
272
|
-
- test/test_gman_locality.rb
|
233
|
+
- spec/fixtures/domains.txt
|
234
|
+
- spec/fixtures/obama.txt
|
235
|
+
- spec/gman/bin_spec.rb
|
236
|
+
- spec/gman/country_code_spec.rb
|
237
|
+
- spec/gman/domain_list_spec.rb
|
238
|
+
- spec/gman/domains_spec.rb
|
239
|
+
- spec/gman/identifier_spec.rb
|
240
|
+
- spec/gman/importer_spec.rb
|
241
|
+
- spec/gman/locality_spec.rb
|
242
|
+
- spec/gman_spec.rb
|
243
|
+
- spec/spec_helper.rb
|
273
244
|
homepage: https://github.com/benbalter/gman
|
274
245
|
licenses:
|
275
246
|
- MIT
|
@@ -290,21 +261,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
261
|
version: '0'
|
291
262
|
requirements: []
|
292
263
|
rubyforge_project:
|
293
|
-
rubygems_version: 2.
|
264
|
+
rubygems_version: 2.5.1
|
294
265
|
signing_key:
|
295
266
|
specification_version: 4
|
296
267
|
summary: Check if a given domain or email address belong to a governemnt entity
|
297
268
|
test_files:
|
298
|
-
-
|
299
|
-
-
|
300
|
-
-
|
301
|
-
-
|
302
|
-
-
|
303
|
-
-
|
304
|
-
-
|
305
|
-
-
|
306
|
-
-
|
307
|
-
-
|
308
|
-
-
|
309
|
-
- test/test_gman_locality.rb
|
310
|
-
has_rdoc:
|
269
|
+
- spec/fixtures/domains.txt
|
270
|
+
- spec/fixtures/obama.txt
|
271
|
+
- spec/gman/bin_spec.rb
|
272
|
+
- spec/gman/country_code_spec.rb
|
273
|
+
- spec/gman/domain_list_spec.rb
|
274
|
+
- spec/gman/domains_spec.rb
|
275
|
+
- spec/gman/identifier_spec.rb
|
276
|
+
- spec/gman/importer_spec.rb
|
277
|
+
- spec/gman/locality_spec.rb
|
278
|
+
- spec/gman_spec.rb
|
279
|
+
- spec/spec_helper.rb
|
data/.rake_tasks
DELETED
File without changes
|
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts 'Run `bundle install` to install missing gems'
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'rake/testtask'
|
13
|
-
Rake::TestTask.new(:test) do |test|
|
14
|
-
test.libs << 'lib' << 'test'
|
15
|
-
test.pattern = 'test/**/test_gman*.rb'
|
16
|
-
test.verbose = true
|
17
|
-
end
|
18
|
-
|
19
|
-
desc 'Open console with gman loaded'
|
20
|
-
task :console do
|
21
|
-
exec 'irb -r ./lib/gman.rb'
|
22
|
-
end
|
data/test/fixtures/domains.txt
DELETED
data/test/helper.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'parallel'
|
5
|
-
require 'open3'
|
6
|
-
|
7
|
-
begin
|
8
|
-
Bundler.setup(:default, :development)
|
9
|
-
rescue Bundler::BundlerError => e
|
10
|
-
$stderr.puts e.message
|
11
|
-
$stderr.puts 'Run `bundle install` to install missing gems'
|
12
|
-
exit e.status_code
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'shoulda'
|
16
|
-
|
17
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
|
-
require_relative '../lib/gman'
|
20
|
-
require_relative '../lib/gman/domain_list'
|
21
|
-
require_relative '../lib/gman/importer'
|
22
|
-
|
23
|
-
def bin_path(cmd = 'gman')
|
24
|
-
File.expand_path "../bin/#{cmd}", File.dirname(__FILE__)
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_bin(*args)
|
28
|
-
Open3.capture2e('bundle', 'exec', bin_path, *args)
|
29
|
-
end
|
30
|
-
|
31
|
-
def fixture_path(fixture)
|
32
|
-
File.expand_path "./fixtures/#{fixture}", File.dirname(__FILE__)
|
33
|
-
end
|
34
|
-
|
35
|
-
def with_env(key, value)
|
36
|
-
old_env = ENV[key]
|
37
|
-
ENV[key] = value
|
38
|
-
yield
|
39
|
-
ENV[key] = old_env
|
40
|
-
end
|
41
|
-
|
42
|
-
def stubbed_list_path
|
43
|
-
File.expand_path './fixtures/domains.txt', File.dirname(__FILE__)
|
44
|
-
end
|
45
|
-
|
46
|
-
def stubbed_list
|
47
|
-
Gman::DomainList.new(path: stubbed_list_path)
|
48
|
-
end
|
data/test/test_gman.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'helper')
|
2
|
-
|
3
|
-
VALID = ['foo.gov',
|
4
|
-
'http://foo.mil',
|
5
|
-
'foo@bar.gc.ca',
|
6
|
-
'foo.gov.au',
|
7
|
-
'https://www.foo.gouv.fr',
|
8
|
-
'foo@ci.champaign.il.us',
|
9
|
-
'foo.bar.baz.gov.au',
|
10
|
-
'foo@bar.gov.uk',
|
11
|
-
'foo.gov',
|
12
|
-
'foo.fed.us',
|
13
|
-
'foo.state.il.us',
|
14
|
-
'state.il.us',
|
15
|
-
'foo@af.mil',
|
16
|
-
'foo.gov.in'
|
17
|
-
].freeze
|
18
|
-
|
19
|
-
INVALID = ['foo.bar.com',
|
20
|
-
'bar@foo.biz',
|
21
|
-
'http://www.foo.biz',
|
22
|
-
'foo.uk',
|
23
|
-
'gov',
|
24
|
-
'foo@k12.champaign.il.us',
|
25
|
-
'foo@kii.gov.by',
|
26
|
-
'foo',
|
27
|
-
'',
|
28
|
-
nil,
|
29
|
-
' ',
|
30
|
-
'foo.city.il.us',
|
31
|
-
'foo.ci.il.us',
|
32
|
-
'foo.zx.us',
|
33
|
-
'foo@mail.gov.ua'
|
34
|
-
].freeze
|
35
|
-
|
36
|
-
class TestGman < Minitest::Test
|
37
|
-
VALID.each do |domain|
|
38
|
-
should "recognize #{domain} as a government domain" do
|
39
|
-
assert Gman.valid?(domain)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
INVALID.each do |domain|
|
44
|
-
should "recognize #{domain} as a non-government domain" do
|
45
|
-
refute Gman.valid?(domain)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
should 'not allow educational domains' do
|
50
|
-
assert_equal false, Gman.valid?('foo@gwu.edu')
|
51
|
-
end
|
52
|
-
|
53
|
-
should 'returns the path to domains.txt' do
|
54
|
-
assert_equal true, File.exist?(Gman.list_path)
|
55
|
-
end
|
56
|
-
end
|
data/test/test_gman_bin.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require_relative 'helper'
|
2
|
-
|
3
|
-
class TestGmanBin < Minitest::Test
|
4
|
-
def setup
|
5
|
-
@output, @status = test_bin('whitehouse.gov')
|
6
|
-
end
|
7
|
-
|
8
|
-
should 'parse the domain' do
|
9
|
-
output, = test_bin('bar.gov')
|
10
|
-
assert_match(/Domain : bar.gov/, output)
|
11
|
-
|
12
|
-
output, = test_bin('foo@bar.gov')
|
13
|
-
assert_match(/Domain : bar.gov/, output)
|
14
|
-
|
15
|
-
output, = test_bin('http://bar.gov/foo')
|
16
|
-
assert_match(/Domain : bar.gov/, output)
|
17
|
-
end
|
18
|
-
|
19
|
-
should 'err on invalid domains' do
|
20
|
-
output, status = test_bin('foo.invalid')
|
21
|
-
assert_equal 1, status.exitstatus
|
22
|
-
assert_match(/Invalid domain/, output)
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'err on non-government domains' do
|
26
|
-
output, status = test_bin('github.com')
|
27
|
-
assert_equal 1, status.exitstatus
|
28
|
-
assert_match(/Not a government domain/, output)
|
29
|
-
end
|
30
|
-
|
31
|
-
should 'know the type' do
|
32
|
-
assert_match(/federal/, @output)
|
33
|
-
assert_equal 0, @status.exitstatus
|
34
|
-
end
|
35
|
-
|
36
|
-
should 'know the agency' do
|
37
|
-
assert_match(/Executive Office of the President/, @output)
|
38
|
-
assert_equal 0, @status.exitstatus
|
39
|
-
end
|
40
|
-
|
41
|
-
should 'know the country' do
|
42
|
-
assert_match(/United States/, @output)
|
43
|
-
assert_equal 0, @status.exitstatus
|
44
|
-
end
|
45
|
-
|
46
|
-
should 'know the city' do
|
47
|
-
assert_match(/Washington/, @output)
|
48
|
-
assert_equal 0, @status.exitstatus
|
49
|
-
end
|
50
|
-
|
51
|
-
should 'know the state' do
|
52
|
-
assert_match(/DC/, @output)
|
53
|
-
assert_equal 0, @status.exitstatus
|
54
|
-
end
|
55
|
-
|
56
|
-
should 'allow you to disable colorization' do
|
57
|
-
output, = test_bin('whitehouse.gov', '--no-color')
|
58
|
-
refute_match(/\e\[32m/, output)
|
59
|
-
end
|
60
|
-
|
61
|
-
should 'color by default' do
|
62
|
-
assert_match(/\e\[32m/, @output)
|
63
|
-
end
|
64
|
-
|
65
|
-
should 'show help text' do
|
66
|
-
output, = test_bin
|
67
|
-
assert_match(/Usage/i, output)
|
68
|
-
|
69
|
-
output, = test_bin('')
|
70
|
-
assert_match(/Usage/i, output)
|
71
|
-
|
72
|
-
output, = test_bin('--no-color')
|
73
|
-
assert_match(/Usage/i, output)
|
74
|
-
end
|
75
|
-
end
|