tldv-data 1.0.2022101300 → 1.0.2022112601

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d36bacb941eaf9ff160d87f3df0d329c8dabfe8dbbe296e0ab3760ab71bd5fd
4
- data.tar.gz: a713c13da96dc9725218488fa334dfbd32769d4ec2a69290e67f4231ba66654a
3
+ metadata.gz: 20e7b21e8f3f5430c7ba091a835b18df8286e29fe0a1d92c070d45c85b2926a0
4
+ data.tar.gz: c7213103091091725071f04f01cd7c12df5ec023619c7dd431ac7b36ba632150
5
5
  SHA512:
6
- metadata.gz: ec176c98666bf7924eac78a3e6dfb7c2820877fe5c33e3c6a7bf30e5810bff7bff83bdab607132dcca67cc8273bc02cb67f233bc65484e2d1d088577889b5f30
7
- data.tar.gz: bb5cad9514af42df12aec3132c1c9b4851d0341a947e7be653d74af8f14bd77bfe5ff7e59ae545bcd723f958cc5fc24e5a5a1b47763b4cd2bbab0e82a64d53ea
6
+ metadata.gz: d3dfa1cd32a4ab090aa35ae82fb7df3fd302784e01a308227eeadddc1ae6e9911202adb0d65d7011e5024a3fc3b02aedb7ea354f48ae732e5e6b0ff0e642728f
7
+ data.tar.gz: ad8de7971e3668810f03068591d5894cafd6e32fce17965ada71e24663dcb86d7878d88cab9267fce5efd4db9519e2cb63385a2cdeb48869255ee4eebc5a1038
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.2022112601)
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.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 "* 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.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-10-13 00:00:00.000000000 Z
11
+ date: 2022-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday