relaton-iho 1.18.0 → 1.19.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef139e23ebc232eb915cc8ef5fc40c72d6c10a7abbacf8b4eb4265de419592fb
4
- data.tar.gz: 4d229bd50aef956e19673a93bedd803d3739500677712bec4acc09304ef4922e
3
+ metadata.gz: 16247e04f07a6fbe094e7af52674b4f0a21163ba3c6a00569f0c7997f7de1210
4
+ data.tar.gz: 93dded3e73d8dc2b7f5da7dd792fc72880b697d794a0fdbf915b1e6f501292a7
5
5
  SHA512:
6
- metadata.gz: 30c2187047e01832561e102a32de28aea2caaa43b892d241dd57775e42f1635e98cdc5a275c7a975448973c2c8717a3c1a2d29b5e5bb76b54a0de956e01b26da
7
- data.tar.gz: 86009de8c196fad07dd649ce91cab8774e9551d3e6be54bdb5854222f2c1d6703376e37a6b500b650cfdf42e9201425de78a68301c21ead9da49b89066efecdb
6
+ metadata.gz: a51361c6045a4a7db2b709bb9c8fcdc8ec6d789507cd64dc4d946807eec06a7d1a6924e5ce8a0e126e6ba4edb158054e7e93454adfd32989cf090df28bb72c70
7
+ data.tar.gz: 5f19ef5879dca6bc8d150e7974edf90562e5cb72f2ad98de1ceb41c9534c7d41b585755cae7830cb4ef8df36e3eeae54bdede29cfe643419524bca31a445fb63
data/README.adoc CHANGED
@@ -37,26 +37,15 @@ $ gem install relaton-iho
37
37
 
38
38
  == Usage
39
39
 
40
- === Configuration
40
+ === Search for a standard using keywords
41
41
 
42
- 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 `RelatonIho.configure` block.
42
+ Reference can be specified with or without an edition. References without an edition will return the latest edition of the standard. References with an edition will return the standard with the specified edition.
43
43
 
44
44
  [source,ruby]
45
45
  ----
46
46
  require 'relaton_iho'
47
47
  => true
48
48
 
49
- RelatonIho.configure do |config|
50
- config.logger.level = Logger::DEBUG
51
- end
52
- ----
53
-
54
- === Search for a standard using keywords
55
-
56
- Reference can be specified with or without an edition. References without an edition will return the latest edition of the standard. References with an edition will return the standard with the specified edition.
57
-
58
- [source,ruby]
59
- ----
60
49
  # Search for a standard using a reference without an edition
61
50
  item = RelatonIho::IhoBibliography.search("IHO B-11")
62
51
  [relaton-iho] (IHO B-11) Fetching from Relaton repository ...
@@ -142,6 +131,10 @@ RelatonIho::IhoBibliographicItem.from_hash hash
142
131
  ...
143
132
  ----
144
133
 
134
+ === Logging
135
+
136
+ RelatonIho uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
137
+
145
138
  == Development
146
139
 
147
140
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -10,7 +10,7 @@ module RelatonIho
10
10
 
11
11
  def check_type(type)
12
12
  unless DOCTYPES.include? type
13
- Util.warn "WARNING: invalid doctype: `#{type}`"
13
+ Util.warn "invalid doctype: `#{type}`"
14
14
  end
15
15
  end
16
16
  end
@@ -3,7 +3,7 @@ require "net/http"
3
3
  module RelatonIho
4
4
  class IhoBibliography
5
5
  ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-iho/" \
6
- "master/".freeze
6
+ "main/".freeze
7
7
 
8
8
  class << self
9
9
  #
@@ -14,12 +14,12 @@ module RelatonIho
14
14
  # @return [RelatonIho::IhoBibliographicItem, nil] the IHO standard or nil if not found
15
15
  #
16
16
  def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
17
- Util.warn "(#{text}) Fetching from Relaton repository ..."
17
+ Util.info "Fetching from Relaton repository ...", key: text
18
18
  ref = text.sub(/^IHO\s/, "").sub(/^([[:alpha:]]+)(\d+)/, '\1-\2')
19
19
  index = Relaton::Index.find_or_create :iho, url: "#{ENDPOINT}index.zip"
20
20
  row = index.search(ref).max_by { |r| r[:id] }
21
21
  unless row
22
- Util.warn "(#{text}) Not found."
22
+ Util.info "Not found.", key: text
23
23
  return
24
24
  end
25
25
 
@@ -33,7 +33,7 @@ module RelatonIho
33
33
  hash = HashConverter.hash_to_bib yaml
34
34
  hash[:fetched] = Date.today.to_s
35
35
  item = IhoBibliographicItem.new(**hash)
36
- Util.warn "(#{text}) Found: `#{item.docidentifier.first.id}`"
36
+ Util.info "Found: `#{item.docidentifier.first.id}`", key: text
37
37
  item
38
38
  rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
39
39
  Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
@@ -1,9 +1,6 @@
1
1
  module RelatonIho
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonIho.configuration.logger
7
- end
4
+ PROGNAME = "relaton-iho".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIho
2
- VERSION = "1.18.0".freeze
2
+ VERSION = "1.19.1".freeze
3
3
  end
@@ -53,6 +53,10 @@ module RelatonIho
53
53
 
54
54
  CommentPeriond.new from: cp.at("from")&.text, to: cp.at("to")&.text
55
55
  end
56
+
57
+ def create_doctype(type)
58
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
59
+ end
56
60
  end
57
61
  end
58
62
  end
data/lib/relaton_iho.rb CHANGED
@@ -3,7 +3,6 @@ require "yaml"
3
3
  require "relaton_bib"
4
4
  require "relaton/index"
5
5
  require "relaton_iho/version"
6
- require "relaton_iho/config"
7
6
  require "relaton_iho/util"
8
7
  require "relaton_iho/document_type"
9
8
  require "relaton_iho/iho_bibliography"
data/relaton_iho.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.require_paths = ["lib"]
22
22
  s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
23
23
 
24
- s.add_dependency "relaton-bib", "~> 1.18.0"
24
+ s.add_dependency "base64"
25
+ s.add_dependency "relaton-bib", "~> 1.19.0"
25
26
  s.add_dependency "relaton-index", "~> 0.2.0"
26
27
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.0
4
+ version: 1.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-07 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: relaton-bib
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 1.18.0
33
+ version: 1.19.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 1.18.0
40
+ version: 1.19.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: relaton-index
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,7 +76,6 @@ files:
62
76
  - grammars/relaton-iho.rng
63
77
  - lib/relaton_iho.rb
64
78
  - lib/relaton_iho/comment_periond.rb
65
- - lib/relaton_iho/config.rb
66
79
  - lib/relaton_iho/document_type.rb
67
80
  - lib/relaton_iho/editorial_group.rb
68
81
  - lib/relaton_iho/eg.yml
@@ -94,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
107
  - !ruby/object:Gem::Version
95
108
  version: '0'
96
109
  requirements: []
97
- rubygems_version: 3.3.26
110
+ rubygems_version: 3.3.27
98
111
  signing_key:
99
112
  specification_version: 4
100
113
  summary: 'RelatonIho: retrieve IHO Standards for bibliographic using the BibliographicItem
@@ -1,10 +0,0 @@
1
- module RelatonIho
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-iho".freeze
9
- end
10
- end