tldv-data 1.0.2022101300 → 1.0.2022120700

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: 0d36bacb941eaf9ff160d87f3df0d329c8dabfe8dbbe296e0ab3760ab71bd5fd
4
- data.tar.gz: a713c13da96dc9725218488fa334dfbd32769d4ec2a69290e67f4231ba66654a
3
+ metadata.gz: 409d4891fa2a79f1644ee8290fb22c685b916d57108891d3c5383bf881154e64
4
+ data.tar.gz: cfd4d681babf3d4182717b9420595f1be5b86bc0a6126147b9a901f58ec6e9e9
5
5
  SHA512:
6
- metadata.gz: ec176c98666bf7924eac78a3e6dfb7c2820877fe5c33e3c6a7bf30e5810bff7bff83bdab607132dcca67cc8273bc02cb67f233bc65484e2d1d088577889b5f30
7
- data.tar.gz: bb5cad9514af42df12aec3132c1c9b4851d0341a947e7be653d74af8f14bd77bfe5ff7e59ae545bcd723f958cc5fc24e5a5a1b47763b4cd2bbab0e82a64d53ea
6
+ metadata.gz: a89aee18a10ba61c5b9ea972f24369f60e4c8e6106931a9480566f54bf7f0ae80b88cf1664116485a8bd109a85ae717fb8828c7e3f063864309cdb656c05a491
7
+ data.tar.gz: e3a0fe6dbced0ee8ed1ee868e781a2098ef4c96e357da24ef5a935c73ffbcb82d7667dcaa2202607734e3592783d94133a6acab5e5d37a3fa520d012f416da82
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tldv-data (1.0.2022101300)
4
+ tldv-data (1.0.2022120700)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -36,6 +36,7 @@ GEM
36
36
 
37
37
  PLATFORMS
38
38
  arm64-darwin-21
39
+ x86_64-linux
39
40
 
40
41
  DEPENDENCIES
41
42
  faraday (~> 2.6)
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.2022101300"
9
+ VERSION = "1.0.2022120700"
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
@@ -1396,7 +1395,6 @@ module TLDv
1396
1395
  xn--j1amh
1397
1396
  xn--j6w193g
1398
1397
  xn--jlq480n2rg
1399
- xn--jlq61u9w7b
1400
1398
  xn--jvr189m
1401
1399
  xn--kcrx77d1x4a
1402
1400
  xn--kprw13d
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 "* updating data.rb"
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
- File.open(File.expand_path("../lib/tldv/data.rb", __dir__), "w") do |f|
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.2022101300
4
+ version: 1.0.2022120700
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-10-13 00:00:00.000000000 Z
11
+ date: 2022-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday