relaton-oasis 1.16.1 → 1.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +17 -6
- data/lib/relaton_oasis/index.rb +6 -1
- data/lib/relaton_oasis/oasis_bibliography.rb +7 -5
- data/lib/relaton_oasis/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: 186697624e16817571af23ec1665efd8a562bbba0c9b980ab3068b1d7dfb24e6
|
4
|
+
data.tar.gz: 327389bf02d3f0ba84ce42ae08f9473215305c9ca72017ca80cc0bc39c64ed20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44148f1ebdc5e14d6ab59323192415e37f6d812df9147d0fb3fb9b73aab0a35cd65e59077c17ef3ffca684840e909df07975ebfe596bef5885e729a4814b5107
|
7
|
+
data.tar.gz: f9cf5995c54f4d0a086f523ed018857a38459c60667df2065fc6c5cd8e74e2d85a0c0b4c7c404d05161197c59734540dfe456aac91c48f0b5be52ef105efa569
|
data/README.adoc
CHANGED
@@ -30,18 +30,29 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
== Usage
|
32
32
|
|
33
|
-
===
|
33
|
+
=== Configuration
|
34
34
|
|
35
|
-
|
35
|
+
Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonOasis.configure` block.
|
36
36
|
|
37
37
|
[source,ruby]
|
38
38
|
----
|
39
39
|
require 'relaton_oasis'
|
40
40
|
=> true
|
41
41
|
|
42
|
+
RelatonOasis.configure do |config|
|
43
|
+
config.logger.level = Logger::DEBUG
|
44
|
+
end
|
45
|
+
----
|
46
|
+
|
47
|
+
=== Get standard using reference.
|
48
|
+
|
49
|
+
All the OASIS documents are parsed from https://www.oasis-open.org/standards/ and stored in a GitHub repository https://github.com/relaton/relaton-data-oasis. You can find all possible references on the index page https://relaton.github.io/relaton-data-oasis/.
|
50
|
+
|
51
|
+
[source,ruby]
|
52
|
+
----
|
42
53
|
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
|
43
|
-
[relaton-oasis] (OASIS amqp-core
|
44
|
-
[relaton-oasis] (OASIS amqp-core)
|
54
|
+
[relaton-oasis] (OASIS) amqp-core Fetching from Relaton repository ...
|
55
|
+
[relaton-oasis] (OASIS amqp-core) Found: `OASIS amqp-core`
|
45
56
|
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea1aecb0
|
46
57
|
...
|
47
58
|
----
|
@@ -86,8 +97,8 @@ Some OASIS documents have `src` type link.
|
|
86
97
|
[source,ruby]
|
87
98
|
----
|
88
99
|
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core-types-v1.0-Pt1"
|
89
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1
|
90
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1)
|
100
|
+
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Fetching from Relaton repository ...
|
101
|
+
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Found: `OASIS amqp-core-types-v1.0-Pt1`
|
91
102
|
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceda0c5e08
|
92
103
|
...
|
93
104
|
|
data/lib/relaton_oasis/index.rb
CHANGED
@@ -69,7 +69,12 @@ module RelatonOasis
|
|
69
69
|
# Read from file or create empty index.
|
70
70
|
#
|
71
71
|
def read
|
72
|
-
@index = File.exist?(@file)
|
72
|
+
@index = if File.exist?(@file)
|
73
|
+
YAML.load_file(@file,
|
74
|
+
symbolize_names: true)
|
75
|
+
else
|
76
|
+
[]
|
77
|
+
end
|
73
78
|
end
|
74
79
|
end
|
75
80
|
end
|
@@ -9,9 +9,11 @@ module RelatonOasis
|
|
9
9
|
class << self
|
10
10
|
# @param text [String]
|
11
11
|
# @return [RelatonOasis::HitCollection]
|
12
|
-
def search(text, _year = nil)
|
12
|
+
def search(text, _year = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
13
13
|
/^(?:OASIS\s)?(?<code>.+)/ =~ text
|
14
|
-
index = Relaton::Index.find_or_create
|
14
|
+
index = Relaton::Index.find_or_create(
|
15
|
+
:oasis, url: "#{ENDPOINT}index-v1.zip", file: INDEX_FILE
|
16
|
+
)
|
15
17
|
row = index.search(code).min_by { |i| i[:id] }
|
16
18
|
return unless row
|
17
19
|
|
@@ -34,13 +36,13 @@ module RelatonOasis
|
|
34
36
|
# reference is required
|
35
37
|
# @return [RelatonOasis::OasisBibliographicItem, nil]
|
36
38
|
def get(code, year = nil, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
37
|
-
Util.warn "(#{code})
|
39
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
38
40
|
bibitem = search code, year
|
39
41
|
if bibitem
|
40
42
|
docid = bibitem.docidentifier.detect(&:primary).id
|
41
|
-
Util.warn "(#{code})
|
43
|
+
Util.warn "(#{code}) Found: `#{docid}`"
|
42
44
|
else
|
43
|
-
Util.warn "(#{code})
|
45
|
+
Util.warn "(#{code}) Not found."
|
44
46
|
end
|
45
47
|
bibitem
|
46
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-oasis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.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: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|