domain_name 0.5.20160615 → 0.5.20161021
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -2
- data/CHANGELOG.md +189 -0
- data/LICENSE.txt +10 -39
- data/README.md +3 -5
- data/Rakefile +2 -3
- data/data/{effective_tld_names.dat → public_suffix_list.dat} +284 -51
- data/domain_name.gemspec +1 -10
- data/lib/domain_name/etld_data.rb +127 -24
- data/lib/domain_name/version.rb +1 -1
- data/test/helper.rb +0 -1
- data/test/test_domain_name-punycode.rb +1 -1
- data/test/test_domain_name.rb +9 -9
- data/tool/gen_etld_data.rb +1 -1
- metadata +6 -22
data/lib/domain_name/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestDomainName < Test::Unit::TestCase
|
4
|
-
|
4
|
+
test "encode labels just as listed in RFC 3492 #7.1 (slightly modified)" do
|
5
5
|
[
|
6
6
|
['(A) Arabic (Egyptian)',
|
7
7
|
[0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A, 0x0643, 0x0644,
|
data/test/test_domain_name.rb
CHANGED
@@ -3,7 +3,7 @@ require 'helper'
|
|
3
3
|
require 'ipaddr'
|
4
4
|
|
5
5
|
class TestDomainName < Test::Unit::TestCase
|
6
|
-
|
6
|
+
test "raise ArgumentError if hostname starts with a dot" do
|
7
7
|
[
|
8
8
|
# Leading dot.
|
9
9
|
'.com',
|
@@ -15,7 +15,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
15
15
|
}
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
test "accept a String-alike for initialization" do
|
19
19
|
Object.new.tap { |obj|
|
20
20
|
def obj.to_str
|
21
21
|
"Example.org"
|
@@ -35,7 +35,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
test "parse canonical domain names correctly" do
|
39
39
|
[
|
40
40
|
# Mixed case.
|
41
41
|
['COM', nil, false, 'com', true],
|
@@ -134,7 +134,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
134
134
|
}
|
135
135
|
end
|
136
136
|
|
137
|
-
|
137
|
+
test "compare hostnames correctly" do
|
138
138
|
[
|
139
139
|
["foo.com", "abc.foo.com", 1],
|
140
140
|
["COM", "abc.foo.com", 1],
|
@@ -180,7 +180,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
180
180
|
}
|
181
181
|
end
|
182
182
|
|
183
|
-
|
183
|
+
test "check cookie domain correctly" do
|
184
184
|
{
|
185
185
|
'com' => [
|
186
186
|
['com', false],
|
@@ -255,7 +255,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
255
255
|
}
|
256
256
|
end
|
257
257
|
|
258
|
-
|
258
|
+
test "parse IPv4 addresseses" do
|
259
259
|
a = '192.168.10.20'
|
260
260
|
dn = DomainName(a)
|
261
261
|
assert_equal(a, dn.hostname)
|
@@ -270,7 +270,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
270
270
|
assert_equal(nil, dn.superdomain)
|
271
271
|
end
|
272
272
|
|
273
|
-
|
273
|
+
test "parse IPv6 addresseses" do
|
274
274
|
a = '2001:200:dff:fff1:216:3eff:feb1:44d7'
|
275
275
|
b = '2001:0200:0dff:fff1:0216:3eff:feb1:44d7'
|
276
276
|
[b, b.upcase, "[#{b}]", "[#{b.upcase}]"].each { |host|
|
@@ -289,7 +289,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
289
289
|
}
|
290
290
|
end
|
291
291
|
|
292
|
-
|
292
|
+
test "get superdomain" do
|
293
293
|
[
|
294
294
|
%w[www.sub.example.local sub.example.local example.local local],
|
295
295
|
%w[www.sub.example.com sub.example.com example.com com],
|
@@ -304,7 +304,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
304
304
|
}
|
305
305
|
end
|
306
306
|
|
307
|
-
|
307
|
+
test "have idn methods" do
|
308
308
|
dn = DomainName("金八先生.B組.3年.日本語ドメイン名Example.日本")
|
309
309
|
|
310
310
|
assert_equal "xn--44q1cv48kq8x.xn--b-gf6c.xn--3-pj3b.xn--example-6q4fyliikhk162btq3b2zd4y2o.xn--wgv71a", dn.hostname
|
data/tool/gen_etld_data.rb
CHANGED
@@ -9,7 +9,7 @@ require 'set'
|
|
9
9
|
require 'erb'
|
10
10
|
|
11
11
|
def main
|
12
|
-
dat_file = $basedir + 'data' + '
|
12
|
+
dat_file = $basedir + 'data' + 'public_suffix_list.dat'
|
13
13
|
dir = $basedir + 'lib' + 'domain_name'
|
14
14
|
erb_file = dir + 'etld_data.rb.erb'
|
15
15
|
rb_file = dir + 'etld_data.rb'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domain_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.20161021
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unf
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.5.5
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: shoulda
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: bundler
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,11 +102,12 @@ files:
|
|
116
102
|
- ".document"
|
117
103
|
- ".gitignore"
|
118
104
|
- ".travis.yml"
|
105
|
+
- CHANGELOG.md
|
119
106
|
- Gemfile
|
120
107
|
- LICENSE.txt
|
121
108
|
- README.md
|
122
109
|
- Rakefile
|
123
|
-
- data/
|
110
|
+
- data/public_suffix_list.dat
|
124
111
|
- domain_name.gemspec
|
125
112
|
- lib/domain_name.rb
|
126
113
|
- lib/domain_name/etld_data.rb
|
@@ -135,9 +122,7 @@ homepage: https://github.com/knu/ruby-domain_name
|
|
135
122
|
licenses:
|
136
123
|
- BSD-2-Clause
|
137
124
|
- BSD-3-Clause
|
138
|
-
- MPL-
|
139
|
-
- GPL-2.0
|
140
|
-
- LGPL-2.1
|
125
|
+
- MPL-2.0
|
141
126
|
metadata: {}
|
142
127
|
post_install_message:
|
143
128
|
rdoc_options: []
|
@@ -155,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
140
|
version: '0'
|
156
141
|
requirements: []
|
157
142
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.6.6
|
159
144
|
signing_key:
|
160
145
|
specification_version: 4
|
161
146
|
summary: Domain Name manipulation library for Ruby
|
@@ -163,4 +148,3 @@ test_files:
|
|
163
148
|
- test/helper.rb
|
164
149
|
- test/test_domain_name-punycode.rb
|
165
150
|
- test/test_domain_name.rb
|
166
|
-
has_rdoc:
|