whois 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/codeql-analysis.yml +64 -0
- data/.github/workflows/release.yml +16 -0
- data/.github/workflows/tests.yml +29 -0
- data/.rubocop.yml +27 -0
- data/.rubocop_opinionated.yml +135 -0
- data/.rubocop_todo.yml +166 -0
- data/.simplecov +2 -0
- data/.tool-versions +1 -0
- data/CHANGELOG.md +79 -50
- data/CONTRIBUTING.md +12 -12
- data/Gemfile +5 -0
- data/LICENSE.txt +1 -1
- data/README.md +22 -22
- data/Rakefile +12 -17
- data/bin/console +1 -0
- data/bin/whoisrb +3 -2
- data/data/ipv4.json +1 -3
- data/data/tld.json +2 -99
- data/lib/whois/client.rb +4 -2
- data/lib/whois/errors.rb +4 -2
- data/lib/whois/record/part.rb +5 -4
- data/lib/whois/record.rb +4 -2
- data/lib/whois/server/adapters/afilias.rb +4 -1
- data/lib/whois/server/adapters/arin.rb +7 -4
- data/lib/whois/server/adapters/arpa.rb +20 -19
- data/lib/whois/server/adapters/base.rb +26 -40
- data/lib/whois/server/adapters/formatted.rb +4 -2
- data/lib/whois/server/adapters/none.rb +3 -1
- data/lib/whois/server/adapters/not_implemented.rb +3 -1
- data/lib/whois/server/adapters/standard.rb +4 -2
- data/lib/whois/server/adapters/verisign.rb +4 -1
- data/lib/whois/server/adapters/web.rb +3 -1
- data/lib/whois/server/socket_handler.rb +8 -6
- data/lib/whois/server.rb +55 -53
- data/lib/whois/version.rb +4 -2
- data/lib/whois.rb +13 -11
- data/spec/integration/whois_spec.rb +6 -6
- data/spec/spec_helper.rb +4 -4
- data/spec/support/helpers/connectivity_helper.rb +3 -3
- data/spec/support/helpers/spec_helper.rb +2 -0
- data/spec/whois/client_spec.rb +6 -7
- data/spec/whois/record/part_spec.rb +4 -4
- data/spec/whois/record_spec.rb +9 -7
- data/spec/whois/server/adapters/afilias_spec.rb +4 -4
- data/spec/whois/server/adapters/arin_spec.rb +9 -10
- data/spec/whois/server/adapters/arpa_spec.rb +2 -2
- data/spec/whois/server/adapters/base_spec.rb +13 -13
- data/spec/whois/server/adapters/formatted_spec.rb +8 -8
- data/spec/whois/server/adapters/none_spec.rb +2 -2
- data/spec/whois/server/adapters/not_implemented_spec.rb +4 -4
- data/spec/whois/server/adapters/standard_spec.rb +5 -5
- data/spec/whois/server/adapters/verisign_spec.rb +5 -5
- data/spec/whois/server/adapters/web_spec.rb +4 -4
- data/spec/whois/server/socket_handler_spec.rb +7 -5
- data/spec/whois/server_spec.rb +31 -29
- data/spec/whois/{errors_spec.rb → web_interface_error_spec.rb} +4 -4
- data/spec/whois/whois_spec.rb +3 -3
- data/utils/compare-whois.rb +1 -1
- data/utils/matrix.rb +1 -1
- metadata +13 -39
- data/.travis.yml +0 -18
- data/bin/setup +0 -8
- data/tasks/spec.rake +0 -199
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whois
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simone Carletti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -65,10 +65,17 @@ extra_rdoc_files:
|
|
65
65
|
- ".yardopts"
|
66
66
|
files:
|
67
67
|
- ".github/FUNDING.yml"
|
68
|
+
- ".github/dependabot.yml"
|
69
|
+
- ".github/workflows/codeql-analysis.yml"
|
70
|
+
- ".github/workflows/release.yml"
|
71
|
+
- ".github/workflows/tests.yml"
|
68
72
|
- ".gitignore"
|
69
73
|
- ".rspec"
|
74
|
+
- ".rubocop.yml"
|
75
|
+
- ".rubocop_opinionated.yml"
|
76
|
+
- ".rubocop_todo.yml"
|
70
77
|
- ".simplecov"
|
71
|
-
- ".
|
78
|
+
- ".tool-versions"
|
72
79
|
- ".yardopts"
|
73
80
|
- 4.0-Upgrade.md
|
74
81
|
- CHANGELOG.md
|
@@ -78,7 +85,6 @@ files:
|
|
78
85
|
- README.md
|
79
86
|
- Rakefile
|
80
87
|
- bin/console
|
81
|
-
- bin/setup
|
82
88
|
- bin/whoisrb
|
83
89
|
- data/asn16.json
|
84
90
|
- data/asn32.json
|
@@ -118,7 +124,6 @@ files:
|
|
118
124
|
- spec/support/helpers/connectivity_helper.rb
|
119
125
|
- spec/support/helpers/spec_helper.rb
|
120
126
|
- spec/whois/client_spec.rb
|
121
|
-
- spec/whois/errors_spec.rb
|
122
127
|
- spec/whois/record/part_spec.rb
|
123
128
|
- spec/whois/record_spec.rb
|
124
129
|
- spec/whois/server/adapters/afilias_spec.rb
|
@@ -133,8 +138,8 @@ files:
|
|
133
138
|
- spec/whois/server/adapters/web_spec.rb
|
134
139
|
- spec/whois/server/socket_handler_spec.rb
|
135
140
|
- spec/whois/server_spec.rb
|
141
|
+
- spec/whois/web_interface_error_spec.rb
|
136
142
|
- spec/whois/whois_spec.rb
|
137
|
-
- tasks/spec.rake
|
138
143
|
- utils/compare-whois.rb
|
139
144
|
- utils/deftld.rb
|
140
145
|
- utils/defutils.rb
|
@@ -161,39 +166,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
166
|
- !ruby/object:Gem::Version
|
162
167
|
version: '0'
|
163
168
|
requirements: []
|
164
|
-
rubygems_version: 3.
|
169
|
+
rubygems_version: 3.3.7
|
165
170
|
signing_key:
|
166
171
|
specification_version: 4
|
167
172
|
summary: An intelligent pure Ruby WHOIS client and parser.
|
168
|
-
test_files:
|
169
|
-
- spec/fixtures/referrals/afilias.bz.txt
|
170
|
-
- spec/fixtures/referrals/arin_referral_apnic.txt
|
171
|
-
- spec/fixtures/referrals/arin_referral_missing.txt
|
172
|
-
- spec/fixtures/referrals/arin_referral_ripe.txt
|
173
|
-
- spec/fixtures/referrals/arin_referral_rwhois.txt
|
174
|
-
- spec/fixtures/referrals/arin_referral_servernap.txt
|
175
|
-
- spec/fixtures/referrals/arin_referral_whois.txt
|
176
|
-
- spec/fixtures/referrals/crsnic.com.txt
|
177
|
-
- spec/fixtures/referrals/crsnic.com_referral.txt
|
178
|
-
- spec/fixtures/referrals/crsnic.com_referral_missing.txt
|
179
|
-
- spec/integration/whois_spec.rb
|
180
|
-
- spec/spec_helper.rb
|
181
|
-
- spec/support/helpers/connectivity_helper.rb
|
182
|
-
- spec/support/helpers/spec_helper.rb
|
183
|
-
- spec/whois/client_spec.rb
|
184
|
-
- spec/whois/errors_spec.rb
|
185
|
-
- spec/whois/record/part_spec.rb
|
186
|
-
- spec/whois/record_spec.rb
|
187
|
-
- spec/whois/server/adapters/afilias_spec.rb
|
188
|
-
- spec/whois/server/adapters/arin_spec.rb
|
189
|
-
- spec/whois/server/adapters/arpa_spec.rb
|
190
|
-
- spec/whois/server/adapters/base_spec.rb
|
191
|
-
- spec/whois/server/adapters/formatted_spec.rb
|
192
|
-
- spec/whois/server/adapters/none_spec.rb
|
193
|
-
- spec/whois/server/adapters/not_implemented_spec.rb
|
194
|
-
- spec/whois/server/adapters/standard_spec.rb
|
195
|
-
- spec/whois/server/adapters/verisign_spec.rb
|
196
|
-
- spec/whois/server/adapters/web_spec.rb
|
197
|
-
- spec/whois/server/socket_handler_spec.rb
|
198
|
-
- spec/whois/server_spec.rb
|
199
|
-
- spec/whois/whois_spec.rb
|
173
|
+
test_files: []
|
data/.travis.yml
DELETED
data/bin/setup
DELETED
data/tasks/spec.rake
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
namespace :spec do
|
4
|
-
|
5
|
-
ROOT_DIR = File.expand_path("../../", __FILE__)
|
6
|
-
TARGET_DIR = File.join(ROOT_DIR, %w( spec whois record parser responses ))
|
7
|
-
|
8
|
-
SOURCE_DIR = File.join(ROOT_DIR, %w( spec fixtures responses ))
|
9
|
-
SOURCE_PARTS = SOURCE_DIR.split("/")
|
10
|
-
|
11
|
-
|
12
|
-
TPL_DESCRIBE = <<-RUBY.chomp!
|
13
|
-
# encoding: utf-8
|
14
|
-
|
15
|
-
# This file is autogenerated. Do not edit it manually.
|
16
|
-
# If you want change the content of this file, edit
|
17
|
-
#
|
18
|
-
# %{sfile}
|
19
|
-
#
|
20
|
-
# and regenerate the tests with the following rake task
|
21
|
-
#
|
22
|
-
# $ rake spec:generate
|
23
|
-
#
|
24
|
-
|
25
|
-
require 'spec_helper'
|
26
|
-
require 'whois/record/parser/%{khost}.rb'
|
27
|
-
|
28
|
-
describe %{described_class}, "%{descr}" do
|
29
|
-
|
30
|
-
subject do
|
31
|
-
file = fixture("responses", "%{fixture}")
|
32
|
-
part = Whois::Record::Part.new(body: File.read(file))
|
33
|
-
described_class.new(part)
|
34
|
-
end
|
35
|
-
|
36
|
-
%{contexts}
|
37
|
-
end
|
38
|
-
RUBY
|
39
|
-
|
40
|
-
TPL_CONTEXT = <<-RUBY.chomp!
|
41
|
-
describe "#%{descr}" do
|
42
|
-
it do
|
43
|
-
%{examples}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
RUBY
|
47
|
-
|
48
|
-
TPL_MATCH = <<-RUBY.chomp!
|
49
|
-
expect(subject.%{attribute}).to %{match}
|
50
|
-
RUBY
|
51
|
-
|
52
|
-
TPL_MATCH_SIZE = <<-RUBY.chomp!
|
53
|
-
expect(subject.%{attribute}.size).to eq(%{size})
|
54
|
-
RUBY
|
55
|
-
|
56
|
-
TPL_MATCH_RAISE = <<-RUBY.chomp!
|
57
|
-
expect { subject.%{attribute} }.to %{match}
|
58
|
-
RUBY
|
59
|
-
|
60
|
-
def relativize(path)
|
61
|
-
path.gsub(ROOT_DIR, "")
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
task :generate => :generate_parsers
|
66
|
-
|
67
|
-
task :generate_parsers do
|
68
|
-
Dir["#{SOURCE_DIR}/**/*.expected"].each do |source_path|
|
69
|
-
|
70
|
-
# Generate the filename and described_class name from the test file.
|
71
|
-
parts = (source_path.split("/") - SOURCE_PARTS)
|
72
|
-
khost = parts.first
|
73
|
-
kfile = parts.last
|
74
|
-
described_class = Whois::Record::Parser.parser_klass(khost)
|
75
|
-
|
76
|
-
target_path = File.join(TARGET_DIR, *parts).gsub(".expected", "_spec.rb")
|
77
|
-
|
78
|
-
# Extract the tests from the test file
|
79
|
-
# and generates a Hash.
|
80
|
-
#
|
81
|
-
# {
|
82
|
-
# "domain" => [
|
83
|
-
# ["%s", "== \"google.biz\""]
|
84
|
-
# ],
|
85
|
-
# "created_on" => [
|
86
|
-
# ["%s", "be_a(Time)"],
|
87
|
-
# ["%s", "== Time.parse(\"2002-03-27 00:01:00 UTC\")"]
|
88
|
-
# ]
|
89
|
-
# }
|
90
|
-
#
|
91
|
-
tests = {}
|
92
|
-
match = nil
|
93
|
-
lines = File.open(source_path, "r:UTF-8")
|
94
|
-
lines.each do |line|
|
95
|
-
line.chomp!
|
96
|
-
case line
|
97
|
-
when ""
|
98
|
-
# skip empty line
|
99
|
-
when /^\s*$/, /^\s*\/\//
|
100
|
-
# skip comment line
|
101
|
-
when /^#([^\s]+)/
|
102
|
-
tests[match = $1] = []
|
103
|
-
when /^\s+(.+?) (.+)/
|
104
|
-
tests[match] << _parse_assertion($1, $2)
|
105
|
-
else
|
106
|
-
raise "Invalid Line `#{line}' in `#{source_path}'"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Generate the RSpec content and
|
111
|
-
# write one file for every test.
|
112
|
-
contexts = tests.map do |attr, specs|
|
113
|
-
matches = specs.map do |method, condition|
|
114
|
-
attribute = method % attr
|
115
|
-
case condition
|
116
|
-
when /raise_error/
|
117
|
-
TPL_MATCH_RAISE % { attribute: attribute, match: condition }
|
118
|
-
when /^%SIZE\{(\d+)\}$/
|
119
|
-
TPL_MATCH_SIZE % { attribute: attribute, size: $1 }
|
120
|
-
else
|
121
|
-
TPL_MATCH % { attribute: attribute, match: condition }
|
122
|
-
end
|
123
|
-
end.join("\n")
|
124
|
-
TPL_CONTEXT % { descr: attr, examples: matches }
|
125
|
-
end.join("\n")
|
126
|
-
|
127
|
-
describe = <<-RUBY
|
128
|
-
#{TPL_DESCRIBE % {
|
129
|
-
:described_class => described_class,
|
130
|
-
:khost => khost,
|
131
|
-
:descr => kfile,
|
132
|
-
:sfile => relativize(source_path),
|
133
|
-
:fixture => parts.join("/").gsub(".expected", ".txt"),
|
134
|
-
:contexts => contexts
|
135
|
-
}}
|
136
|
-
RUBY
|
137
|
-
|
138
|
-
print "Generating #{relativize(target_path)}... "
|
139
|
-
File.dirname(target_path).tap { |d| File.exists?(d) || FileUtils.mkdir_p(d) }
|
140
|
-
File.open(target_path, "w+") { |f| f.write(describe) }
|
141
|
-
print "done!\n"
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
def _parse_assertion(method, condition)
|
148
|
-
m = method
|
149
|
-
c = condition.strip
|
150
|
-
|
151
|
-
case
|
152
|
-
|
153
|
-
# %s %CLASS{time} -> %s be_a(time)
|
154
|
-
when c =~ /^%CLASS\{(.+)\}$/
|
155
|
-
c = "be_a(#{_build_condition_typeof($1)})"
|
156
|
-
|
157
|
-
# %s %TIME{...} -> %s Time.parse(...)
|
158
|
-
when c =~ /^%TIME\{(.+)\}$/
|
159
|
-
c = "eq(Time.parse(\"#{$1}\"))"
|
160
|
-
|
161
|
-
# %s %ERROR{...} -> %s raise_error(...)
|
162
|
-
when c =~ /^%ERROR\{(.+)\}$/
|
163
|
-
c = "raise_error(Whois::#{$1})"
|
164
|
-
|
165
|
-
# %s =~ "foo"
|
166
|
-
when c =~ /^%MATCH\{(.+)\}$/
|
167
|
-
c = "match(/#{$1}/)"
|
168
|
-
|
169
|
-
# %s == "foo"
|
170
|
-
when c =~ /^== (.+)$/
|
171
|
-
c = "eq(#{$1})"
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
|
-
[m, c]
|
176
|
-
end
|
177
|
-
|
178
|
-
def _build_condition_typeof(described_class)
|
179
|
-
case described_class
|
180
|
-
when "array" then "Array"
|
181
|
-
when "time" then "Time"
|
182
|
-
when "contact" then "Whois::Record::Contact"
|
183
|
-
when "registrar" then "Whois::Record::Registrar"
|
184
|
-
when "nameserver" then "Whois::Record::Nameserver"
|
185
|
-
else
|
186
|
-
raise "Unknown class `#{described_class}'"
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def _build_condition_typecast(described_class, value)
|
191
|
-
case described_class
|
192
|
-
when "time"
|
193
|
-
%Q{Time.parse("#{value}")}
|
194
|
-
else
|
195
|
-
raise "Unknown class `#{described_class}'"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
end
|