relaton 1.11.3 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/docs/README.adoc +0 -13
  3. data/lib/relaton/db.rb +24 -37
  4. data/lib/relaton/db_cache.rb +6 -6
  5. data/lib/relaton/version.rb +1 -1
  6. data/relaton.gemspec +22 -22
  7. data/spec/relaton/db_spec.rb +40 -57
  8. data/spec/relaton_spec.rb +8 -11
  9. data/spec/spec_helper.rb +1 -0
  10. data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +9 -9
  11. data/spec/vcr_cassetes/async_fetch.yml +1205 -1205
  12. data/spec/vcr_cassetes/bipm_i18n_async_fetch.yml +412 -0
  13. data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +12 -12
  14. data/spec/vcr_cassetes/cc_dir_10005_2019.yml +12 -12
  15. data/spec/vcr_cassetes/cie_001_1980.yml +7 -7
  16. data/spec/vcr_cassetes/ecma_6.yml +10 -9
  17. data/spec/vcr_cassetes/en_10160_1999.yml +29 -29
  18. data/spec/vcr_cassetes/fisp_140.yml +6 -6
  19. data/spec/vcr_cassetes/gb_t_20223_2006.yml +6 -6
  20. data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +9 -9
  21. data/spec/vcr_cassetes/iec_60050_102_2007.yml +43 -33
  22. data/spec/vcr_cassetes/iec_combined_included.yml +116 -104
  23. data/spec/vcr_cassetes/ieee_528_2019.yml +983 -973
  24. data/spec/vcr_cassetes/iho_b_11.yml +7 -7
  25. data/spec/vcr_cassetes/iso_111111119115_1.yml +3 -3
  26. data/spec/vcr_cassetes/iso_19115_1.yml +16 -16
  27. data/spec/vcr_cassetes/iso_19115_1_2.yml +32 -32
  28. data/spec/vcr_cassetes/iso_19115_all_parts.yml +17 -17
  29. data/spec/vcr_cassetes/iso_19133_2005.yml +19 -19
  30. data/spec/vcr_cassetes/iso_combined_applied.yml +31 -31
  31. data/spec/vcr_cassetes/iso_combined_included.yml +33 -33
  32. data/spec/vcr_cassetes/iso_dis_14093.yml +17 -17
  33. data/spec/vcr_cassetes/itu_combined_included.yml +182 -182
  34. data/spec/vcr_cassetes/oasis_amqp_core_types_v1_0_pt1.yml +9 -9
  35. data/spec/vcr_cassetes/ogc_19_025r1.yml +11 -11
  36. data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +4 -4
  37. data/spec/vcr_cassetes/rfc_8341.yml +112 -24
  38. data/spec/vcr_cassetes/sp_800_38b.yml +6 -6
  39. data/spec/vcr_cassetes/threads_from_env.yml +56 -56
  40. data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +29 -29
  41. data/spec/vcr_cassetes/w3c_json_ld11.yml +44 -23
  42. metadata +45 -53
  43. data/globalcache/iec/iec_60050_102_2007.xml +0 -58
  44. data/globalcache/iec/version +0 -1
  45. data/lib/relaton/static_cache/iso/iso_iec_dir_1.yml +0 -33
  46. data/lib/relaton/static_cache/iso/iso_iec_dir_1_iec_sup.yml +0 -32
  47. data/lib/relaton/static_cache/iso/iso_iec_dir_1_iso_sup.yml +0 -39
  48. data/lib/relaton/static_cache/iso/iso_iec_dir_2_iec.yml +0 -32
  49. data/lib/relaton/static_cache/iso/iso_iec_dir_2_iso.yml +0 -39
  50. data/lib/relaton/static_cache/iso/iso_iec_dir_iec_sup.yml +0 -32
  51. data/lib/relaton/static_cache/iso/iso_iec_dir_jtc_1_sup.yml +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e53eb8b2768e1b80e472312aa1af438457ce7115fe078256318749666261f33
4
- data.tar.gz: 670a8f3815488a7b315c1e0b56f6376c16fd317cec1fb444d7c6d0dac9c92107
3
+ metadata.gz: eb0eb1b1516d3d9891e873ecad6e439da21cb0cf0ef1b13d9f0a53568b04ad6d
4
+ data.tar.gz: af692237538c88b588db7537366d0fbc476e92e60f48163f892f0cb254c1fa2d
5
5
  SHA512:
6
- metadata.gz: 64186cb269dbd470798c3ccbe2996ea736c909c7258bc385528626e043bee1c7d88a1a6409948392ef73203ea4715a93b8474bfd3437503a08a1e312d430a968
7
- data.tar.gz: 434cbc56312aa11577c2227788eeb930ea2e85e9f5c98f37b5738e58d030bfbcf0cbffcdeb623dda7ef31ca7628bc80f7a88a63050814e3b87a0c1883abcb287
6
+ metadata.gz: 771e6695638f73ee4c6bb4c00d376889ecd5b7120cd9f31e055ab06f3060b24b55e3276f90d74909806b5977f54593cabc201a17729922e2589e5ac1c0fe6ea4
7
+ data.tar.gz: 2e9611d5f1b99206a2c99f42720638321781563109e9b0e01345c9576dd6bbd9836c185b55233ea6d7c7ddeaf7c86d90a00605a52ba12d6f9527b7c9a6df5cc0
data/docs/README.adoc CHANGED
@@ -331,19 +331,6 @@ items[0].docidentifier[0].id
331
331
  => "ISO 19011 (all parts)"
332
332
  ----
333
333
 
334
- === Static DB
335
-
336
- This gem has a static DB which is distributed with it. Now the static contains documents:
337
- ----
338
- ISO/IEC DIR 1 IEC SUP
339
- ISO/IEC DIR 1 ISO SUP
340
- ISO/IEC DIR 1
341
- ISO/IEC DIR 2 IEC
342
- ISO/IEC DIR 2 ISO
343
- ISO/IEC DIR IEC SUP
344
- ISO/IEC DIR 1 JTC SUP
345
- ----
346
-
347
334
  === Get document type
348
335
  [source,ruby]
349
336
  ----
data/lib/relaton/db.rb CHANGED
@@ -11,11 +11,9 @@ module Relaton
11
11
  def initialize(global_cache, local_cache)
12
12
  @registry = Relaton::Registry.instance
13
13
  gpath = global_cache && File.expand_path(global_cache)
14
- @db = open_cache_biblio(gpath, type: :global)
14
+ @db = open_cache_biblio(gpath)
15
15
  lpath = local_cache && File.expand_path(local_cache)
16
- @local_db = open_cache_biblio(lpath, type: :local)
17
- @static_db = open_cache_biblio File.expand_path("../relaton/static_cache",
18
- __dir__)
16
+ @local_db = open_cache_biblio(lpath)
19
17
  @queues = {}
20
18
  @semaphore = Mutex.new
21
19
  end
@@ -87,9 +85,7 @@ module Relaton
87
85
  # @param year [Integer, nil]
88
86
  # @return [Array]
89
87
  def fetch_all(text = nil, edition: nil, year: nil)
90
- result = @static_db.all do |file, yml|
91
- search_yml file, yml, text, edition, year
92
- end.compact
88
+ result = []
93
89
  db = @db || @local_db
94
90
  if db
95
91
  result += db.all do |file, xml|
@@ -99,9 +95,18 @@ module Relaton
99
95
  result
100
96
  end
101
97
 
98
+ #
102
99
  # Fetch asynchronously
103
- def fetch_async(code, year = nil, opts = {}, &block) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
104
- stdclass = @registry.class_by_ref code
100
+ #
101
+ # @param [String] ref reference
102
+ # @param [String] year document yer
103
+ # @param [Hash] opts options
104
+ #
105
+ # @return [RelatonBib::BibliographicItem, RelatonBib::RequestError, nil] bibitem if document is found,
106
+ # request error if server doesn't answer, nil if document not found
107
+ #
108
+ def fetch_async(ref, year = nil, opts = {}, &block) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
109
+ stdclass = @registry.class_by_ref ref
105
110
  if stdclass
106
111
  unless @queues[stdclass]
107
112
  processor = @registry.processors[stdclass]
@@ -110,11 +115,14 @@ module Relaton
110
115
  args[3].call fetch(*args[0..2])
111
116
  rescue RelatonBib::RequestError => e
112
117
  args[3].call e
118
+ rescue StandardError => e
119
+ Util.log "[relaton] ERROR: #{args[0]} -- #{e.message}", :error
120
+ args[3].call nil
113
121
  end
114
122
  @queues[stdclass] = { queue: Queue.new, workers_pool: wp }
115
123
  Thread.new { process_queue @queues[stdclass] }
116
124
  end
117
- @queues[stdclass][:queue] << [code, year, opts, block]
125
+ @queues[stdclass][:queue] << [ref, year, opts, block]
118
126
  else yield nil
119
127
  end
120
128
  end
@@ -187,19 +195,6 @@ module Relaton
187
195
 
188
196
  private
189
197
 
190
- # @param file [String] file path
191
- # @param yml [String] content in YAML format
192
- # @param text [String, nil] text to serach
193
- # @param edition [String, nil] edition to filter
194
- # @param year [Integer, nil] year to filter
195
- # @return [BibliographicItem, nil]
196
- def search_yml(file, yml, text, edition, year)
197
- item = search_edition_year(file, yml, edition, year)
198
- return unless item
199
-
200
- item if match_xml_text(item.to_xml(bibdata: true), text)
201
- end
202
-
203
198
  # @param file [String] file path
204
199
  # @param xml [String] content in XML format
205
200
  # @param text [String, nil] text to serach
@@ -222,7 +217,7 @@ module Relaton
222
217
  item = if file.match?(/xml$/) then processor.from_xml(content)
223
218
  else processor.hash_to_bib(YAML.safe_load(content))
224
219
  end
225
- item if (edition.nil? || item.edition == edition) && (year.nil? ||
220
+ item if (edition.nil? || item.edition.content == edition) && (year.nil? ||
226
221
  item.date.detect { |d| d.type == "published" && d.on(:year).to_s == year.to_s })
227
222
  end
228
223
 
@@ -346,11 +341,6 @@ module Relaton
346
341
  # RelatonOmg::OmgBibliographicItem, RelatonW3c::W3cBibliographicItem]
347
342
  def check_bibliocache(code, year, opts, stdclass) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
348
343
  id, searchcode = std_id(code, year, opts, stdclass)
349
- yaml = @static_db[id]
350
- if yaml
351
- return @registry.processors[stdclass].hash_to_bib YAML.safe_load(yaml)
352
- end
353
-
354
344
  db = @local_db || @db
355
345
  altdb = @local_db && @db ? @db : nil
356
346
  if db.nil?
@@ -378,8 +368,8 @@ module Relaton
378
368
  else
379
369
  return bib_retval(db[id], stdclass) if opts[:fetch_db]
380
370
 
381
- db[id] ||= new_bib_entry(searchcode, year, opts, stdclass, db: db,
382
- id: id)
371
+ entry = new_bib_entry(searchcode, year, opts, stdclass, db: db, id: id) unless db[id]
372
+ @semaphore.synchronize { db[id] ||= entry }
383
373
  end
384
374
  bib_retval(db[id], stdclass)
385
375
  end
@@ -438,13 +428,11 @@ module Relaton
438
428
  end
439
429
 
440
430
  # @param dir [String, nil] DB directory
441
- # @param type [Symbol]
442
431
  # @return [Relaton::DbCache, NilClass]
443
- def open_cache_biblio(dir, type: :static) # rubocop:disable Metrics/MethodLength
432
+ def open_cache_biblio(dir) # rubocop:disable Metrics/MethodLength
444
433
  return nil if dir.nil?
445
434
 
446
- db = DbCache.new dir, type == :static ? "yml" : "xml"
447
- return db if type == :static
435
+ db = DbCache.new dir
448
436
 
449
437
  Dir["#{dir}/*/"].each do |fdir|
450
438
  next if db.check_version?(fdir)
@@ -452,8 +440,7 @@ module Relaton
452
440
  FileUtils.rm_rf(fdir, secure: true)
453
441
  Util.log(
454
442
  "[relaton] WARNING: cache #{fdir}: version is obsolete and cache is "\
455
- "cleared.",
456
- :warning
443
+ "cleared.", :warning
457
444
  )
458
445
  end
459
446
  db
@@ -32,7 +32,7 @@ module Relaton
32
32
 
33
33
  # Clear database
34
34
  def clear
35
- FileUtils.rm_rf Dir.glob "#{dir}/*" if @ext == "xml" # unless it's static DB
35
+ FileUtils.rm_rf Dir.glob "#{dir}/*"
36
36
  end
37
37
 
38
38
  # Save item
@@ -86,7 +86,7 @@ module Relaton
86
86
  value = self[key]
87
87
  return unless value
88
88
 
89
- if value.match? /^not_found/
89
+ if value.match?(/^not_found/)
90
90
  value.match(/\d{4}-\d{2}-\d{2}/).to_s
91
91
  else
92
92
  doc = Nokogiri::XML value
@@ -115,7 +115,7 @@ module Relaton
115
115
  # @param fdir [String] dir pathe to flover cache
116
116
  # @return [TrueClass, FalseClass]
117
117
  def check_version?(fdir)
118
- version_dir = fdir + "/version"
118
+ version_dir = "#{fdir}/version"
119
119
  return false unless File.exist? version_dir
120
120
 
121
121
  v = File.read version_dir, encoding: "utf-8"
@@ -179,9 +179,9 @@ module Relaton
179
179
  # @param key [String]
180
180
  # @return [String]
181
181
  def filename(key)
182
- prefcode = key.downcase.match /^(?<prefix>[^\(]+)\((?<code>[^\)]+)/
182
+ prefcode = key.downcase.match(/^(?<prefix>[^(]+)\((?<code>[^)]+)/)
183
183
  fn = if prefcode
184
- "#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/\()]/, '_').squeeze('_')}"
184
+ "#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/()]/, '_').squeeze('_')}"
185
185
  else
186
186
  key.gsub(/[-:\s]/, "_")
187
187
  end
@@ -208,7 +208,7 @@ module Relaton
208
208
  # @param key [String]
209
209
  # @return [String]
210
210
  def prefix(key)
211
- key.downcase.match(/^[^\(]+(?=\()/).to_s
211
+ key.downcase.match(/^[^(]+(?=\()/).to_s
212
212
  end
213
213
 
214
214
  # @param file [String]
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.11.3".freeze
2
+ VERSION = "1.12.0".freeze
3
3
  end
data/relaton.gemspec CHANGED
@@ -26,30 +26,30 @@ Gem::Specification.new do |spec|
26
26
  spec.bindir = "bin"
27
27
  spec.require_paths = ["lib"]
28
28
  spec.files = `git ls-files`.split("\n")
29
- spec.test_files = `git ls-files -- {spec}/*`.split("\n")
29
+ # spec.test_files = `git ls-files -- {spec}/*`.split("\n")
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
31
31
 
32
- spec.add_dependency "relaton-3gpp", "~> 1.11.0"
33
- spec.add_dependency "relaton-bipm", "~> 1.11.0"
34
- spec.add_dependency "relaton-bsi", "~> 1.11.0"
35
- spec.add_dependency "relaton-calconnect", "~> 1.11.0"
36
- spec.add_dependency "relaton-cen", "~> 1.11.0"
37
- spec.add_dependency "relaton-cie", "~> 1.11.0"
38
- spec.add_dependency "relaton-ecma", "~> 1.11.0"
39
- spec.add_dependency "relaton-gb", "~> 1.11.0"
40
- spec.add_dependency "relaton-iana", "~> 1.11.0"
41
- spec.add_dependency "relaton-iec", "~> 1.11.0"
42
- spec.add_dependency "relaton-ieee", "~> 1.11.0"
43
- spec.add_dependency "relaton-ietf", "~> 1.11.0"
44
- spec.add_dependency "relaton-iho", "~> 1.11.0"
45
- spec.add_dependency "relaton-iso", "~> 1.11.0"
46
- spec.add_dependency "relaton-itu", "~> 1.11.0"
47
- spec.add_dependency "relaton-nist", "~> 1.11.0"
48
- spec.add_dependency "relaton-oasis", "~> 1.11.0"
49
- spec.add_dependency "relaton-ogc", "~> 1.11.0"
50
- spec.add_dependency "relaton-omg", "~> 1.11.0"
51
- spec.add_dependency "relaton-un", "~> 1.11.0"
52
- spec.add_dependency "relaton-w3c", "~> 1.11.0"
32
+ spec.add_dependency "relaton-3gpp", "~> 1.12.0"
33
+ spec.add_dependency "relaton-bipm", "~> 1.12.0"
34
+ spec.add_dependency "relaton-bsi", "~> 1.12.0"
35
+ spec.add_dependency "relaton-calconnect", "~> 1.12.0"
36
+ spec.add_dependency "relaton-cen", "~> 1.12.0"
37
+ spec.add_dependency "relaton-cie", "~> 1.12.0"
38
+ spec.add_dependency "relaton-ecma", "~> 1.12.0"
39
+ spec.add_dependency "relaton-gb", "~> 1.12.0"
40
+ spec.add_dependency "relaton-iana", "~> 1.12.0"
41
+ spec.add_dependency "relaton-iec", "~> 1.12.0"
42
+ spec.add_dependency "relaton-ieee", "~> 1.12.0"
43
+ spec.add_dependency "relaton-ietf", "~> 1.12.0"
44
+ spec.add_dependency "relaton-iho", "~> 1.12.0"
45
+ spec.add_dependency "relaton-iso", "~> 1.12.0"
46
+ spec.add_dependency "relaton-itu", "~> 1.12.0"
47
+ spec.add_dependency "relaton-nist", "~> 1.12.0"
48
+ spec.add_dependency "relaton-oasis", "~> 1.12.0"
49
+ spec.add_dependency "relaton-ogc", "~> 1.12.0"
50
+ spec.add_dependency "relaton-omg", "~> 1.12.0"
51
+ spec.add_dependency "relaton-un", "~> 1.12.0"
52
+ spec.add_dependency "relaton-w3c", "~> 1.12.0"
53
53
 
54
54
  spec.add_development_dependency "byebug", "~> 11.0"
55
55
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
@@ -75,9 +75,9 @@ RSpec.describe Relaton::Db do
75
75
 
76
76
  it "all documents" do
77
77
  items = db.fetch_all
78
- expect(items.size).to be 9
79
- expect(items[7]).to be_instance_of RelatonIec::IecBibliographicItem
80
- expect(items[8]).to be_instance_of RelatonIsoBib::IsoBibliographicItem
78
+ expect(items.size).to be 2
79
+ expect(items[0]).to be_instance_of RelatonIec::IecBibliographicItem
80
+ expect(items[1]).to be_instance_of RelatonIsoBib::IsoBibliographicItem
81
81
  end
82
82
 
83
83
  context "search for text" do
@@ -93,8 +93,8 @@ RSpec.describe Relaton::Db do
93
93
  items = db.fetch_all "123"
94
94
  expect(items.size).to eq 2
95
95
  items = db.fetch_all "ISO"
96
- expect(items.size).to eq 8
97
- expect(items[7].id).to eq "ISO123"
96
+ expect(items.size).to eq 1
97
+ expect(items[0].id).to eq "ISO123"
98
98
  end
99
99
 
100
100
  it "and fail" do
@@ -163,19 +163,32 @@ RSpec.describe Relaton::Db do
163
163
  results = []
164
164
  VCR.use_cassette "async_fetch", match_requests_on: %i[method uri body] do
165
165
  refs.each do |ref|
166
- db.fetch_async(ref) do |r|
167
- queue << [r, ref]
168
- end
169
- end
170
- Timeout.timeout(60) do
171
- refs.size.times { results << queue.pop }
166
+ db.fetch_async(ref) { |r| queue << [r, ref] }
172
167
  end
168
+ Timeout.timeout(60) { refs.size.times { results << queue.pop } }
173
169
  end
174
170
  results.each do |result|
175
171
  expect(result[0]).to be_instance_of RelatonItu::ItuBibliographicItem
176
172
  end
177
173
  end
178
174
 
175
+ it "BIPM i18n" do
176
+ expect(File).to receive(:exist?).with(/index\.yaml/).and_return false
177
+ allow(File).to receive(:exist?).and_call_original
178
+ refs = ["CGPM Resolution 1889-00", "CGPM Résolution 1889-00",
179
+ "CGPM Réunion 9", "CGPM Meeting 9"]
180
+ results = []
181
+ VCR.use_cassette "bipm_i18n_async_fetch", match_requests_on: %i[method uri body] do
182
+ refs.each do |ref|
183
+ db.fetch_async(ref) { |r| queue << [r, ref] }
184
+ end
185
+ Timeout.timeout(60) { refs.size.times { results << queue.pop } }
186
+ end
187
+ results.each do |result|
188
+ expect(result[0]).to be_instance_of RelatonBipm::BipmBibliographicItem
189
+ end
190
+ end
191
+
179
192
  it "prefix not found" do
180
193
  result = ""
181
194
  VCR.use_cassette "rfc_unsuccess" do
@@ -185,6 +198,22 @@ RSpec.describe Relaton::Db do
185
198
  expect(result).to be_nil
186
199
  end
187
200
 
201
+ it "handle HTTP request error" do
202
+ expect(db).to receive(:fetch).and_raise RelatonBib::RequestError
203
+ db.fetch_async("ISO REF") { |r| queue << r }
204
+ result = Timeout.timeout(5) { queue.pop }
205
+ expect(result).to be_instance_of RelatonBib::RequestError
206
+ end
207
+
208
+ it "handle other errors" do
209
+ expect(db).to receive(:fetch).and_raise Errno::EACCES
210
+ expect do
211
+ db.fetch_async("ISO REF") { |r| queue << r }
212
+ result = Timeout.timeout(5) { queue.pop }
213
+ expect(result).to be_nil
214
+ end.to output("[relaton] ERROR: ISO REF -- Permission denied\n").to_stderr
215
+ end
216
+
188
217
  it "use threads number from RELATON_FETCH_PARALLEL" do
189
218
  expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
190
219
  allow(ENV).to receive(:[]).and_call_original
@@ -195,50 +224,4 @@ RSpec.describe Relaton::Db do
195
224
  end
196
225
  end
197
226
  end
198
-
199
- context "fetch documents form static cache" do
200
- let(:db) { Relaton::Db.new nil, nil }
201
-
202
- it "fetches ISO/IEC DIR 1 IEC SUP" do
203
- bib = db.fetch "ISO/IEC DIR 1 IEC SUP"
204
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
205
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR 1 IEC SUP"
206
- end
207
-
208
- it "fetches ISO/IEC DIR 1 ISO SUP" do
209
- bib = db.fetch "ISO/IEC DIR 1 ISO SUP"
210
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
211
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR 1 ISO SUP"
212
- end
213
-
214
- it "fetches ISO/IEC DIR 1" do
215
- bib = db.fetch "ISO/IEC DIR 1"
216
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
217
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR 1"
218
- end
219
-
220
- it "fetches ISO/IEC DIR 2 IEC" do
221
- bib = db.fetch "ISO/IEC DIR 2 IEC"
222
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
223
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR 2 IEC"
224
- end
225
-
226
- it "fetches ISO/IEC DIR 2 ISO" do
227
- bib = db.fetch "ISO/IEC DIR 2 ISO"
228
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
229
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR 2 ISO"
230
- end
231
-
232
- it "fetches ISO/IEC DIR IEC SUP" do
233
- bib = db.fetch "ISO/IEC DIR IEC SUP"
234
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
235
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR IEC SUP"
236
- end
237
-
238
- it "fetches ISO/IEC DIR JTC 1 SUP" do
239
- bib = db.fetch "ISO/IEC DIR JTC 1 SUP"
240
- expect(bib).to be_instance_of RelatonIsoBib::IsoBibliographicItem
241
- expect(bib.docidentifier.first.id).to eq "ISO/IEC DIR JTC 1 SUP"
242
- end
243
- end
244
227
  end
data/spec/relaton_spec.rb CHANGED
@@ -6,7 +6,7 @@ RSpec.describe Relaton::Db do
6
6
 
7
7
  it "rejects an illegal reference prefix" do
8
8
  expect { @db.fetch("XYZ XYZ", nil, {}) }.to output(
9
- /does not have a recognised prefix/
9
+ /does not have a recognised prefix/,
10
10
  ).to_stderr
11
11
  end
12
12
 
@@ -38,7 +38,7 @@ RSpec.describe Relaton::Db do
38
38
  'type="standard">'
39
39
  testcache = Relaton::DbCache.new "testcache"
40
40
  expect(
41
- testcache.valid_entry?("ISO(ISO 19133:2005)", Date.today.year.to_s)
41
+ testcache.valid_entry?("ISO(ISO 19133:2005)", Date.today.year.to_s),
42
42
  ).to eq Date.today.year.to_s
43
43
  end
44
44
  end
@@ -195,11 +195,13 @@ RSpec.describe Relaton::Db do
195
195
  expect(File.exist?("testcache")).to be true
196
196
  expect(File.exist?("testcache2")).to be true
197
197
  testcache = Relaton::DbCache.new "testcache"
198
- expect(testcache["IETF(RFC 8341)"]).to include "<docidentifier "\
199
- "type=\"RFC\" primary=\"true\">RFC 8341</docidentifier>"
198
+ expect(testcache["IETF(RFC 8341)"]).to include(
199
+ '<docidentifier type="IETF" primary="true">RFC 8341</docidentifier>',
200
+ )
200
201
  testcache = Relaton::DbCache.new "testcache2"
201
- expect(testcache["IETF(RFC 8341)"]).to include "<docidentifier "\
202
- "type=\"RFC\" primary=\"true\">RFC 8341</docidentifier>"
202
+ expect(testcache["IETF(RFC 8341)"]).to include(
203
+ '<docidentifier type="IETF" primary="true">RFC 8341</docidentifier>',
204
+ )
203
205
  end
204
206
  end
205
207
 
@@ -246,11 +248,6 @@ RSpec.describe Relaton::Db do
246
248
  end
247
249
 
248
250
  it "get W3C reference" do
249
- # w3c_fr = /\.relaton\/w3c\/bibliography\.yml/
250
- # expect(File).to receive(:exist?).with(w3c_fr).and_return false
251
- # expect(File).to receive(:exist?).and_call_original.at_least :once
252
- # expect(File).to receive(:write).with w3c_fr, kind_of(String), kind_of(Hash)
253
- # expect(File).to receive(:write).and_call_original.at_least :once
254
251
  VCR.use_cassette "w3c_json_ld11" do
255
252
  bib = @db.fetch "W3C REC-json-ld11-20200716", nil, {}
256
253
  expect(bib).to be_instance_of RelatonW3c::W3cBibliographicItem
data/spec/spec_helper.rb CHANGED
@@ -13,6 +13,7 @@ VCR.configure do |c|
13
13
  clean_outdated_http_interactions: true,
14
14
  re_record_interval: 7 * 24 * 3600,
15
15
  record: :once,
16
+ allow_playback_repeats: true,
16
17
  }
17
18
  c.hook_into :webmock
18
19
  end
@@ -31,7 +31,7 @@ http_interactions:
31
31
  Content-Type:
32
32
  - text/plain; charset=utf-8
33
33
  Etag:
34
- - W/"7b1fd8c3cc8a83e47b78d925027060ef4583c418e75be5749d38f6a37e0f01ca"
34
+ - W/"ba4b443468f355962dc7524aa69c4ad80bbb98e840d6137fe420b6fa3fccf2d0"
35
35
  Strict-Transport-Security:
36
36
  - max-age=31536000
37
37
  X-Content-Type-Options:
@@ -41,29 +41,29 @@ http_interactions:
41
41
  X-Xss-Protection:
42
42
  - 1; mode=block
43
43
  X-Github-Request-Id:
44
- - FEF4:1395A:3E1BC8:42A2CE:6290BA99
44
+ - 8632:A505:57A7C:6013A:62B49FA8
45
45
  Accept-Ranges:
46
46
  - bytes
47
47
  Date:
48
- - Fri, 27 May 2022 11:48:42 GMT
48
+ - Thu, 23 Jun 2022 17:15:20 GMT
49
49
  Via:
50
50
  - 1.1 varnish
51
51
  X-Served-By:
52
- - cache-vie6371-VIE
52
+ - cache-vie6363-VIE
53
53
  X-Cache:
54
54
  - MISS
55
55
  X-Cache-Hits:
56
56
  - '0'
57
57
  X-Timer:
58
- - S1653652122.797835,VS0,VE233
58
+ - S1656004520.417992,VS0,VE231
59
59
  Vary:
60
60
  - Authorization,Accept-Encoding,Origin
61
61
  Access-Control-Allow-Origin:
62
62
  - "*"
63
63
  X-Fastly-Request-Id:
64
- - 740cb118933ba3ba55fcbdb02f6f313a4eb80f39
64
+ - e165b70d2170479617e6f38ce302ae4e577caea3
65
65
  Expires:
66
- - Fri, 27 May 2022 11:53:42 GMT
66
+ - Thu, 23 Jun 2022 17:20:20 GMT
67
67
  Source-Age:
68
68
  - '0'
69
69
  body:
@@ -127,7 +127,7 @@ http_interactions:
127
127
  value: withdrawn
128
128
  place:
129
129
  - Sophia Antipolis Cedex, France
130
- fetched: '2022-04-30'
130
+ fetched: '2022-06-15'
131
131
  doctype: TR
132
132
  editorialgroup:
133
133
  - name: SMG5
@@ -143,5 +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
- recorded_at: Fri, 27 May 2022 11:48:41 GMT
146
+ recorded_at: Thu, 23 Jun 2022 17:15:20 GMT
147
147
  recorded_with: VCR 6.1.0