domain_name 0.5.20190701 → 0.6.20240107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +41 -0
- data/CHANGELOG.md +81 -5
- data/Rakefile +2 -2
- data/data/public_suffix_list.dat +4749 -2315
- data/domain_name.gemspec +3 -3
- data/lib/domain_name/etld_data.rb +1691 -903
- data/lib/domain_name/version.rb +1 -1
- data/lib/domain_name.rb +5 -2
- data/test/test_domain_name-punycode.rb +1 -1
- data/test/test_domain_name.rb +4 -0
- metadata +11 -31
- data/.travis.yml +0 -21
data/lib/domain_name/version.rb
CHANGED
data/lib/domain_name.rb
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
require 'domain_name/version'
|
9
9
|
require 'domain_name/punycode'
|
10
10
|
require 'domain_name/etld_data'
|
11
|
-
require 'unf'
|
12
11
|
require 'ipaddr'
|
13
12
|
|
14
13
|
# Represents a domain name ready for extracting its registered domain
|
@@ -284,9 +283,13 @@ class DomainName
|
|
284
283
|
|
285
284
|
class << self
|
286
285
|
# Normalizes a _domain_ using the Punycode algorithm as necessary.
|
286
|
+
# Input must be strictly ASCII-only or unicode.
|
287
287
|
# The result will be a downcased, ASCII-only string.
|
288
288
|
def normalize(domain)
|
289
|
-
|
289
|
+
chomped = domain.chomp(DOT)
|
290
|
+
normalized = chomped.ascii_only? ? chomped : chomped.unicode_normalize(:nfc)
|
291
|
+
|
292
|
+
DomainName::Punycode.encode_hostname(normalized).downcase
|
290
293
|
end
|
291
294
|
end
|
292
295
|
end
|
@@ -91,7 +91,7 @@ class TestDomainName < Test::Unit::TestCase
|
|
91
91
|
'-> $1.00 <--']
|
92
92
|
].each { |title, cps, punycode|
|
93
93
|
assert_equal punycode, DomainName::Punycode.encode(cps.pack('U*')), title
|
94
|
-
assert_equal cps.pack('U*').
|
94
|
+
assert_equal cps.pack('U*').unicode_normalize(:nfc), DomainName::Punycode.decode(punycode), title
|
95
95
|
}
|
96
96
|
end
|
97
97
|
end
|
data/test/test_domain_name.rb
CHANGED
@@ -35,6 +35,10 @@ class TestDomainName < Test::Unit::TestCase
|
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
38
|
+
test "accept ASCII-only 'binary' encoded hostnames" do
|
39
|
+
assert_equal "example.com", DomainName.new("example.com".force_encoding("ASCII-8BIT")).hostname
|
40
|
+
end
|
41
|
+
|
38
42
|
test "parse canonical domain names correctly" do
|
39
43
|
[
|
40
44
|
# Mixed case.
|
metadata
CHANGED
@@ -1,49 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: domain_name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.20240107
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: unf
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.5
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 1.0.0
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.0.5
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.0
|
33
13
|
- !ruby/object:Gem::Dependency
|
34
14
|
name: test-unit
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
36
16
|
requirements:
|
37
|
-
- - "
|
17
|
+
- - ">="
|
38
18
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
19
|
+
version: '0'
|
40
20
|
type: :development
|
41
21
|
prerelease: false
|
42
22
|
version_requirements: !ruby/object:Gem::Requirement
|
43
23
|
requirements:
|
44
|
-
- - "
|
24
|
+
- - ">="
|
45
25
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
26
|
+
version: '0'
|
47
27
|
- !ruby/object:Gem::Dependency
|
48
28
|
name: bundler
|
49
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,14 +44,14 @@ dependencies:
|
|
64
44
|
requirements:
|
65
45
|
- - ">="
|
66
46
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
47
|
+
version: '0'
|
68
48
|
type: :development
|
69
49
|
prerelease: false
|
70
50
|
version_requirements: !ruby/object:Gem::Requirement
|
71
51
|
requirements:
|
72
52
|
- - ">="
|
73
53
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0
|
54
|
+
version: '0'
|
75
55
|
- !ruby/object:Gem::Dependency
|
76
56
|
name: rdoc
|
77
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,8 +80,8 @@ extra_rdoc_files:
|
|
100
80
|
- README.md
|
101
81
|
files:
|
102
82
|
- ".document"
|
83
|
+
- ".github/workflows/ci.yml"
|
103
84
|
- ".gitignore"
|
104
|
-
- ".travis.yml"
|
105
85
|
- CHANGELOG.md
|
106
86
|
- Gemfile
|
107
87
|
- LICENSE.txt
|
@@ -132,14 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
112
|
requirements:
|
133
113
|
- - ">="
|
134
114
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
115
|
+
version: 2.7.0
|
136
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
117
|
requirements:
|
138
118
|
- - ">="
|
139
119
|
- !ruby/object:Gem::Version
|
140
120
|
version: '0'
|
141
121
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
122
|
+
rubygems_version: 3.4.10
|
143
123
|
signing_key:
|
144
124
|
specification_version: 4
|
145
125
|
summary: Domain Name manipulation library for Ruby
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 1.8.7
|
4
|
-
- ree
|
5
|
-
- 1.9.3
|
6
|
-
- 2.0.0
|
7
|
-
- 2.1.9
|
8
|
-
- 2.2.5
|
9
|
-
- 2.3.1
|
10
|
-
- ruby-head
|
11
|
-
- jruby-1.7.20
|
12
|
-
- jruby-9.0.5.0
|
13
|
-
- jruby-head
|
14
|
-
- rbx-2
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: jruby-head
|
19
|
-
- rvm: rbx-2
|
20
|
-
before_install:
|
21
|
-
- gem update bundler
|