relaton-iana 1.14.0 → 1.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -0
- data/.github/workflows/release.yml +3 -2
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/Gemfile +6 -0
- data/README.adoc +1 -1
- data/grammars/basicdoc.rng +0 -1
- data/grammars/biblio.rng +12 -2
- data/lib/relaton_iana/data_fetcher.rb +12 -50
- data/lib/relaton_iana/version.rb +1 -1
- data/lib/relaton_iana.rb +0 -1
- data/relaton_iana.gemspec +3 -11
- metadata +6 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e28db214fb7ee96d95437e096953b44088e3dcb0b0255a224773a2c3d0265ed2
|
4
|
+
data.tar.gz: 397b757c60191a373016f767ef76bd34000a77d4039ea85bd022376ca40fc3f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82a9ba0764bae580b8938ef563e35b31da5a666e5accf9b99ff0f92ca9d1d2bb1c7f64515b545534efe1cb417cf68915507983be0fcbe34eb444380c3c5fe886
|
7
|
+
data.tar.gz: c28062035798f285063e3fff10b6a508998512f77e8ed7d63c4918980df97de8b7e0c5bb2a2a98c7a1142b6e047040ddff7984e6179f21fb6fbc70fb6628ad60
|
data/.github/workflows/rake.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -111,7 +111,7 @@ Done in: 155 sec.
|
|
111
111
|
|
112
112
|
This method uses GitHub search API to fetch the documents. The search API has a https://docs.github.com/en/rest/reference/search#rate-limit[rate limitaion] of 30 requests per minute for authenticated users and 10 requests per minute for unauthenticated users. Usually, the rate limit is not reached because the search API is used only for the file list fetching. But if you run the method multiple times in a short period, the rate limit may be reached. In this case, the method will wait until the rate limit is reset.
|
113
113
|
|
114
|
-
You can use a personal access token to increase the rate limit. To do this, add your
|
114
|
+
You can use a personal access token (PTA) to increase the rate limit. To do this, add your PTA to the `GITHUB_TOKEN` environment variable.
|
115
115
|
|
116
116
|
== Development
|
117
117
|
|
data/grammars/basicdoc.rng
CHANGED
data/grammars/biblio.rng
CHANGED
@@ -216,6 +216,9 @@
|
|
216
216
|
<optional>
|
217
217
|
<ref name="fullname"/>
|
218
218
|
</optional>
|
219
|
+
<zeroOrMore>
|
220
|
+
<ref name="credential"/>
|
221
|
+
</zeroOrMore>
|
219
222
|
<zeroOrMore>
|
220
223
|
<ref name="affiliation"/>
|
221
224
|
</zeroOrMore>
|
@@ -232,6 +235,11 @@
|
|
232
235
|
<ref name="FullNameType"/>
|
233
236
|
</element>
|
234
237
|
</define>
|
238
|
+
<define name="credential">
|
239
|
+
<element name="credential">
|
240
|
+
<text/>
|
241
|
+
</element>
|
242
|
+
</define>
|
235
243
|
<define name="FullNameType">
|
236
244
|
<choice>
|
237
245
|
<group>
|
@@ -305,7 +313,9 @@
|
|
305
313
|
<zeroOrMore>
|
306
314
|
<ref name="affiliationdescription"/>
|
307
315
|
</zeroOrMore>
|
308
|
-
<
|
316
|
+
<optional>
|
317
|
+
<ref name="organization"/>
|
318
|
+
</optional>
|
309
319
|
</element>
|
310
320
|
</define>
|
311
321
|
<define name="affiliationname">
|
@@ -1316,7 +1326,7 @@
|
|
1316
1326
|
<value>commentaryOf</value>
|
1317
1327
|
<value>hasCommentary</value>
|
1318
1328
|
<value>related</value>
|
1319
|
-
<value>
|
1329
|
+
<value>hasComplement</value>
|
1320
1330
|
<value>complementOf</value>
|
1321
1331
|
<value>obsoletes</value>
|
1322
1332
|
<value>obsoletedBy</value>
|
@@ -34,59 +34,21 @@ module RelatonIana
|
|
34
34
|
#
|
35
35
|
# Parse documents
|
36
36
|
#
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
44
|
-
if ENV["GITHUB_TOKEN"]
|
45
|
-
headers = { "Authorization" => "token #{ENV['GITHUB_TOKEN']}" }
|
46
|
-
end
|
47
|
-
attempt = 0
|
48
|
-
json = {}
|
49
|
-
resp = nil
|
50
|
-
until attempt > 3 || json["items"]
|
51
|
-
if attempt.positive?
|
52
|
-
t = resp.headers["x-ratelimit-reset"].to_i - Time.now.to_i
|
53
|
-
if t.positive?
|
54
|
-
warn "Rate limit is reached. Retrying in #{t} sec."
|
55
|
-
sleep t
|
56
|
-
end
|
57
|
-
end
|
58
|
-
attempt += 1
|
59
|
-
resp = Faraday.get "https://api.github.com/search/code", params, headers
|
60
|
-
json = JSON.parse resp.body
|
61
|
-
end
|
62
|
-
raise StandardError, json["message"] if json["message"]
|
63
|
-
|
64
|
-
json["items"].each do |item|
|
65
|
-
fetch_doc URI.join(SOURCE, item["path"]).to_s
|
37
|
+
def fetch
|
38
|
+
Dir["iana-registries/**/*.xml"].each do |file|
|
39
|
+
content = File.read file, encoding: "UTF-8"
|
40
|
+
parse(content) if content.include? "<registry"
|
41
|
+
rescue StandardError => e
|
42
|
+
warn "Error: #{e.message}. File: #{file}"
|
66
43
|
end
|
67
|
-
fetch(page + 1) if (json["total_count"] - (page * 100)).positive?
|
68
44
|
end
|
69
45
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
resp = Net::HTTP.get_response URI(url)
|
77
|
-
if resp.code == "200"
|
78
|
-
return unless resp.body.include? "<registry"
|
79
|
-
|
80
|
-
xml = Nokogiri::XML(resp.body)
|
81
|
-
registry = xml.at("/xmlns:registry")
|
82
|
-
doc = Parser.parse registry
|
83
|
-
save_doc doc
|
84
|
-
registry.xpath("./xmlns:registry").each do |r|
|
85
|
-
save_doc Parser.parse(r, doc)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
rescue StandardError => e
|
89
|
-
warn "Error: #{e.message}. URL: #{url}"
|
46
|
+
def parse(content)
|
47
|
+
xml = Nokogiri::XML(content)
|
48
|
+
registry = xml.at("/xmlns:registry")
|
49
|
+
doc = Parser.parse registry
|
50
|
+
save_doc doc
|
51
|
+
registry.xpath("./xmlns:registry").each { |r| save_doc Parser.parse(r, doc) }
|
90
52
|
end
|
91
53
|
|
92
54
|
#
|
data/lib/relaton_iana/version.rb
CHANGED
data/lib/relaton_iana.rb
CHANGED
data/relaton_iana.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "RelatonIana: Ruby XMLDOC impementation."
|
13
13
|
spec.homepage = "https://github.com/relaton/relaton-iana"
|
14
14
|
spec.license = "BSD-2-Clause"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
18
18
|
|
@@ -30,17 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
32
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
33
|
-
|
34
|
-
spec.
|
35
|
-
spec.add_development_dependency "rubocop-rails"
|
36
|
-
spec.add_development_dependency "ruby-jing"
|
37
|
-
spec.add_development_dependency "simplecov"
|
38
|
-
spec.add_development_dependency "vcr"
|
39
|
-
spec.add_development_dependency "webmock"
|
40
|
-
|
41
|
-
spec.add_dependency "faraday", "~> 1.0"
|
33
|
+
|
34
|
+
spec.add_dependency "faraday", "~> 2.7.0"
|
42
35
|
spec.add_dependency "relaton-bib", "~> 1.14.0"
|
43
|
-
spec.add_dependency "ruby-jing"
|
44
36
|
|
45
37
|
# Uncomment to register a new dependency of your gem
|
46
38
|
# spec.add_dependency "example-gem", "~> 1.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -24,118 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rubocop
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop-performance
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ruby-jing
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: vcr
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: webmock
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
27
|
- !ruby/object:Gem::Dependency
|
126
28
|
name: faraday
|
127
29
|
requirement: !ruby/object:Gem::Requirement
|
128
30
|
requirements:
|
129
31
|
- - "~>"
|
130
32
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
33
|
+
version: 2.7.0
|
132
34
|
type: :runtime
|
133
35
|
prerelease: false
|
134
36
|
version_requirements: !ruby/object:Gem::Requirement
|
135
37
|
requirements:
|
136
38
|
- - "~>"
|
137
39
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
40
|
+
version: 2.7.0
|
139
41
|
- !ruby/object:Gem::Dependency
|
140
42
|
name: relaton-bib
|
141
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,20 +52,6 @@ dependencies:
|
|
150
52
|
- - "~>"
|
151
53
|
- !ruby/object:Gem::Version
|
152
54
|
version: 1.14.0
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: ruby-jing
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
55
|
description: 'RelatonIana: Ruby XMLDOC impementation.'
|
168
56
|
email:
|
169
57
|
- open.source@ribose.com
|
@@ -211,14 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
211
99
|
requirements:
|
212
100
|
- - ">="
|
213
101
|
- !ruby/object:Gem::Version
|
214
|
-
version: 2.
|
102
|
+
version: 2.7.0
|
215
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
216
104
|
requirements:
|
217
105
|
- - ">="
|
218
106
|
- !ruby/object:Gem::Version
|
219
107
|
version: '0'
|
220
108
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
109
|
+
rubygems_version: 3.3.26
|
222
110
|
signing_key:
|
223
111
|
specification_version: 4
|
224
112
|
summary: 'RelatonIana: Ruby XMLDOC impementation.'
|