relaton 1.11.2 → 1.11.3
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 +4 -4
- data/.github/workflows/rake.yml +1 -5
- data/.rubocop.yml +1 -1
- data/lib/relaton/db.rb +7 -19
- data/lib/relaton/registry.rb +28 -0
- data/lib/relaton/version.rb +1 -1
- data/relaton.gemspec +1 -1
- data/spec/relaton/registry_spec.rb +1 -0
- data/spec/relaton_spec.rb +2 -2
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +8 -9
- data/spec/vcr_cassetes/async_fetch.yml +1351 -1438
- data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +11 -13
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +9 -11
- data/spec/vcr_cassetes/cie_001_1980.yml +8 -9
- data/spec/vcr_cassetes/ecma_6.yml +8 -9
- data/spec/vcr_cassetes/en_10160_1999.yml +29 -33
- data/spec/vcr_cassetes/fisp_140.yml +7 -8
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +7 -9
- data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +11 -12
- data/spec/vcr_cassetes/iec_60050_102_2007.yml +29 -34
- data/spec/vcr_cassetes/iec_combined_included.yml +99 -116
- data/spec/vcr_cassetes/ieee_528_2019.yml +620 -618
- data/spec/vcr_cassetes/iho_b_11.yml +8 -9
- data/spec/vcr_cassetes/iso_111111119115_1.yml +3 -4
- data/spec/vcr_cassetes/iso_19115_1.yml +16 -20
- data/spec/vcr_cassetes/iso_19115_1_2.yml +32 -40
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +17 -21
- data/spec/vcr_cassetes/iso_19133_2005.yml +16 -20
- data/spec/vcr_cassetes/iso_combined_applied.yml +29 -37
- data/spec/vcr_cassetes/iso_combined_included.yml +29 -37
- data/spec/vcr_cassetes/iso_dis_14093.yml +14 -18
- data/spec/vcr_cassetes/itu_combined_included.yml +189 -315
- data/spec/vcr_cassetes/oasis_amqp_core_types_v1_0_pt1.yml +10 -11
- data/spec/vcr_cassetes/ogc_19_025r1.yml +11 -12
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +3 -4
- data/spec/vcr_cassetes/rfc_8341.yml +8 -9
- data/spec/vcr_cassetes/sp_800_38b.yml +7 -8
- data/spec/vcr_cassetes/threads_from_env.yml +61 -69
- data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +30 -35
- data/spec/vcr_cassetes/w3c_json_ld11.yml +21 -23
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e53eb8b2768e1b80e472312aa1af438457ce7115fe078256318749666261f33
|
4
|
+
data.tar.gz: 670a8f3815488a7b315c1e0b56f6376c16fd317cec1fb444d7c6d0dac9c92107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64186cb269dbd470798c3ccbe2996ea736c909c7258bc385528626e043bee1c7d88a1a6409948392ef73203ea4715a93b8474bfd3437503a08a1e312d430a968
|
7
|
+
data.tar.gz: 434cbc56312aa11577c2227788eeb930ea2e85e9f5c98f37b5738e58d030bfbcf0cbffcdeb623dda7ef31ca7628bc80f7a88a63050814e3b87a0c1883abcb287
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,7 +16,7 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '3.0', '2.7', '2.6'
|
19
|
+
ruby: [ '3.0', '2.7', '2.6' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
22
|
steps:
|
@@ -24,10 +24,6 @@ jobs:
|
|
24
24
|
with:
|
25
25
|
submodules: true
|
26
26
|
|
27
|
-
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
28
|
-
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
29
|
-
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
30
|
-
|
31
27
|
- uses: ruby/setup-ruby@v1
|
32
28
|
with:
|
33
29
|
ruby-version: ${{ matrix.ruby }}
|
data/.rubocop.yml
CHANGED
data/lib/relaton/db.rb
CHANGED
@@ -63,7 +63,7 @@ module Relaton
|
|
63
63
|
# RelatonOmg::OmgBibliographicItem, RelatonW3c::W3cBibliographicItem]
|
64
64
|
##
|
65
65
|
def fetch(code, year = nil, opts = {})
|
66
|
-
stdclass =
|
66
|
+
stdclass = @registry.class_by_ref(code) || return
|
67
67
|
processor = @registry.processors[stdclass]
|
68
68
|
ref = if processor.respond_to?(:urn_to_code)
|
69
69
|
processor.urn_to_code(code)&.first
|
@@ -101,7 +101,7 @@ module Relaton
|
|
101
101
|
|
102
102
|
# Fetch asynchronously
|
103
103
|
def fetch_async(code, year = nil, opts = {}, &block) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
104
|
-
stdclass =
|
104
|
+
stdclass = @registry.class_by_ref code
|
105
105
|
if stdclass
|
106
106
|
unless @queues[stdclass]
|
107
107
|
processor = @registry.processors[stdclass]
|
@@ -142,7 +142,7 @@ module Relaton
|
|
142
142
|
@registry.processors.each do |name, processor|
|
143
143
|
std = name if processor.prefix == stdclass
|
144
144
|
end
|
145
|
-
std =
|
145
|
+
std = @registry.class_by_ref(code) or return nil unless std
|
146
146
|
|
147
147
|
check_bibliocache(code, year, opts, std)
|
148
148
|
end
|
@@ -151,8 +151,8 @@ module Relaton
|
|
151
151
|
# @param code [String]
|
152
152
|
# @return [Array]
|
153
153
|
def docid_type(code)
|
154
|
-
stdclass =
|
155
|
-
|
154
|
+
stdclass = @registry.class_by_ref(code) or return [nil, code]
|
155
|
+
_, code = strip_id_wrapper(code, stdclass)
|
156
156
|
[@registry.processors[stdclass].idtype, code]
|
157
157
|
end
|
158
158
|
|
@@ -218,7 +218,7 @@ module Relaton
|
|
218
218
|
# @param year [Integer, nil] year to filter
|
219
219
|
# @return [BibliographicItem, nil]
|
220
220
|
def search_edition_year(file, content, edition, year) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
221
|
-
processor = @registry.
|
221
|
+
processor = @registry.processor_by_ref(file.split("/")[-2])
|
222
222
|
item = if file.match?(/xml$/) then processor.from_xml(content)
|
223
223
|
else processor.hash_to_bib(YAML.safe_load(content))
|
224
224
|
end
|
@@ -269,7 +269,7 @@ module Relaton
|
|
269
269
|
type: "updates")
|
270
270
|
end
|
271
271
|
divider = stdclass == :relaton_itu ? " " : "/"
|
272
|
-
refs[1
|
272
|
+
refs[1..].each_with_object(doc) do |c, d|
|
273
273
|
bib = check_bibliocache(ref + divider + c, year, opts, stdclass)
|
274
274
|
if bib
|
275
275
|
d.relation << RelatonBib::DocumentRelation.new(
|
@@ -279,18 +279,6 @@ module Relaton
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
-
# @param code [String] code of standard
|
283
|
-
# @return [Symbol] standard class name
|
284
|
-
def standard_class(code)
|
285
|
-
@registry.processors.each do |name, processor|
|
286
|
-
return name if /^(urn:)?#{processor.prefix}/i.match?(code) ||
|
287
|
-
processor.defaultprefix.match(code)
|
288
|
-
end
|
289
|
-
Util.log <<~WARN, :info
|
290
|
-
[relaton] #{code} does not have a recognised prefix
|
291
|
-
WARN
|
292
|
-
end
|
293
|
-
|
294
282
|
# TODO: i18n
|
295
283
|
# Fofmat ID
|
296
284
|
# @param code [String]
|
data/lib/relaton/registry.rb
CHANGED
@@ -77,6 +77,34 @@ module Relaton
|
|
77
77
|
processors.values.detect { |v| v.prefix == type&.upcase }
|
78
78
|
end
|
79
79
|
|
80
|
+
#
|
81
|
+
# Find processor by reference or prefix
|
82
|
+
#
|
83
|
+
# @param [String] ref reference or prefix
|
84
|
+
#
|
85
|
+
# @return [Relaton::Processor] processor
|
86
|
+
#
|
87
|
+
def processor_by_ref(ref)
|
88
|
+
@processors[class_by_ref(ref)]
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# Find processor by refernce or prefix
|
93
|
+
#
|
94
|
+
# @param ref [String] reference or prefix
|
95
|
+
#
|
96
|
+
# @return [Symbol, nil] standard class name
|
97
|
+
#
|
98
|
+
def class_by_ref(ref)
|
99
|
+
@processors.each do |class_name, processor|
|
100
|
+
return class_name if /^(urn:)?#{processor.prefix}(?!\w)/i.match?(ref) ||
|
101
|
+
processor.defaultprefix.match(ref)
|
102
|
+
end
|
103
|
+
Util.log <<~WARN, :info
|
104
|
+
[relaton] #{ref} does not have a recognised prefix
|
105
|
+
WARN
|
106
|
+
end
|
107
|
+
|
80
108
|
private
|
81
109
|
|
82
110
|
def camel_case(gem_name)
|
data/lib/relaton/version.rb
CHANGED
data/relaton.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
spec.files = `git ls-files`.split("\n")
|
29
29
|
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
|
30
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
30
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
31
31
|
|
32
32
|
spec.add_dependency "relaton-3gpp", "~> 1.11.0"
|
33
33
|
spec.add_dependency "relaton-bipm", "~> 1.11.0"
|
@@ -70,6 +70,7 @@ RSpec.describe Relaton::Registry do
|
|
70
70
|
|
71
71
|
it "BIPM" do
|
72
72
|
expect(Relaton::Registry.instance.by_type("BIPM")).to be_instance_of RelatonBipm::Processor
|
73
|
+
expect(Relaton::Registry.instance.processor_by_ref("CCTF")).to be_instance_of RelatonBipm::Processor
|
73
74
|
end
|
74
75
|
|
75
76
|
it "ECMA" 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=\"RFC\"
|
199
|
+
"type=\"RFC\" primary=\"true\">RFC 8341</docidentifier>"
|
200
200
|
testcache = Relaton::DbCache.new "testcache2"
|
201
201
|
expect(testcache["IETF(RFC 8341)"]).to include "<docidentifier "\
|
202
|
-
"type=\"RFC\"
|
202
|
+
"type=\"RFC\" primary=\"true\">RFC 8341</docidentifier>"
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
@@ -41,29 +41,29 @@ http_interactions:
|
|
41
41
|
X-Xss-Protection:
|
42
42
|
- 1; mode=block
|
43
43
|
X-Github-Request-Id:
|
44
|
-
-
|
44
|
+
- FEF4:1395A:3E1BC8:42A2CE:6290BA99
|
45
45
|
Accept-Ranges:
|
46
46
|
- bytes
|
47
47
|
Date:
|
48
|
-
-
|
48
|
+
- Fri, 27 May 2022 11:48:42 GMT
|
49
49
|
Via:
|
50
50
|
- 1.1 varnish
|
51
51
|
X-Served-By:
|
52
|
-
- cache-
|
52
|
+
- cache-vie6371-VIE
|
53
53
|
X-Cache:
|
54
54
|
- MISS
|
55
55
|
X-Cache-Hits:
|
56
56
|
- '0'
|
57
57
|
X-Timer:
|
58
|
-
-
|
58
|
+
- S1653652122.797835,VS0,VE233
|
59
59
|
Vary:
|
60
60
|
- Authorization,Accept-Encoding,Origin
|
61
61
|
Access-Control-Allow-Origin:
|
62
62
|
- "*"
|
63
63
|
X-Fastly-Request-Id:
|
64
|
-
-
|
64
|
+
- 740cb118933ba3ba55fcbdb02f6f313a4eb80f39
|
65
65
|
Expires:
|
66
|
-
-
|
66
|
+
- Fri, 27 May 2022 11:53:42 GMT
|
67
67
|
Source-Age:
|
68
68
|
- '0'
|
69
69
|
body:
|
@@ -143,6 +143,5 @@ http_interactions:
|
|
143
143
|
freeze_stage3_meeting: SMG-28
|
144
144
|
close_meeting: SP-28
|
145
145
|
project_end: '1999-02-12'
|
146
|
-
|
147
|
-
|
148
|
-
recorded_with: VCR 5.1.0
|
146
|
+
recorded_at: Fri, 27 May 2022 11:48:41 GMT
|
147
|
+
recorded_with: VCR 6.1.0
|