relaton 1.9.4 → 1.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/docs/README.adoc +1 -0
- data/lib/relaton/db.rb +15 -7
- data/lib/relaton/registry.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/workers_pool.rb +3 -3
- data/relaton.gemspec +2 -1
- data/spec/relaton/db_spec.rb +10 -0
- data/spec/relaton/registry_spec.rb +4 -0
- data/spec/relaton_spec.rb +9 -2
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +121 -0
- data/spec/vcr_cassetes/async_fetch.yml +1230 -1230
- data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +11 -11
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +14 -14
- data/spec/vcr_cassetes/cen_en_10160_1999.yml +29 -29
- data/spec/vcr_cassetes/cie_001_1980.yml +7 -7
- data/spec/vcr_cassetes/ecma_6.yml +7 -7
- data/spec/vcr_cassetes/fisp_140.yml +6 -6
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +9 -9
- data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +35 -12
- data/spec/vcr_cassetes/iec_60050_102_2007.yml +28 -28
- data/spec/vcr_cassetes/iec_combined_included.yml +92 -90
- data/spec/vcr_cassetes/ieee_528_2019.yml +15 -15
- data/spec/vcr_cassetes/iho_b_11.yml +7 -7
- data/spec/vcr_cassetes/iso_111111119115_1.yml +115 -2
- data/spec/vcr_cassetes/iso_19115_1.yml +14 -14
- data/spec/vcr_cassetes/iso_19115_1_2.yml +32 -32
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +17 -17
- data/spec/vcr_cassetes/iso_19133_2005.yml +14 -14
- data/spec/vcr_cassetes/iso_cd_14093.yml +15 -15
- data/spec/vcr_cassetes/iso_combined_applied.yml +31 -31
- data/spec/vcr_cassetes/iso_combined_included.yml +30 -30
- data/spec/vcr_cassetes/itu_combined_included.yml +177 -177
- data/spec/vcr_cassetes/ogc_19_025r1.yml +7 -7
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +4 -4
- data/spec/vcr_cassetes/rfc_8341.yml +7 -7
- data/spec/vcr_cassetes/sp_800_38b.yml +6 -6
- data/spec/vcr_cassetes/threads_from_env.yml +448 -0
- data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +31 -31
- data/spec/vcr_cassetes/w3c_json_ld11.yml +10 -10
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b61ad383992583e255cf71895ebc1304432a0c3ffd1df095fd89938b3bf574c3
|
4
|
+
data.tar.gz: e9c36b287cb349c5d027833b8e9b022bde3c77a19b1c5accf73dc1ebcbb53dea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52eb6e058e7eb0a995c97eded558d4323bc320d2aa4a6021c5e7b477433e1319fa07d99f4cb93513d1b9e88422d9e59dbe8a35995a4a29ddef6ce1ca40cc54ef
|
7
|
+
data.tar.gz: a84f478f11b661459e4c6477de8d2ca4e84ebd5d43489238480de3b0ea48833292935f96eeaff6ac5d4a58cb7e51c9450b413ae78224a53f07d05a7fdeca411a
|
data/.rubocop.yml
CHANGED
data/docs/README.adoc
CHANGED
data/lib/relaton/db.rb
CHANGED
@@ -17,6 +17,7 @@ module Relaton
|
|
17
17
|
@static_db = open_cache_biblio File.expand_path("../relaton/static_cache",
|
18
18
|
__dir__)
|
19
19
|
@queues = {}
|
20
|
+
@semaphore = Mutex.new
|
20
21
|
end
|
21
22
|
|
22
23
|
# Move global or local caches to anothe dirs
|
@@ -104,7 +105,8 @@ module Relaton
|
|
104
105
|
if stdclass
|
105
106
|
unless @queues[stdclass]
|
106
107
|
processor = @registry.processors[stdclass]
|
107
|
-
|
108
|
+
threads = ENV["RELATON_FETCH_PARALLEL"]&.to_i || processor.threads
|
109
|
+
wp = WorkersPool.new(threads) do |args|
|
108
110
|
args[3].call fetch(*args[0..2])
|
109
111
|
rescue RelatonBib::RequestError => e
|
110
112
|
args[3].call e
|
@@ -375,14 +377,20 @@ module Relaton
|
|
375
377
|
return bib_retval(bibentry, stdclass)
|
376
378
|
end
|
377
379
|
|
378
|
-
|
380
|
+
@semaphore.synchronize do
|
381
|
+
db.delete(id) unless db.valid_entry?(id, year)
|
382
|
+
end
|
379
383
|
if altdb
|
380
384
|
return bib_retval(altdb[id], stdclass) if opts[:fetch_db]
|
381
385
|
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
+
@semaphore.synchronize do
|
387
|
+
db.clone_entry id, altdb if altdb.valid_entry? id, year
|
388
|
+
end
|
389
|
+
entry = new_bib_entry(searchcode, year, opts, stdclass, db: db, id: id) unless db[id]
|
390
|
+
@semaphore.synchronize do
|
391
|
+
db[id] ||= entry
|
392
|
+
altdb.clone_entry(id, db) if !altdb.valid_entry?(id, year)
|
393
|
+
end
|
386
394
|
else
|
387
395
|
return bib_retval(db[id], stdclass) if opts[:fetch_db]
|
388
396
|
|
@@ -413,7 +421,7 @@ module Relaton
|
|
413
421
|
if args[:db] && args[:id] &&
|
414
422
|
bib_id && args[:id] !~ %r{#{Regexp.quote("(#{bib_id})")}}
|
415
423
|
bid = std_id(bib.docidentifier.first.id, nil, {}, stdclass).first
|
416
|
-
args[:db][bid] ||= bib_entry bib
|
424
|
+
@semaphore.synchronize { args[:db][bid] ||= bib_entry bib }
|
417
425
|
"redirection #{bid}"
|
418
426
|
else bib_entry bib
|
419
427
|
end
|
data/lib/relaton/registry.rb
CHANGED
@@ -9,7 +9,7 @@ module Relaton
|
|
9
9
|
relaton_gb relaton_iec relaton_ietf relaton_iso relaton_itu relaton_nist
|
10
10
|
relaton_ogc relaton_calconnect relaton_omg relaton_un relaton_w3c
|
11
11
|
relaton_ieee relaton_iho relaton_bipm relaton_ecma relaton_cie relaton_bsi
|
12
|
-
relaton_cen relaton_iana
|
12
|
+
relaton_cen relaton_iana relaton_3gpp
|
13
13
|
].freeze
|
14
14
|
|
15
15
|
include Singleton
|
data/lib/relaton/version.rb
CHANGED
data/lib/relaton/workers_pool.rb
CHANGED
@@ -4,9 +4,9 @@ module Relaton
|
|
4
4
|
# Workers poll.
|
5
5
|
class WorkersPool
|
6
6
|
def initialize(workers = 2, &_block)
|
7
|
-
num_workers = workers < 2 ? 2 : workers
|
8
|
-
@queue = SizedQueue.new(
|
9
|
-
@threads = Array.new
|
7
|
+
# num_workers = workers < 2 ? 2 : workers
|
8
|
+
@queue = SizedQueue.new(workers * 2)
|
9
|
+
@threads = Array.new workers do
|
10
10
|
Thread.new do
|
11
11
|
while item = @queue.pop; yield(item) end
|
12
12
|
end
|
data/relaton.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
31
31
|
|
32
|
+
spec.add_dependency "relaton-3gpp", "~> 1.9.0"
|
32
33
|
spec.add_dependency "relaton-bipm", "~> 1.9.0"
|
33
34
|
spec.add_dependency "relaton-bsi", "~> 1.9.0"
|
34
35
|
spec.add_dependency "relaton-calconnect", "~> 1.9.0"
|
@@ -39,7 +40,7 @@ Gem::Specification.new do |spec|
|
|
39
40
|
spec.add_dependency "relaton-iana", "~> 1.9.0"
|
40
41
|
spec.add_dependency "relaton-iec", "~> 1.9.0"
|
41
42
|
spec.add_dependency "relaton-ieee", "~> 1.9.0"
|
42
|
-
spec.add_dependency "relaton-ietf", "
|
43
|
+
spec.add_dependency "relaton-ietf", ">= 1.9.7"
|
43
44
|
spec.add_dependency "relaton-iho", "~> 1.9.0"
|
44
45
|
spec.add_dependency "relaton-iso", "~> 1.9.0"
|
45
46
|
spec.add_dependency "relaton-itu", "~> 1.9.0"
|
data/spec/relaton/db_spec.rb
CHANGED
@@ -184,6 +184,16 @@ RSpec.describe Relaton::Db do
|
|
184
184
|
end
|
185
185
|
expect(result).to be_nil
|
186
186
|
end
|
187
|
+
|
188
|
+
it "use threads number from RELATON_FETCH_PARALLEL" do
|
189
|
+
expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
|
190
|
+
allow(ENV).to receive(:[]).and_call_original
|
191
|
+
expect(Relaton::WorkersPool).to receive(:new).with(1).and_call_original
|
192
|
+
VCR.use_cassette "threads_from_env" do
|
193
|
+
db.fetch_async("ITU-T G.993.5") { |r| queue << r }
|
194
|
+
Timeout.timeout(50) { queue.pop }
|
195
|
+
end
|
196
|
+
end
|
187
197
|
end
|
188
198
|
|
189
199
|
context "fetch documents form static cache" do
|
@@ -91,6 +91,10 @@ RSpec.describe Relaton::Registry do
|
|
91
91
|
it "IANA" do
|
92
92
|
expect(Relaton::Registry.instance.by_type("IANA")).to be_instance_of RelatonIana::Processor
|
93
93
|
end
|
94
|
+
|
95
|
+
it "3GPP" do
|
96
|
+
expect(Relaton::Registry.instance.by_type("3GPP")).to be_instance_of Relaton3gpp::Processor
|
97
|
+
end
|
94
98
|
end
|
95
99
|
|
96
100
|
it "find processot by dataset" do
|
data/spec/relaton_spec.rb
CHANGED
@@ -196,10 +196,10 @@ RSpec.describe Relaton::Db do
|
|
196
196
|
expect(File.exist?("testcache2")).to be true
|
197
197
|
testcache = Relaton::DbCache.new "testcache"
|
198
198
|
expect(testcache["IETF(RFC 8341)"]).to include "<docidentifier "\
|
199
|
-
"type=\"IETF\">
|
199
|
+
"type=\"IETF\" scope=\"anchor\">RFC8341</docidentifier>"
|
200
200
|
testcache = Relaton::DbCache.new "testcache2"
|
201
201
|
expect(testcache["IETF(RFC 8341)"]).to include "<docidentifier "\
|
202
|
-
"type=\"IETF\">
|
202
|
+
"type=\"IETF\" scope=\"anchor\">RFC8341</docidentifier>"
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -306,6 +306,13 @@ RSpec.describe Relaton::Db do
|
|
306
306
|
end
|
307
307
|
end
|
308
308
|
|
309
|
+
it "get 3GPP reference" do
|
310
|
+
VCR.use_cassette "3gpp_tr_00_01u_umts_3_0_0" do
|
311
|
+
bib = @db.fetch "3GPP TR 00.01U:UMTS/3.0.0"
|
312
|
+
expect(bib).to be_instance_of Relaton3gpp::BibliographicItem
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
309
316
|
context "get combined documents" do
|
310
317
|
context "ISO" do
|
311
318
|
it "included" do
|
@@ -0,0 +1,121 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://raw.githubusercontent.com/relaton/relaton-data-3gpp/main/data/TR_00.01U_UMTS_3.0.0.yaml
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- raw.githubusercontent.com
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Connection:
|
24
|
+
- keep-alive
|
25
|
+
Content-Length:
|
26
|
+
- '549'
|
27
|
+
Cache-Control:
|
28
|
+
- max-age=300
|
29
|
+
Content-Security-Policy:
|
30
|
+
- default-src 'none'; style-src 'unsafe-inline'; sandbox
|
31
|
+
Content-Type:
|
32
|
+
- text/plain; charset=utf-8
|
33
|
+
Etag:
|
34
|
+
- W/"c70f6628f95ac3979a5237c54995637171f2f370a6090b835ecd229ef159fb99"
|
35
|
+
Strict-Transport-Security:
|
36
|
+
- max-age=31536000
|
37
|
+
X-Content-Type-Options:
|
38
|
+
- nosniff
|
39
|
+
X-Frame-Options:
|
40
|
+
- deny
|
41
|
+
X-Xss-Protection:
|
42
|
+
- 1; mode=block
|
43
|
+
X-Github-Request-Id:
|
44
|
+
- 5F84:9E53:173E127:186CA31:61CAF6F2
|
45
|
+
Accept-Ranges:
|
46
|
+
- bytes
|
47
|
+
Date:
|
48
|
+
- Tue, 28 Dec 2021 11:37:22 GMT
|
49
|
+
Via:
|
50
|
+
- 1.1 varnish
|
51
|
+
X-Served-By:
|
52
|
+
- cache-sof1510075-SOF
|
53
|
+
X-Cache:
|
54
|
+
- MISS
|
55
|
+
X-Cache-Hits:
|
56
|
+
- '0'
|
57
|
+
X-Timer:
|
58
|
+
- S1640691442.275517,VS0,VE245
|
59
|
+
Vary:
|
60
|
+
- Authorization,Accept-Encoding,Origin
|
61
|
+
Access-Control-Allow-Origin:
|
62
|
+
- "*"
|
63
|
+
X-Fastly-Request-Id:
|
64
|
+
- f1d9e96d0649f362bbac0579ea916a9009733903
|
65
|
+
Expires:
|
66
|
+
- Tue, 28 Dec 2021 11:42:22 GMT
|
67
|
+
Source-Age:
|
68
|
+
- '0'
|
69
|
+
body:
|
70
|
+
encoding: ASCII-8BIT
|
71
|
+
string: |
|
72
|
+
---
|
73
|
+
id: 3GPPTR00.01U-UMTS/3.0.0
|
74
|
+
title:
|
75
|
+
type: main
|
76
|
+
content: Work programme for the standardization of Universal Mobile Telecommunications
|
77
|
+
System (UMTS)
|
78
|
+
format: text/plain
|
79
|
+
link:
|
80
|
+
content: http://www.3gpp.org/ftp/Specs/archive/00_series/00.01U/0001U-300.zip
|
81
|
+
type: src
|
82
|
+
type: standard
|
83
|
+
docid:
|
84
|
+
id: 3GPP TR 00.01U:UMTS/3.0.0
|
85
|
+
type: 3GPP
|
86
|
+
docnumber: TR 00.01U:UMTS/3.0.0
|
87
|
+
contributor:
|
88
|
+
person:
|
89
|
+
name:
|
90
|
+
completename:
|
91
|
+
content: RAPELI, Juha
|
92
|
+
language: en
|
93
|
+
script: Latn
|
94
|
+
affiliation:
|
95
|
+
organization:
|
96
|
+
name: PHILIPS CONSUMER COMMUNICATION
|
97
|
+
role: author
|
98
|
+
language: en
|
99
|
+
script: Latn
|
100
|
+
docstatus:
|
101
|
+
stage:
|
102
|
+
value: withdrawn
|
103
|
+
fetched: '2021-12-24'
|
104
|
+
doctype: TR
|
105
|
+
editorialgroup:
|
106
|
+
name: SMG5
|
107
|
+
type: prime
|
108
|
+
radiotechnology: 3G
|
109
|
+
release:
|
110
|
+
version2g: '3'
|
111
|
+
version3g: '3'
|
112
|
+
defunct: true
|
113
|
+
freeze_meeting: SMG-28
|
114
|
+
freeze_stage1_meeting: SMG-28
|
115
|
+
freeze_stage2_meeting: SMG-28
|
116
|
+
freeze_stage3_meeting: SMG-28
|
117
|
+
close_meeting: SP-28
|
118
|
+
project_end: '1999-02-12'
|
119
|
+
http_version:
|
120
|
+
recorded_at: Tue, 28 Dec 2021 11:37:22 GMT
|
121
|
+
recorded_with: VCR 5.1.0
|