relaton-bsi 1.16.0 → 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: 02a7a2396cd1217d1136a7a9b386faa0e68dc323c2b575432135eaceb82d5a49
4
- data.tar.gz: 78d05d994d33be9bfaf38563fdbac05a394d49a9bd6e52a0e331935e1d821087
3
+ metadata.gz: 021f994bae1987a1d8dadd5b1c9425bdcb1aad9c69d62d3e4cb3d388d55bd6d7
4
+ data.tar.gz: c96491e47dcd93b9281bd1deed2c5e0d1f72984c0aea401966e919dc4634b7a9
5
5
  SHA512:
6
- metadata.gz: 1a8472d369486ba81fc493a275d8b14df1aff5a398441b31adbec582a9f9b989f14c9b325e0fb5e7004361481e7f3103d07d766d1945255a1b1de7a92d61c565
7
- data.tar.gz: 83cdb931c8c3de6496e03ff95797e075683c20b9bb97ac6a230b9fdae82f2d7c1d5709a3572932e6f03e56955dacc905b904d4e01b2d29c66aa0494fe2c677a4
6
+ metadata.gz: e6b400c1153a40ede7766a6fce3be936114806d600d620eeaceb90ef521c439cb125ae3b53ca27df1dd536ed94366a33fce85e5aedfe0374ab0ebc7231a744e1
7
+ data.tar.gz: 51bc43147ec74f564d0e37aa97c29622b46554e4d4adba720ef46f1271827e16efd4bd7c23a4c239151d9ff42c97cceee009d35c9a67c9358f967002549e960f
@@ -11,8 +11,8 @@ module RelatonBsi
11
11
 
12
12
  def initialize(**args) # rubocop:disable Metrics/AbcSize
13
13
  if args[:subdoctype] && !SUBDOCTYPES.include?(args[:subdoctype])
14
- warn "[relaton-bsi] WARNING: invalid subdoctype: #{args[:subdoctype]}"
15
- warn "[relaton-bsi] Allowed subdoctypes are: #{SUBDOCTYPES.join(', ')}"
14
+ Util.warn "WARNING: invalid subdoctype: `#{args[:subdoctype]}`"
15
+ Util.warn "Allowed subdoctypes are: `#{SUBDOCTYPES.join('`, `')}`"
16
16
  end
17
17
  super
18
18
  end
@@ -1,14 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # require "mechanize"
4
- require "relaton_iso_bib"
5
- require "relaton_bsi/bsi_bibliographic_item"
6
- require "relaton_bsi/scrapper"
7
- require "relaton_bsi/hit_collection"
8
- require "relaton_bsi/hit"
9
- require "relaton_bsi/xml_parser"
10
- require "relaton_bsi/hash_converter"
11
-
12
3
  module RelatonBsi
13
4
  # Class methods for search ISO standards.
14
5
  class BsiBibliography
@@ -64,11 +55,11 @@ module RelatonBsi
64
55
  def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
65
56
  y = code_parts(code)[:year]
66
57
  id = year && !y ? "#{code}:#{year}" : code
67
- warn "[relaton-bsi] WARNING: no match found online for #{id}. "\
68
- "The code must be exactly like it is on the standards website."
58
+ Util.warn "WARNING: no match found online for `#{id}`. " \
59
+ "The code must be exactly like it is on the standards website."
69
60
  unless missed_years.empty?
70
- warn "[relaton-bsi] (There was no match for #{year}, though there "\
71
- "were matches found for #{missed_years.join(', ')}.)"
61
+ Util.warn "(There was no match for `#{year}`, though there " \
62
+ "were matches found for `#{missed_years.join('`, `')}`.)"
72
63
  end
73
64
  # if /\d-\d/.match? code
74
65
  # warn "[relaton-bsi] The provided document part may not exist, or "\
@@ -91,7 +82,7 @@ module RelatonBsi
91
82
  #
92
83
  def search_filter(code)
93
84
  cp = code_parts code
94
- warn "[relaton-bsi] (\"#{code}\") fetching..."
85
+ Util.warn "(#{code}) fetching..."
95
86
  return [] unless cp
96
87
 
97
88
  search(code).filter_hits!(cp)
@@ -121,7 +112,7 @@ module RelatonBsi
121
112
  result = search_filter(code) || return
122
113
  ret = results_filter(result, year)
123
114
  if ret[:ret]
124
- warn "[relaton-bsi] (\"#{code}\") found #{ret[:ret].docidentifier.first&.id}"
115
+ Util.warn "(#{code}) found `#{ret[:ret].docidentifier.first&.id}`"
125
116
  ret[:ret]
126
117
  else
127
118
  fetch_ref_err(code, year, ret[:years])
@@ -0,0 +1,10 @@
1
+ module RelatonBsi
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-bsi".freeze
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module RelatonBsi
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonBsi.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonBsi
4
- VERSION = "1.16.0"
4
+ VERSION = "1.16.1"
5
5
  end
data/lib/relaton_bsi.rb CHANGED
@@ -1,15 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "relaton_iso_bib"
3
4
  require_relative "relaton_bsi/version"
5
+ require "relaton_bsi/config"
6
+ require "relaton_bsi/util"
4
7
  require "relaton_bsi/bsi_bibliography"
8
+ require "relaton_bsi/bsi_bibliographic_item"
9
+ require "relaton_bsi/scrapper"
10
+ require "relaton_bsi/hit_collection"
11
+ require "relaton_bsi/hit"
12
+ require "relaton_bsi/xml_parser"
13
+ require "relaton_bsi/hash_converter"
5
14
 
6
15
  module RelatonBsi
7
16
  # Returns hash of XML greammar
8
17
  # @return [String]
9
18
  def self.grammar_hash
10
- gem_path = File.expand_path "..", __dir__
11
- grammars_path = File.join gem_path, "grammars", "*"
12
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
13
- Digest::MD5.hexdigest grammars
19
+ # gem_path = File.expand_path "..", __dir__
20
+ # grammars_path = File.join gem_path, "grammars", "*"
21
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
22
+ Digest::MD5.hexdigest RelatonBsi::VERSION + RelatonIsoBib::VERSION + RelatonBib::VERSION # grammars
14
23
  end
15
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.1
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-03 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algolia
@@ -94,12 +94,14 @@ files:
94
94
  - lib/relaton_bsi.rb
95
95
  - lib/relaton_bsi/bsi_bibliographic_item.rb
96
96
  - lib/relaton_bsi/bsi_bibliography.rb
97
+ - lib/relaton_bsi/config.rb
97
98
  - lib/relaton_bsi/hash_converter.rb
98
99
  - lib/relaton_bsi/hit.rb
99
100
  - lib/relaton_bsi/hit_collection.rb
100
101
  - lib/relaton_bsi/processor.rb
101
102
  - lib/relaton_bsi/schema.json
102
103
  - lib/relaton_bsi/scrapper.rb
104
+ - lib/relaton_bsi/util.rb
103
105
  - lib/relaton_bsi/version.rb
104
106
  - lib/relaton_bsi/xml_parser.rb
105
107
  - relaton_bsi.gemspec