relaton-iho 1.14.3 → 1.16.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: 7240754831c7c3f7755ca76ab9146e04ab8f47a49ab5f06510b995964bac12fc
4
- data.tar.gz: 6c27b77afad2d493912506de26b7d22c1a9bba8c3e3d44d49c03420bdf8a5ed6
3
+ metadata.gz: 9081030fd9879044f6a850380bd33459ce7ecdd76869c37364b0364e5b4069cd
4
+ data.tar.gz: e65329781f6306a9eda0850bbff0951d348aaff0359067de4d9c9636dcf31ebb
5
5
  SHA512:
6
- metadata.gz: 583f3052bdce69fc00b5b784ac697311d3094de006f5eaf1474ecc974095ec8e9bc6884c00787f4f4225c5e9bef903b24a473caa9d2bbd8881863265e3b69e2d
7
- data.tar.gz: 1038cb049fccc2606c6c7a112dbf36d554c27225952701ac77b4d27e8d819926210854d1d6befa37e12017cc4b2f4778d44c4122073cc3a81f64653071b21ec8
6
+ metadata.gz: 584611520dcf2fc502065c40755d328b720026811164bdf265a16e121b2e26e1f77f81ae06e42ca71ba37fd16214ee52ed149a9f3c8529cb2074d895cad3302f
7
+ data.tar.gz: 68bee2e7910c5863aae0411af064c6825f124fff7a996550fdf983f5300bd45deeae128a6aeeac2e3da39bf272c8efe9e3af4c9e0117c7451bbf8aa0a2146fd0
@@ -7,7 +7,8 @@ on:
7
7
  inputs:
8
8
  next_version:
9
9
  description: |
10
- Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
10
+ Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
11
+ Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
11
12
  required: true
12
13
  default: 'skip'
13
14
  repository_dispatch:
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /.vscode/
10
+ /vendor/
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
data/.rubocop.yml CHANGED
@@ -7,6 +7,6 @@ require: rubocop-rails
7
7
  inherit_from:
8
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
9
  AllCops:
10
- TargetRubyVersion: 2.6
10
+ TargetRubyVersion: 2.7
11
11
  Rails:
12
12
  Enabled: false
data/Gemfile CHANGED
@@ -6,6 +6,9 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem "byebug"
9
+ gem "equivalent-xml", "~> 0.6"
10
+ gem "rake", "~> 13.0"
11
+ gem "rspec", "~> 3.0"
9
12
  gem "ruby-jing"
10
13
  gem "simplecov"
11
14
  gem "vcr"
data/grammars/biblio.rng CHANGED
@@ -1283,7 +1283,7 @@
1283
1283
  <value>mergedInto</value>
1284
1284
  <value>splits</value>
1285
1285
  <value>splitInto</value>
1286
- <value>instance</value>
1286
+ <value>instanceOf</value>
1287
1287
  <value>hasInstance</value>
1288
1288
  <value>exemplarOf</value>
1289
1289
  <value>hasExemplar</value>
@@ -0,0 +1,10 @@
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
@@ -14,21 +14,26 @@ 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
- warn "[relaton-iho] (\"#{text}\") fetching..."
17
+ Util.warn "(#{text}) fetching..."
18
18
  ref = text.sub(/^IHO\s/, "").sub(/^([[:alpha:]]+)(\d+)/, '\1-\2')
19
- index = Relaton::Index.find_or_create :IHO, url: "#{ENDPOINT}index.zip"
19
+ index = Relaton::Index.find_or_create :iho, url: "#{ENDPOINT}index.zip"
20
20
  row = index.search(ref).max_by { |r| r[:id] }
21
- return unless row
21
+ unless row
22
+ Util.warn "(#{text}) not found"
23
+ return
24
+ end
22
25
 
23
26
  uri = URI("#{ENDPOINT}#{row[:file]}")
24
27
  resp = Net::HTTP.get_response uri
25
- return unless resp.code == "200"
28
+ unless resp.code == "200"
29
+ raise RelatonBib::RequestError, "Could not access #{uri}: HTTP #{resp.code}"
30
+ end
26
31
 
27
32
  yaml = RelatonBib.parse_yaml resp.body, [Date]
28
33
  hash = HashConverter.hash_to_bib yaml
29
34
  hash[:fetched] = Date.today.to_s
30
35
  item = IhoBibliographicItem.new(**hash)
31
- warn "[relaton-iho] (\"#{text}\") found #{item.docidentifier.first.id}"
36
+ Util.warn "(#{text}) found `#{item.docidentifier.first.id}`"
32
37
  item
33
38
  rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
34
39
  Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
@@ -41,7 +41,7 @@ module RelatonIho
41
41
  # Remove index file
42
42
  #
43
43
  def remove_index_file
44
- Relaton::Index.find_or_create(:IHO, url: true).remove_file
44
+ Relaton::Index.find_or_create(:iho, url: true).remove_file
45
45
  end
46
46
  end
47
47
  end
@@ -0,0 +1,9 @@
1
+ module RelatonIho
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonIho.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonIho
2
- VERSION = "1.14.3".freeze
2
+ VERSION = "1.16.1".freeze
3
3
  end
data/lib/relaton_iho.rb CHANGED
@@ -3,6 +3,8 @@ require "yaml"
3
3
  require "relaton_bib"
4
4
  require "relaton/index"
5
5
  require "relaton_iho/version"
6
+ require "relaton_iho/config"
7
+ require "relaton_iho/util"
6
8
  require "relaton_iho/iho_bibliography"
7
9
  require "relaton_iho/hash_converter"
8
10
  require "relaton_iho/xml_parser"
@@ -17,9 +19,9 @@ module RelatonIho
17
19
  # Returns hash of XML reammar
18
20
  # @return [String]
19
21
  def self.grammar_hash
20
- gem_path = File.expand_path "..", __dir__
21
- grammars_path = File.join gem_path, "grammars", "*"
22
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
23
- Digest::MD5.hexdigest grammars
22
+ # gem_path = File.expand_path "..", __dir__
23
+ # grammars_path = File.join gem_path, "grammars", "*"
24
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
25
+ Digest::MD5.hexdigest RelatonIho::VERSION + RelatonBib::VERSION # grammars
24
26
  end
25
27
  end
data/relaton_iho.gemspec CHANGED
@@ -19,12 +19,8 @@ Gem::Specification.new do |s|
19
19
  end
20
20
  s.platform = Gem::Platform::RUBY
21
21
  s.require_paths = ["lib"]
22
- s.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
22
+ s.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
23
23
 
24
- s.add_development_dependency "equivalent-xml", "~> 0.6"
25
- s.add_development_dependency "rake", "~> 13.0"
26
- s.add_development_dependency "rspec", "~> 3.0"
27
-
28
- s.add_dependency "relaton-bib", "~> 1.14.0"
24
+ s.add_dependency "relaton-bib", "~> 1.16.0"
29
25
  s.add_dependency "relaton-index", "~> 0.2.0"
30
26
  end
metadata CHANGED
@@ -1,71 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.3
4
+ version: 1.16.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: 2023-05-16 00:00:00.000000000 Z
11
+ date: 2023-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: equivalent-xml
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.6'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.6'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '13.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '13.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
13
  - !ruby/object:Gem::Dependency
56
14
  name: relaton-bib
57
15
  requirement: !ruby/object:Gem::Requirement
58
16
  requirements:
59
17
  - - "~>"
60
18
  - !ruby/object:Gem::Version
61
- version: 1.14.0
19
+ version: 1.16.0
62
20
  type: :runtime
63
21
  prerelease: false
64
22
  version_requirements: !ruby/object:Gem::Requirement
65
23
  requirements:
66
24
  - - "~>"
67
25
  - !ruby/object:Gem::Version
68
- version: 1.14.0
26
+ version: 1.16.0
69
27
  - !ruby/object:Gem::Dependency
70
28
  name: relaton-index
71
29
  requirement: !ruby/object:Gem::Requirement
@@ -104,6 +62,7 @@ files:
104
62
  - grammars/relaton-iho.rng
105
63
  - lib/relaton_iho.rb
106
64
  - lib/relaton_iho/comment_periond.rb
65
+ - lib/relaton_iho/config.rb
107
66
  - lib/relaton_iho/editorial_group.rb
108
67
  - lib/relaton_iho/eg.yml
109
68
  - lib/relaton_iho/hash_converter.rb
@@ -111,6 +70,7 @@ files:
111
70
  - lib/relaton_iho/iho_bibliography.rb
112
71
  - lib/relaton_iho/iho_group.rb
113
72
  - lib/relaton_iho/processor.rb
73
+ - lib/relaton_iho/util.rb
114
74
  - lib/relaton_iho/version.rb
115
75
  - lib/relaton_iho/xml_parser.rb
116
76
  - relaton_iho.gemspec
@@ -126,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
86
  requirements:
127
87
  - - ">="
128
88
  - !ruby/object:Gem::Version
129
- version: 2.6.0
89
+ version: 2.7.0
130
90
  required_rubygems_version: !ruby/object:Gem::Requirement
131
91
  requirements:
132
92
  - - ">="