tldv-data 1.0.2022101300 → 1.0.2022112601
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/tldv/data.rb +1 -2
- data/rakelib/update.rake +36 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20e7b21e8f3f5430c7ba091a835b18df8286e29fe0a1d92c070d45c85b2926a0
|
4
|
+
data.tar.gz: c7213103091091725071f04f01cd7c12df5ec023619c7dd431ac7b36ba632150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3dfa1cd32a4ab090aa35ae82fb7df3fd302784e01a308227eeadddc1ae6e9911202adb0d65d7011e5024a3fc3b02aedb7ea354f48ae732e5e6b0ff0e642728f
|
7
|
+
data.tar.gz: ad8de7971e3668810f03068591d5894cafd6e32fce17965ada71e24663dcb86d7878d88cab9267fce5efd4db9519e2cb63385a2cdeb48869255ee4eebc5a1038
|
data/Gemfile.lock
CHANGED
data/lib/tldv/data.rb
CHANGED
@@ -6,7 +6,7 @@ require "set"
|
|
6
6
|
|
7
7
|
module TLDv
|
8
8
|
module Data # rubocop:disable Metrics/ModuleLength
|
9
|
-
VERSION = "1.0.
|
9
|
+
VERSION = "1.0.2022112601"
|
10
10
|
|
11
11
|
TLDS = Set.new(
|
12
12
|
%w[
|
@@ -28,7 +28,6 @@ module TLDv
|
|
28
28
|
aco
|
29
29
|
actor
|
30
30
|
ad
|
31
|
-
adac
|
32
31
|
ads
|
33
32
|
adult
|
34
33
|
ae
|
data/rakelib/update.rake
CHANGED
@@ -24,11 +24,19 @@ DATA_MODULE_TEMPLATE = <<~ERB
|
|
24
24
|
end
|
25
25
|
ERB
|
26
26
|
|
27
|
+
def silence_warnings
|
28
|
+
old_verbose = $VERBOSE
|
29
|
+
$VERBOSE = nil
|
30
|
+
yield
|
31
|
+
ensure
|
32
|
+
$VERBOSE = old_verbose
|
33
|
+
end
|
34
|
+
|
27
35
|
task :update do
|
28
36
|
puts "* fetching TLD database"
|
29
37
|
raw_data = Faraday.get("https://data.iana.org/TLD/tlds-alpha-by-domain.txt").body
|
30
38
|
|
31
|
-
puts "*
|
39
|
+
puts "* generating code"
|
32
40
|
tlds = raw_data
|
33
41
|
.split("\n")
|
34
42
|
.reject { _1.start_with?("#") }
|
@@ -41,7 +49,33 @@ task :update do
|
|
41
49
|
iana_version:,
|
42
50
|
tlds:
|
43
51
|
)
|
44
|
-
|
52
|
+
|
53
|
+
# ensure the file is only updated if the set of TLDs changed
|
54
|
+
tldv_data_path = File.expand_path("../lib/tldv/data.rb", __dir__)
|
55
|
+
|
56
|
+
silence_warnings { load tldv_data_path }
|
57
|
+
old_version = TLDv::Data::VERSION
|
58
|
+
old_tlds = TLDv::Data::TLDS
|
59
|
+
|
60
|
+
silence_warnings { eval code } # rubocop:disable Security/Eval
|
61
|
+
new_version = TLDv::Data::VERSION
|
62
|
+
if old_version == new_version
|
63
|
+
puts "* version stayed the same, ignoring update"
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
new_tlds = TLDv::Data::TLDS
|
68
|
+
puts "* version #{old_version} -> #{new_version}"
|
69
|
+
tld_diff = new_tlds ^ old_tlds
|
70
|
+
if tld_diff.size.zero?
|
71
|
+
puts "-- no changes"
|
72
|
+
next
|
73
|
+
end
|
74
|
+
puts "-- changeset:"
|
75
|
+
tld_diff.each { puts " - #{_1}" }
|
76
|
+
|
77
|
+
puts "* updating data.rb"
|
78
|
+
File.open(tldv_data_path, "w") do |f|
|
45
79
|
f.puts code
|
46
80
|
end
|
47
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tldv-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2022112601
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Gadinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|