relaton 0.2.3 → 0.2.4
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/Gemfile.lock +7 -2
- data/lib/relaton/db.rb +18 -13
- data/lib/relaton/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7572658c834a43892700846acb448ed8c15573ec5a3b748f947464cb086ed9c4
|
4
|
+
data.tar.gz: bef8f6f331b769fd2e0f719eb41223c43ab19045ec7f180b2539a871abf550de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2ef0a6645e2b806d8e9a36247ec50646776cc01c35d6aa19da254c1095d2f944b83635f265667ea7572cc4c174f163713478f75473a81d90c6f2d8cc253b391
|
7
|
+
data.tar.gz: 104efaea9d07bcb9cae61cad2077ac7a3e404aafd66cb618d7369048e508c08a0a8dbc5c12f466b933a751d40a62c592840f23a0ee8c716566903a809e4de472
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relaton (0.2.
|
4
|
+
relaton (0.2.3)
|
5
5
|
algoliasearch
|
6
6
|
gbbib (~> 0.3.1)
|
7
7
|
iecbib (~> 0.1.1)
|
@@ -12,6 +12,8 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
+
addressable (2.5.2)
|
16
|
+
public_suffix (>= 2.0.2, < 4.0)
|
15
17
|
algoliasearch (1.23.2)
|
16
18
|
httpclient (~> 2.8, >= 2.8.3)
|
17
19
|
json (>= 1.5.1)
|
@@ -46,15 +48,17 @@ GEM
|
|
46
48
|
rspec (>= 2.99.0, < 4.0)
|
47
49
|
httpclient (2.8.3)
|
48
50
|
iecbib (0.1.1)
|
51
|
+
addressable
|
49
52
|
iso-bib-item (~> 0.3.0)
|
50
53
|
ietfbib (0.4.1)
|
51
54
|
iso-bib-item (~> 0.3.0)
|
52
|
-
iso-bib-item (0.3.
|
55
|
+
iso-bib-item (0.3.1)
|
53
56
|
isoics (~> 0.1.6)
|
54
57
|
nokogiri (~> 1.8.4)
|
55
58
|
ruby_deep_clone (~> 0.8.0)
|
56
59
|
isobib (0.3.1)
|
57
60
|
algoliasearch
|
61
|
+
iecbib (~> 0.1.1)
|
58
62
|
iso-bib-item (~> 0.3.0)
|
59
63
|
isoics (0.1.7)
|
60
64
|
jaro_winkler (1.5.1)
|
@@ -82,6 +86,7 @@ GEM
|
|
82
86
|
pry-byebug (3.6.0)
|
83
87
|
byebug (~> 10.0)
|
84
88
|
pry (~> 0.10)
|
89
|
+
public_suffix (3.0.3)
|
85
90
|
rainbow (3.0.0)
|
86
91
|
rake (12.3.1)
|
87
92
|
rb-fsevent (0.10.3)
|
data/lib/relaton/db.rb
CHANGED
@@ -69,12 +69,12 @@ module Relaton
|
|
69
69
|
|
70
70
|
# list all entries as a serialization
|
71
71
|
def to_xml
|
72
|
-
|
73
|
-
|
72
|
+
db = @local_db || @db || return
|
73
|
+
db.transaction do
|
74
74
|
Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
75
75
|
xml.documents do
|
76
|
-
|
77
|
-
each { |key|
|
76
|
+
db.roots.reject { |key| key == :version }.
|
77
|
+
each { |key| db[key]&.fetch("bib")&.to_xml(xml, {}) }
|
78
78
|
end
|
79
79
|
end.to_xml
|
80
80
|
end
|
@@ -119,16 +119,21 @@ module Relaton
|
|
119
119
|
# @param stdclass [Symbol]
|
120
120
|
def check_bibliocache(code, year, opts, stdclass)
|
121
121
|
id, searchcode = std_id(code, year, opts, stdclass)
|
122
|
-
|
123
|
-
@db
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
122
|
+
db = @local_db || @db
|
123
|
+
altdb = @local_db && @db ? @db : nil
|
124
|
+
return bib_retval(new_bib_entry(searchcode, year, opts, stdclass)) if db.nil?
|
125
|
+
db.transaction do
|
126
|
+
db.delete(id) unless valid_bib_entry?(db[id], year)
|
127
|
+
if altdb
|
128
|
+
altdb.transaction do
|
129
|
+
db[id] ||= altdb[id]
|
130
|
+
db[id] ||= new_bib_entry(searchcode, year, opts, stdclass)
|
131
|
+
altdb[id] = db[id] if !valid_bib_entry?(altdb[id], year)
|
132
|
+
bib_retval(db[id])
|
131
133
|
end
|
134
|
+
else
|
135
|
+
db[id] ||= new_bib_entry(searchcode, year, opts, stdclass)
|
136
|
+
bib_retval(db[id])
|
132
137
|
end
|
133
138
|
end
|
134
139
|
end
|
data/lib/relaton/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algoliasearch
|