gman 7.0.3 → 7.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/funding.yml +1 -0
- data/.github/settings.yml +1 -1
- data/.rubocop.yml +7 -1
- data/.rubocop_todo.yml +84 -0
- data/.ruby-version +1 -1
- data/bin/gman +3 -3
- data/bin/gman_filter +2 -2
- data/config/domains.txt +13 -1
- data/docs/CONTRIBUTING.md +1 -1
- data/docs/README.md +1 -1
- data/docs/SECURITY.md +3 -0
- data/gman.gemspec +5 -3
- data/lib/gman/country_codes.rb +2 -2
- data/lib/gman/domain_list.rb +1 -1
- data/lib/gman/importer.rb +2 -2
- data/lib/gman/version.rb +1 -1
- data/script/profile +1 -1
- data/script/reconcile-us +1 -1
- data/script/vendor-public-suffix +3 -3
- data/script/vendor-se +1 -1
- data/script/vendor-us +1 -1
- data/spec/gman/bin_spec.rb +4 -4
- data/spec/gman/country_code_spec.rb +1 -0
- data/spec/gman/domain_list_spec.rb +4 -4
- data/spec/gman/identifier_spec.rb +25 -24
- data/spec/gman/importer_spec.rb +13 -6
- data/spec/gman/locality_spec.rb +2 -2
- data/spec/gman_spec.rb +9 -9
- metadata +42 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d669efd7ce495249c33d645e83d5273423121befebf7c3c23312dfbf52741005
|
4
|
+
data.tar.gz: 9e745c1a131e60140633a4b711ee96cb611971277beae7263b69e0f6a00d450d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca93a3c3b2ec4f08e99f62800a275c071a40ee519a42ae478875aa5342a65f66c885b2f43f6e8087257ee2309a2558a387239852f1fe16173fe16132c2e99a37
|
7
|
+
data.tar.gz: 7a7ee379f1b6e37ab929648020b962090bbd22f2ff61e2c3b7b10559c78c18548fe5c3eae8703ca7e18010b100c30f26698c17dae203b906e79cbde20b3b0524
|
data/.github/funding.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
patreon: benbalter
|
data/.github/settings.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-11-13 00:12:15 UTC using RuboCop version 1.3.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: MinSize.
|
11
|
+
Performance/CollectionLiteralInLoop:
|
12
|
+
Exclude:
|
13
|
+
- 'spec/gman/domains_spec.rb'
|
14
|
+
|
15
|
+
# Offense count: 40
|
16
|
+
# Configuration parameters: Prefixes.
|
17
|
+
# Prefixes: when, with, without
|
18
|
+
RSpec/ContextWording:
|
19
|
+
Exclude:
|
20
|
+
- 'spec/gman/bin_spec.rb'
|
21
|
+
- 'spec/gman/domain_list_spec.rb'
|
22
|
+
- 'spec/gman/identifier_spec.rb'
|
23
|
+
- 'spec/gman/importer_spec.rb'
|
24
|
+
- 'spec/gman/locality_spec.rb'
|
25
|
+
- 'spec/gman_spec.rb'
|
26
|
+
|
27
|
+
# Offense count: 4
|
28
|
+
# Configuration parameters: IgnoredMetadata.
|
29
|
+
RSpec/DescribeClass:
|
30
|
+
Exclude:
|
31
|
+
- 'spec/gman/bin_spec.rb'
|
32
|
+
- 'spec/gman/country_code_spec.rb'
|
33
|
+
- 'spec/gman/domains_spec.rb'
|
34
|
+
- 'spec/gman/identifier_spec.rb'
|
35
|
+
|
36
|
+
# Offense count: 3
|
37
|
+
# Configuration parameters: Max.
|
38
|
+
RSpec/ExampleLength:
|
39
|
+
Exclude:
|
40
|
+
- 'spec/gman/bin_spec.rb'
|
41
|
+
- 'spec/gman/country_code_spec.rb'
|
42
|
+
- 'spec/gman/domains_spec.rb'
|
43
|
+
|
44
|
+
# Offense count: 2
|
45
|
+
# Configuration parameters: AssignmentOnly.
|
46
|
+
RSpec/InstanceVariable:
|
47
|
+
Exclude:
|
48
|
+
- 'spec/gman/importer_spec.rb'
|
49
|
+
|
50
|
+
# Offense count: 23
|
51
|
+
RSpec/MultipleExpectations:
|
52
|
+
Max: 3
|
53
|
+
|
54
|
+
# Offense count: 24
|
55
|
+
# Configuration parameters: AllowSubject.
|
56
|
+
RSpec/MultipleMemoizedHelpers:
|
57
|
+
Max: 9
|
58
|
+
|
59
|
+
# Offense count: 81
|
60
|
+
# Configuration parameters: IgnoreSharedExamples.
|
61
|
+
RSpec/NamedSubject:
|
62
|
+
Exclude:
|
63
|
+
- 'spec/gman/country_code_spec.rb'
|
64
|
+
- 'spec/gman/domain_list_spec.rb'
|
65
|
+
- 'spec/gman/identifier_spec.rb'
|
66
|
+
- 'spec/gman/importer_spec.rb'
|
67
|
+
- 'spec/gman_spec.rb'
|
68
|
+
|
69
|
+
# Offense count: 10
|
70
|
+
RSpec/NestedGroups:
|
71
|
+
Max: 5
|
72
|
+
|
73
|
+
# Offense count: 2
|
74
|
+
RSpec/ScatteredSetup:
|
75
|
+
Exclude:
|
76
|
+
- 'spec/gman/importer_spec.rb'
|
77
|
+
|
78
|
+
# Offense count: 4
|
79
|
+
Security/Open:
|
80
|
+
Exclude:
|
81
|
+
- 'script/reconcile-us'
|
82
|
+
- 'script/vendor-federal-de'
|
83
|
+
- 'script/vendor-municipal-de'
|
84
|
+
- 'script/vendor-us'
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/bin/gman
CHANGED
@@ -40,16 +40,16 @@ gman = Gman.new(domain)
|
|
40
40
|
puts "Domain : #{gman.domain}"
|
41
41
|
|
42
42
|
if gman.domain.nil?
|
43
|
-
puts
|
43
|
+
puts "Status : #{'Invalid domain'.red}"
|
44
44
|
exit 1
|
45
45
|
end
|
46
46
|
|
47
47
|
unless gman.valid?
|
48
|
-
puts
|
48
|
+
puts "Status : #{'Not a government domain'.red}"
|
49
49
|
exit 1
|
50
50
|
end
|
51
51
|
|
52
|
-
puts
|
52
|
+
puts "Status : #{'Valid government domain'.green}"
|
53
53
|
|
54
54
|
%w[type country state city agency].each do |key|
|
55
55
|
value = gman.send(key)
|
data/bin/gman_filter
CHANGED
data/config/domains.txt
CHANGED
@@ -10710,6 +10710,9 @@ governo.it
|
|
10710
10710
|
plonegov.it
|
10711
10711
|
regione.emilia-romagna.it
|
10712
10712
|
|
10713
|
+
// Korea, South
|
10714
|
+
korea.kr
|
10715
|
+
|
10713
10716
|
// Lithuania
|
10714
10717
|
vpt.lt
|
10715
10718
|
|
@@ -11706,8 +11709,11 @@ zg.ch
|
|
11706
11709
|
zh.ch
|
11707
11710
|
|
11708
11711
|
// UK
|
11712
|
+
parliament.uk
|
11713
|
+
police.uk
|
11709
11714
|
hee.nhs.uk
|
11710
11715
|
historicengland.org.uk
|
11716
|
+
wmfs.net
|
11711
11717
|
|
11712
11718
|
// US Combined Federal Campaigns
|
11713
11719
|
cbacfc.org
|
@@ -20507,4 +20513,10 @@ townofjackson.com
|
|
20507
20513
|
uintacounty.com
|
20508
20514
|
wrightwyoming.com
|
20509
20515
|
wyomingbusiness.org
|
20510
|
-
wyomingtourism.org
|
20516
|
+
wyomingtourism.org
|
20517
|
+
|
20518
|
+
// Nepal federal
|
20519
|
+
nepal.gov.np
|
20520
|
+
|
20521
|
+
// Nepal municipal
|
20522
|
+
kawasotimun.gov.np
|
data/docs/CONTRIBUTING.md
CHANGED
@@ -34,7 +34,7 @@ Feature requests are welcome. But take a moment to find out whether your idea fi
|
|
34
34
|
|
35
35
|
## Domains
|
36
36
|
|
37
|
-
Domains live in
|
37
|
+
Domains live in [`config/domains.txt`](../config/domains.txt) as a list of TLDs and SLD+TLDs.
|
38
38
|
|
39
39
|
Right now, the only valid government top level domains (TLDs), represent the US government and are `.gov`, and `.mil`. Secondary domains (e.g., `gov.uk`, or `mil.au`) represent non-US government entities.
|
40
40
|
|
data/docs/README.md
CHANGED
@@ -72,7 +72,7 @@ domain.country.name #=> "United States"
|
|
72
72
|
domain.country.alpha2 #=> "US"
|
73
73
|
domain.country.alpha3 #=> "USA"
|
74
74
|
domain.country.currency #=> "USD"
|
75
|
-
domain.
|
75
|
+
domain.country.calling_code #=> "+1"
|
76
76
|
```
|
77
77
|
|
78
78
|
### Check if a country is on the US Sanctions list
|
data/docs/SECURITY.md
ADDED
data/gman.gemspec
CHANGED
@@ -24,19 +24,21 @@ Gem::Specification.new do |s|
|
|
24
24
|
end
|
25
25
|
|
26
26
|
s.require_paths = ['lib']
|
27
|
-
s.required_ruby_version = '~> 2.
|
27
|
+
s.required_ruby_version = '~> 2.5'
|
28
28
|
|
29
29
|
s.add_dependency('colored', '~> 1.2')
|
30
30
|
s.add_dependency('iso_country_codes', '~> 0.6')
|
31
31
|
s.add_dependency('naughty_or_nice', '= 2.1.1')
|
32
|
-
s.add_dependency('public_suffix', '
|
32
|
+
s.add_dependency('public_suffix', '>= 3.0')
|
33
33
|
|
34
34
|
s.add_development_dependency('addressable', '~> 2.3')
|
35
35
|
s.add_development_dependency('mechanize', '~> 2.7')
|
36
36
|
s.add_development_dependency('parallel', '~> 1.6')
|
37
37
|
s.add_development_dependency('pry', '~> 0.10')
|
38
38
|
s.add_development_dependency('rspec', '~> 3.5')
|
39
|
-
s.add_development_dependency('rubocop', '~> 0
|
39
|
+
s.add_development_dependency('rubocop', '~> 1.0')
|
40
|
+
s.add_development_dependency('rubocop-performance', '~> 1.5')
|
41
|
+
s.add_development_dependency('rubocop-rspec', '~> 2.0')
|
40
42
|
s.add_development_dependency('ruby-prof', '~> 0.15')
|
41
43
|
s.add_development_dependency('swot', '~> 1.0')
|
42
44
|
end
|
data/lib/gman/country_codes.rb
CHANGED
data/lib/gman/domain_list.rb
CHANGED
data/lib/gman/importer.rb
CHANGED
@@ -66,7 +66,7 @@ class Gman
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def logger
|
69
|
-
@logger ||= Logger.new(
|
69
|
+
@logger ||= Logger.new($stdout)
|
70
70
|
end
|
71
71
|
|
72
72
|
def normalize_domain(domain)
|
@@ -122,7 +122,7 @@ class Gman
|
|
122
122
|
|
123
123
|
def ensure_regex(domain)
|
124
124
|
REGEX_CHECKS.each do |msg, regex|
|
125
|
-
return reject(domain, msg) if domain
|
125
|
+
return reject(domain, msg) if domain&.match?(regex)
|
126
126
|
end
|
127
127
|
true
|
128
128
|
end
|
data/lib/gman/version.rb
CHANGED
data/script/profile
CHANGED
data/script/reconcile-us
CHANGED
data/script/vendor-public-suffix
CHANGED
@@ -15,14 +15,14 @@ PublicSuffix::List.default.each do |rule|
|
|
15
15
|
domain = nil
|
16
16
|
|
17
17
|
if rule.parts.length == 1
|
18
|
-
domain = rule.parts.first if ".#{rule.value}"
|
19
|
-
elsif ".#{rule.value}"
|
18
|
+
domain = rule.parts.first if REGEX.match?(".#{rule.value}")
|
19
|
+
elsif REGEX.match?(".#{rule.value}")
|
20
20
|
domain = rule.parts.pop(2).join('.')
|
21
21
|
end
|
22
22
|
|
23
23
|
domains.push domain unless domain.nil? || domains.include?(domain)
|
24
24
|
end
|
25
25
|
|
26
|
-
#
|
26
|
+
# NOTE: We want to skip resolution here, because a domain like `gov.sv` may be
|
27
27
|
# a valid TLD, not have any top-level sites, and we'd still want it listed
|
28
28
|
Gman::Importer.new('non-us gov' => domains).import(skip_resolve: true)
|
data/script/vendor-se
CHANGED
@@ -15,7 +15,7 @@ response = agent.submit(form, submit_button)
|
|
15
15
|
|
16
16
|
rows = CSV.parse(response.content, headers: true, col_sep: "\t")
|
17
17
|
domains = rows.map do |row|
|
18
|
-
row['Webbadress'] unless row['Namn']
|
18
|
+
row['Webbadress'] unless /UNIVERSITET/.match?(row['Namn'])
|
19
19
|
end
|
20
20
|
|
21
21
|
Gman::Importer.new('Swedish Administrative Authorities' => domains).import
|
data/script/vendor-us
CHANGED
data/spec/gman/bin_spec.rb
CHANGED
@@ -19,7 +19,7 @@ RSpec.describe 'Gman bin' do
|
|
19
19
|
|
20
20
|
it "knows it's valid" do
|
21
21
|
expect(output).to match('Valid government domain')
|
22
|
-
expect(exit_code).to
|
22
|
+
expect(exit_code).to be(0)
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'knows the type' do
|
@@ -50,7 +50,7 @@ RSpec.describe 'Gman bin' do
|
|
50
50
|
let(:args) { [domain, '--no-color'] }
|
51
51
|
|
52
52
|
it "doesn't color" do
|
53
|
-
expect(output).
|
53
|
+
expect(output).not_to match(/\e\[32m/)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -68,7 +68,7 @@ RSpec.describe 'Gman bin' do
|
|
68
68
|
|
69
69
|
it 'knows the domain is invalid' do
|
70
70
|
expect(output).to match('Invalid domain')
|
71
|
-
expect(exit_code).to
|
71
|
+
expect(exit_code).to be(1)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -77,7 +77,7 @@ RSpec.describe 'Gman bin' do
|
|
77
77
|
|
78
78
|
it "knows it's not a government domain" do
|
79
79
|
expect(output).to match('Not a government domain')
|
80
|
-
expect(exit_code).to
|
80
|
+
expect(exit_code).to be(1)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -20,7 +20,7 @@ RSpec.describe Gman::DomainList do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'stores the init var' do
|
23
|
-
expect(subject.send(type)).
|
23
|
+
expect(subject.send(type)).not_to be_nil
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'returns the domain data' do
|
@@ -41,11 +41,11 @@ RSpec.describe Gman::DomainList do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'knows if a domain is valid' do
|
44
|
-
expect(subject.valid?('whitehouse.gov')).to
|
44
|
+
expect(subject.valid?('whitehouse.gov')).to be(true)
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'knows if a domain is invalid' do
|
48
|
-
expect(subject.valid?('example.com')).to
|
48
|
+
expect(subject.valid?('example.com')).to be(false)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'returns the domain groups' do
|
@@ -63,7 +63,7 @@ RSpec.describe Gman::DomainList do
|
|
63
63
|
|
64
64
|
it 'alphabetizes the list' do
|
65
65
|
canada.shuffle!
|
66
|
-
expect(canada.first).
|
66
|
+
expect(canada.first).not_to eql('100milehouse.com')
|
67
67
|
subject.alphabetize
|
68
68
|
expect(canada.first).to eql('100milehouse.com')
|
69
69
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe 'Gman identifier' do
|
4
|
-
let(:domain) { '' }
|
5
4
|
subject { Gman.new(domain) }
|
6
5
|
|
6
|
+
let(:domain) { '' }
|
7
|
+
|
7
8
|
it 'parses the dotgov list' do
|
8
9
|
expect(Gman.dotgov_list).to be_a(CSV::Table)
|
9
10
|
expect(Gman.dotgov_list.first).to have_key('Domain Name')
|
@@ -15,7 +16,7 @@ RSpec.describe 'Gman identifier' do
|
|
15
16
|
|
16
17
|
it "knows it's a state" do
|
17
18
|
expect(subject).to be_a_state
|
18
|
-
expect(subject.type).to
|
19
|
+
expect(subject.type).to be(:state)
|
19
20
|
end
|
20
21
|
|
21
22
|
it 'knows the state' do
|
@@ -23,15 +24,15 @@ RSpec.describe 'Gman identifier' do
|
|
23
24
|
end
|
24
25
|
|
25
26
|
it "knows it's not a dotgov" do
|
26
|
-
expect(subject).
|
27
|
+
expect(subject).not_to be_a_dotgov
|
27
28
|
end
|
28
29
|
|
29
30
|
it "know's it's not a city" do
|
30
|
-
expect(subject).
|
31
|
+
expect(subject).not_to be_a_city
|
31
32
|
end
|
32
33
|
|
33
34
|
it "know's it's not a county" do
|
34
|
-
expect(subject).
|
35
|
+
expect(subject).not_to be_a_county
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
@@ -40,7 +41,7 @@ RSpec.describe 'Gman identifier' do
|
|
40
41
|
|
41
42
|
it "knows it's a city" do
|
42
43
|
expect(subject).to be_a_city
|
43
|
-
expect(subject.type).to
|
44
|
+
expect(subject.type).to be(:city)
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'knows the state' do
|
@@ -48,15 +49,15 @@ RSpec.describe 'Gman identifier' do
|
|
48
49
|
end
|
49
50
|
|
50
51
|
it "knows it's not a dotgov" do
|
51
|
-
expect(subject).
|
52
|
+
expect(subject).not_to be_a_dotgov
|
52
53
|
end
|
53
54
|
|
54
55
|
it "know's it's not a state" do
|
55
|
-
expect(subject).
|
56
|
+
expect(subject).not_to be_a_state
|
56
57
|
end
|
57
58
|
|
58
59
|
it "know's it's not a county" do
|
59
|
-
expect(subject).
|
60
|
+
expect(subject).not_to be_a_county
|
60
61
|
end
|
61
62
|
end
|
62
63
|
|
@@ -66,7 +67,7 @@ RSpec.describe 'Gman identifier' do
|
|
66
67
|
|
67
68
|
it "knows it's federal" do
|
68
69
|
expect(subject).to be_federal
|
69
|
-
expect(subject.type).to
|
70
|
+
expect(subject.type).to be(:federal)
|
70
71
|
end
|
71
72
|
|
72
73
|
it "knows it's a dotgov" do
|
@@ -74,15 +75,15 @@ RSpec.describe 'Gman identifier' do
|
|
74
75
|
end
|
75
76
|
|
76
77
|
it "knows it's not a city" do
|
77
|
-
expect(subject).
|
78
|
+
expect(subject).not_to be_a_city
|
78
79
|
end
|
79
80
|
|
80
81
|
it "knows it's not a state" do
|
81
|
-
expect(subject).
|
82
|
+
expect(subject).not_to be_a_state
|
82
83
|
end
|
83
84
|
|
84
85
|
it "knows it's not a county" do
|
85
|
-
expect(subject).
|
86
|
+
expect(subject).not_to be_a_county
|
86
87
|
end
|
87
88
|
|
88
89
|
it 'knows the state' do
|
@@ -107,7 +108,7 @@ RSpec.describe 'Gman identifier' do
|
|
107
108
|
|
108
109
|
it "knows it's a state" do
|
109
110
|
expect(subject).to be_a_state
|
110
|
-
expect(subject.type).to
|
111
|
+
expect(subject.type).to be(:state)
|
111
112
|
end
|
112
113
|
|
113
114
|
it "knows it's a dotgov" do
|
@@ -115,15 +116,15 @@ RSpec.describe 'Gman identifier' do
|
|
115
116
|
end
|
116
117
|
|
117
118
|
it "knows it's not a city" do
|
118
|
-
expect(subject).
|
119
|
+
expect(subject).not_to be_a_city
|
119
120
|
end
|
120
121
|
|
121
122
|
it "knows it's not federal" do
|
122
|
-
expect(subject).
|
123
|
+
expect(subject).not_to be_federal
|
123
124
|
end
|
124
125
|
|
125
126
|
it "knows it's not a county" do
|
126
|
-
expect(subject).
|
127
|
+
expect(subject).not_to be_a_county
|
127
128
|
end
|
128
129
|
|
129
130
|
it 'knows the state' do
|
@@ -140,7 +141,7 @@ RSpec.describe 'Gman identifier' do
|
|
140
141
|
|
141
142
|
it "knows it's a county" do
|
142
143
|
expect(subject).to be_a_county
|
143
|
-
expect(subject.type).to
|
144
|
+
expect(subject.type).to be(:county)
|
144
145
|
end
|
145
146
|
|
146
147
|
it "knows it's a dotgov" do
|
@@ -148,15 +149,15 @@ RSpec.describe 'Gman identifier' do
|
|
148
149
|
end
|
149
150
|
|
150
151
|
it "knows it's not a city" do
|
151
|
-
expect(subject).
|
152
|
+
expect(subject).not_to be_a_city
|
152
153
|
end
|
153
154
|
|
154
155
|
it "knows it's not federal" do
|
155
|
-
expect(subject).
|
156
|
+
expect(subject).not_to be_federal
|
156
157
|
end
|
157
158
|
|
158
159
|
it "knows it's not a state" do
|
159
|
-
expect(subject).
|
160
|
+
expect(subject).not_to be_a_state
|
160
161
|
end
|
161
162
|
|
162
163
|
it 'knows the state' do
|
@@ -173,7 +174,7 @@ RSpec.describe 'Gman identifier' do
|
|
173
174
|
|
174
175
|
it "knows it's a city" do
|
175
176
|
expect(subject).to be_a_city
|
176
|
-
expect(subject.type).to
|
177
|
+
expect(subject.type).to be(:city)
|
177
178
|
end
|
178
179
|
|
179
180
|
it 'knows the city' do
|
@@ -189,11 +190,11 @@ RSpec.describe 'Gman identifier' do
|
|
189
190
|
end
|
190
191
|
|
191
192
|
it "know's it's not a state" do
|
192
|
-
expect(subject).
|
193
|
+
expect(subject).not_to be_a_state
|
193
194
|
end
|
194
195
|
|
195
196
|
it "know's it's not a county" do
|
196
|
-
expect(subject).
|
197
|
+
expect(subject).not_to be_a_county
|
197
198
|
end
|
198
199
|
end
|
199
200
|
end
|
data/spec/gman/importer_spec.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
RSpec.describe Gman::Importer do
|
4
|
+
subject { described_class.new(domains) }
|
5
|
+
|
4
6
|
let(:domains) { { 'test' => ['example.com'] } }
|
5
7
|
let(:stdout) { StringIO.new }
|
6
8
|
let(:logger) { Logger.new(@stdout) }
|
7
9
|
let(:domain_list) { subject.domain_list }
|
8
|
-
subject { described_class.new(domains) }
|
9
10
|
|
10
11
|
before do
|
11
12
|
subject.instance_variable_set '@logger', logger
|
@@ -13,7 +14,7 @@ RSpec.describe Gman::Importer do
|
|
13
14
|
|
14
15
|
it 'inits the domain list' do
|
15
16
|
expect(domain_list).to be_a(Gman::DomainList)
|
16
|
-
expect(domain_list.count).to
|
17
|
+
expect(domain_list.count).to be(1)
|
17
18
|
expect(domain_list.domains.first).to eql('example.com')
|
18
19
|
end
|
19
20
|
|
@@ -31,7 +32,7 @@ RSpec.describe Gman::Importer do
|
|
31
32
|
|
32
33
|
context 'domain rejection' do
|
33
34
|
it 'returns false' do
|
34
|
-
expect(subject.reject('example.com', 'reasons')).to
|
35
|
+
expect(subject.reject('example.com', 'reasons')).to be(false)
|
35
36
|
end
|
36
37
|
|
37
38
|
it 'returns the reason why asked' do
|
@@ -44,6 +45,7 @@ RSpec.describe Gman::Importer do
|
|
44
45
|
context 'manipulating the domain list' do
|
45
46
|
context 'normalizing domains' do
|
46
47
|
let(:domains) { { 'test' => ['www.EXAMPLE.com/'] } }
|
48
|
+
|
47
49
|
before { subject.send :normalize_domains! }
|
48
50
|
|
49
51
|
it 'normalizes the domains' do
|
@@ -53,10 +55,11 @@ RSpec.describe Gman::Importer do
|
|
53
55
|
|
54
56
|
context 'removing invalid domains' do
|
55
57
|
let(:domains) { { 'test' => ['foo.github.io', 'example.com'] } }
|
58
|
+
|
56
59
|
before { subject.send :ensure_validity! }
|
57
60
|
|
58
61
|
it 'removes invalid domains' do
|
59
|
-
expect(domain_list.count).to
|
62
|
+
expect(domain_list.count).to be(1)
|
60
63
|
end
|
61
64
|
end
|
62
65
|
end
|
@@ -64,11 +67,14 @@ RSpec.describe Gman::Importer do
|
|
64
67
|
context 'with the current list stubbed' do
|
65
68
|
let(:stubbed_list) { Gman::DomainList.new(path: stubbed_list_path) }
|
66
69
|
let(:stubbed_file_contents) { File.read(stubbed_list_path) }
|
70
|
+
|
67
71
|
before { subject.instance_variable_set '@current', stubbed_list }
|
68
72
|
|
69
73
|
context 'writing' do
|
70
74
|
before { @current = subject.current.to_s }
|
75
|
+
|
71
76
|
before { subject.send :add_to_current }
|
77
|
+
|
72
78
|
after { File.write(stubbed_list_path, @current) }
|
73
79
|
|
74
80
|
context 'adding domains' do
|
@@ -89,6 +95,7 @@ RSpec.describe Gman::Importer do
|
|
89
95
|
'test2' => ['github.com', 'www.github.com', 'whitehouse.gov']
|
90
96
|
}
|
91
97
|
end
|
98
|
+
|
92
99
|
before { subject.import(skip_resolve: true) }
|
93
100
|
|
94
101
|
it 'imports' do
|
@@ -110,7 +117,7 @@ RSpec.describe Gman::Importer do
|
|
110
117
|
let(:domain) { 'whitehouse.gov' }
|
111
118
|
|
112
119
|
it 'is valid' do
|
113
|
-
expect(valid?).to
|
120
|
+
expect(valid?).to be(true)
|
114
121
|
end
|
115
122
|
end
|
116
123
|
|
@@ -123,7 +130,7 @@ RSpec.describe Gman::Importer do
|
|
123
130
|
}.each_key do |type|
|
124
131
|
context "a #{type} domain" do
|
125
132
|
it 'is invalid' do
|
126
|
-
expect(valid?).to
|
133
|
+
expect(valid?).to be(false)
|
127
134
|
end
|
128
135
|
end
|
129
136
|
end
|
data/spec/gman/locality_spec.rb
CHANGED
@@ -5,7 +5,7 @@ RSpec.describe Gman::Locality do
|
|
5
5
|
['foo.state.il.us', 'ci.foo.il.us'].each do |domain|
|
6
6
|
context "the #{domain} domain" do
|
7
7
|
it 'is valid' do
|
8
|
-
expect(described_class.valid?(domain)).to
|
8
|
+
expect(described_class.valid?(domain)).to be(true)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
@@ -16,7 +16,7 @@ RSpec.describe Gman::Locality do
|
|
16
16
|
'k12.il.us', 'ci.foo.zx.us'].each do |domain|
|
17
17
|
context "the #{domain} domain" do
|
18
18
|
it 'is invalid' do
|
19
|
-
expect(described_class.valid?(domain)).to
|
19
|
+
expect(described_class.valid?(domain)).to be(false)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/spec/gman_spec.rb
CHANGED
@@ -10,8 +10,8 @@ RSpec.describe Gman do
|
|
10
10
|
subject { described_class.new(domain) }
|
11
11
|
|
12
12
|
it "knows #{domain.inspect} is valid government domain" do
|
13
|
-
expect(described_class.valid?(domain)).to
|
14
|
-
expect(subject.valid?).to
|
13
|
+
expect(described_class.valid?(domain)).to be(true)
|
14
|
+
expect(subject.valid?).to be(true)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -24,8 +24,8 @@ RSpec.describe Gman do
|
|
24
24
|
subject { described_class.new(domain) }
|
25
25
|
|
26
26
|
it "knows #{domain.inspect} is not a valid government domain" do
|
27
|
-
expect(described_class.valid?(domain)).to
|
28
|
-
expect(subject.valid?).to
|
27
|
+
expect(described_class.valid?(domain)).to be(false)
|
28
|
+
expect(subject.valid?).to be(false)
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -37,7 +37,7 @@ RSpec.describe Gman do
|
|
37
37
|
let(:domain) { 'github.gov' }
|
38
38
|
|
39
39
|
it "knows it's not a locality" do
|
40
|
-
expect(subject.locality?).to
|
40
|
+
expect(subject.locality?).to be(false)
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ RSpec.describe Gman do
|
|
45
45
|
let(:domain) { 'foo.state.il.us' }
|
46
46
|
|
47
47
|
it "knows it's a locality" do
|
48
|
-
expect(subject.locality?).to
|
48
|
+
expect(subject.locality?).to be(true)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -60,15 +60,15 @@ RSpec.describe Gman do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'returns the config path' do
|
63
|
-
expect(Dir.exist?(described_class.config_path)).to
|
63
|
+
expect(Dir.exist?(described_class.config_path)).to be(true)
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'returns the list path' do
|
67
|
-
expect(File.exist?(described_class.list_path)).to
|
67
|
+
expect(File.exist?(described_class.list_path)).to be(true)
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'returns the academic list path' do
|
71
|
-
expect(File.exist?(described_class.academic_list_path)).to
|
71
|
+
expect(File.exist?(described_class.academic_list_path)).to be(true)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
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.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:
|
11
|
+
date: 2020-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: public_suffix
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
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
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -142,14 +142,42 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0
|
145
|
+
version: '1.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-performance
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.5'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.5'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rubocop-rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.0'
|
146
174
|
type: :development
|
147
175
|
prerelease: false
|
148
176
|
version_requirements: !ruby/object:Gem::Requirement
|
149
177
|
requirements:
|
150
178
|
- - "~>"
|
151
179
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0
|
180
|
+
version: '2.0'
|
153
181
|
- !ruby/object:Gem::Dependency
|
154
182
|
name: ruby-prof
|
155
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +220,7 @@ files:
|
|
192
220
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
193
221
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
194
222
|
- ".github/config.yml"
|
223
|
+
- ".github/funding.yml"
|
195
224
|
- ".github/no-response.yml"
|
196
225
|
- ".github/release-drafter.yml"
|
197
226
|
- ".github/settings.yml"
|
@@ -199,6 +228,7 @@ files:
|
|
199
228
|
- ".gitignore"
|
200
229
|
- ".rspec"
|
201
230
|
- ".rubocop.yml"
|
231
|
+
- ".rubocop_todo.yml"
|
202
232
|
- ".ruby-version"
|
203
233
|
- ".travis.yml"
|
204
234
|
- Gemfile
|
@@ -211,6 +241,7 @@ files:
|
|
211
241
|
- docs/CODE_OF_CONDUCT.md
|
212
242
|
- docs/CONTRIBUTING.md
|
213
243
|
- docs/README.md
|
244
|
+
- docs/SECURITY.md
|
214
245
|
- docs/_config.yml
|
215
246
|
- gman.gemspec
|
216
247
|
- lib/gman.rb
|
@@ -254,7 +285,7 @@ homepage: https://github.com/benbalter/gman
|
|
254
285
|
licenses:
|
255
286
|
- MIT
|
256
287
|
metadata: {}
|
257
|
-
post_install_message:
|
288
|
+
post_install_message:
|
258
289
|
rdoc_options: []
|
259
290
|
require_paths:
|
260
291
|
- lib
|
@@ -262,15 +293,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
293
|
requirements:
|
263
294
|
- - "~>"
|
264
295
|
- !ruby/object:Gem::Version
|
265
|
-
version: '2.
|
296
|
+
version: '2.5'
|
266
297
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
298
|
requirements:
|
268
299
|
- - ">="
|
269
300
|
- !ruby/object:Gem::Version
|
270
301
|
version: '0'
|
271
302
|
requirements: []
|
272
|
-
rubygems_version: 3.0.
|
273
|
-
signing_key:
|
303
|
+
rubygems_version: 3.0.3
|
304
|
+
signing_key:
|
274
305
|
specification_version: 4
|
275
306
|
summary: Check if a given domain or email address belong to a governemnt entity
|
276
307
|
test_files:
|