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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3277f0515a3352397cb07125c23a6c0adca60841b76e13702d26fe9ea477da23
4
- data.tar.gz: 1fe59c2df08f8549a4ec64eac1e77c1b887aedaca3fb9971445e07071f2e017f
3
+ metadata.gz: d669efd7ce495249c33d645e83d5273423121befebf7c3c23312dfbf52741005
4
+ data.tar.gz: 9e745c1a131e60140633a4b711ee96cb611971277beae7263b69e0f6a00d450d
5
5
  SHA512:
6
- metadata.gz: b9936faf0526ba4b8319bc336883c8d69d057ec6d6bd9e8f75746d5281d891c3a607d8af2cd3e4676dc9ede9205c5015378d3ff71640693ecf6e61eb948be0c8
7
- data.tar.gz: 0b3743bf4ab5b611e14b8f6164aea146f6e63348b1f2970cebbf14e981b564ca5138183be312f5646e5ba7a409fe62fb21e3b36e1d5b540fd5179cd6acd3951a
6
+ metadata.gz: ca93a3c3b2ec4f08e99f62800a275c071a40ee519a42ae478875aa5342a65f66c885b2f43f6e8087257ee2309a2558a387239852f1fe16173fe16132c2e99a37
7
+ data.tar.gz: 7a7ee379f1b6e37ab929648020b962090bbd22f2ff61e2c3b7b10559c78c18548fe5c3eae8703ca7e18010b100c30f26698c17dae203b906e79cbde20b3b0524
@@ -0,0 +1 @@
1
+ patreon: benbalter
@@ -28,6 +28,6 @@ branch_protection:
28
28
  required_status_checks:
29
29
  strict: true
30
30
  contexts:
31
- - "Travis CI - Pull Request"
31
+ - "continuous-integration/travis-ci"
32
32
  required_pull_request_reviews:
33
33
  require_code_owner_reviews: true
@@ -1,5 +1,11 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
6
+
1
7
  AllCops:
2
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.5
3
9
  Exclude:
4
10
  - config/**/*
5
11
  - vendor/**/*
@@ -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'
@@ -1 +1 @@
1
- 2.5.1
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 'Status : ' + 'Invalid domain'.red
43
+ puts "Status : #{'Invalid domain'.red}"
44
44
  exit 1
45
45
  end
46
46
 
47
47
  unless gman.valid?
48
- puts 'Status : ' + 'Not a government domain'.red
48
+ puts "Status : #{'Not a government domain'.red}"
49
49
  exit 1
50
50
  end
51
51
 
52
- puts 'Status : ' + 'Valid government domain'.green
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)
@@ -6,8 +6,8 @@
6
6
  require './lib/gman'
7
7
 
8
8
  # Auto-flush
9
- STDOUT.sync = true
10
- STDERR.sync = true
9
+ $stdout.sync = true
10
+ $stderr.sync = true
11
11
 
12
12
  ARGF.each do |line|
13
13
  puts line if Gman.valid?(line)
@@ -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
@@ -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 `./config/domains.txt` as a list of TLDs and SLD+TLDs.
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
 
@@ -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.conutry.calling_code #=> "+1"
75
+ domain.country.calling_code #=> "+1"
76
76
  ```
77
77
 
78
78
  ### Check if a country is on the US Sanctions list
@@ -0,0 +1,3 @@
1
+ # Security Policy
2
+
3
+ To report a security vulnerability, please email [ben@balter.com](mailto:ben@balter.com).
@@ -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.3'
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', '~> 3.0')
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.37')
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
@@ -40,8 +40,8 @@ class Gman
40
40
 
41
41
  @country ||= begin
42
42
  IsoCountryCodes.find(alpha2) if alpha2
43
- rescue IsoCountryCodes::UnknownCodeError
44
- nil
43
+ rescue IsoCountryCodes::UnknownCodeError
44
+ nil
45
45
  end
46
46
  end
47
47
  end
@@ -136,7 +136,7 @@ class Gman
136
136
  domain_hash = {}
137
137
  group = ''
138
138
  lines.each do |line|
139
- if line =~ COMMENT_REGEX
139
+ if COMMENT_REGEX.match?(line)
140
140
  group = COMMENT_REGEX.match(line)[1]
141
141
  else
142
142
  safe_push(domain_hash, group, line.downcase)
@@ -66,7 +66,7 @@ class Gman
66
66
  end
67
67
 
68
68
  def logger
69
- @logger ||= Logger.new(STDOUT)
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 =~ regex
125
+ return reject(domain, msg) if domain&.match?(regex)
126
126
  end
127
127
  true
128
128
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Gman
4
- VERSION = '7.0.3'
4
+ VERSION = '7.0.4'
5
5
  end
@@ -18,4 +18,4 @@ end
18
18
 
19
19
  result = RubyProf.stop
20
20
  printer = RubyProf::FlatPrinter.new(result)
21
- printer.print(STDOUT)
21
+ printer.print($stdout)
@@ -22,7 +22,7 @@ data = data.split(/\r?\n/).reject(&:empty?)
22
22
  domains = {}
23
23
  group = ''
24
24
  data.each do |row|
25
- if row =~ /^\w/
25
+ if /^\w/.match?(row)
26
26
  group = row
27
27
  domains[group] = []
28
28
  else
@@ -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}" =~ REGEX
19
- elsif ".#{rule.value}" =~ REGEX
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
- # Note: We want to skip resolution here, because a domain like `gov.sv` may be
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)
@@ -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'] =~ /UNIVERSITET/
18
+ row['Webbadress'] unless /UNIVERSITET/.match?(row['Namn'])
19
19
  end
20
20
 
21
21
  Gman::Importer.new('Swedish Administrative Authorities' => domains).import
@@ -26,7 +26,7 @@ data = data.split(/\r?\n/).reject(&:empty?)
26
26
  domains = {}
27
27
  group = ''
28
28
  data.each do |row|
29
- if row =~ /^\w/
29
+ if /^\w/.match?(row)
30
30
  group = row
31
31
  domains[group] = []
32
32
  else
@@ -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 eql(0)
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).to_not match(/\e\[32m/)
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 eql(1)
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 eql(1)
80
+ expect(exit_code).to be(1)
81
81
  end
82
82
  end
83
83
 
@@ -10,6 +10,7 @@ RSpec.describe 'Gman Country Codes' do
10
10
  }.each do |domain, expected_country|
11
11
  context "given #{domain.inspect}" do
12
12
  subject { Gman.new(domain) }
13
+
13
14
  let(:country) { subject.country }
14
15
 
15
16
  it 'knows the country' do
@@ -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)).to_not be_nil
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 eql(true)
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 eql(false)
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).to_not eql('100milehouse.com')
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 eql(:state)
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).to_not be_a_dotgov
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).to_not be_a_city
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).to_not be_a_county
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 eql(:city)
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).to_not be_a_dotgov
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).to_not be_a_state
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).to_not be_a_county
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 eql(:federal)
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).to_not be_a_city
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).to_not be_a_state
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).to_not be_a_county
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 eql(:state)
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).to_not be_a_city
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).to_not be_federal
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).to_not be_a_county
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 eql(:county)
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).to_not be_a_city
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).to_not be_federal
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).to_not be_a_state
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 eql(:city)
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).to_not be_a_state
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).to_not be_a_county
197
+ expect(subject).not_to be_a_county
197
198
  end
198
199
  end
199
200
  end
@@ -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 eql(1)
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 eql(false)
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 eql(1)
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 eql(true)
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 eql(false)
133
+ expect(valid?).to be(false)
127
134
  end
128
135
  end
129
136
  end
@@ -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 eql(true)
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 eql(false)
19
+ expect(described_class.valid?(domain)).to be(false)
20
20
  end
21
21
  end
22
22
  end
@@ -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 eql(true)
14
- expect(subject.valid?).to eql(true)
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 eql(false)
28
- expect(subject.valid?).to eql(false)
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 eql(false)
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 eql(true)
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 eql(true)
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 eql(true)
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 eql(true)
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.3
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: 2019-01-07 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
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.37'
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.37'
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.3'
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.2
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: