relaton-oasis 1.16.1 → 1.16.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6667e673a229cfd5518f00a5c6d021382effa374ad0dfaad7da60865829f6b40
4
- data.tar.gz: 82b404a95e5f02139f6a79c601c1a13102d64d8b006d2ac1cf84c5c3c2cbc173
3
+ metadata.gz: 186697624e16817571af23ec1665efd8a562bbba0c9b980ab3068b1d7dfb24e6
4
+ data.tar.gz: 327389bf02d3f0ba84ce42ae08f9473215305c9ca72017ca80cc0bc39c64ed20
5
5
  SHA512:
6
- metadata.gz: 7c0025fadba0c8c04c32b0b35e2212673bed7396953ae5b9164c8a88e958815e5cf932abe44d09d248a24d0f33876fb11c891a08559171d59da01db87ba34f68
7
- data.tar.gz: e9c189383c69ed791232f05fd4a2fa52bf3f07040f67f7cc87cd8bb394352b1b891b88aeee9fb0ac7daa998f01c3ec96c679e12b623aba091f1baaf0e95a7a28
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
- === Get standard using reference.
33
+ === Configuration
34
34
 
35
- 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/.
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 fetching...
44
- [relaton-oasis] (OASIS amqp-core) found 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 fetching...
90
- [relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) found 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
 
@@ -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) ? YAML.load_file(@file, symbolize_names: true) : []
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 :oasis, url: "#{ENDPOINT}index-v1.zip", file: INDEX_FILE
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}) fetching..."
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}) found `#{docid}`"
43
+ Util.warn "(#{code}) Found: `#{docid}`"
42
44
  else
43
- Util.warn "(#{code}) not found"
45
+ Util.warn "(#{code}) Not found."
44
46
  end
45
47
  bibitem
46
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonOasis
4
- VERSION = "1.16.1"
4
+ VERSION = "1.16.2"
5
5
  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.1
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-09-21 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize