relaton-bipm 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: b1db042c4a912ff57cf2fc14c3d7f43047e06f44ac3f30f45564ea9214201571
4
- data.tar.gz: d089989213bb5b37722e493600852c687ad1e889983d75f874c691e970e71ad4
3
+ metadata.gz: 24d544bd3daad314cd7af5b723c53765c4dfaedc5fe1cd56bfd4352dd9901a72
4
+ data.tar.gz: '0309c87fe248963a2fec6d1a9fd1eadfc99158a55e8e6a8e9fdf7cc00f3e6add'
5
5
  SHA512:
6
- metadata.gz: 896bdd6d0bab83f90479990c232a34a35d5a6a76a0ea4514410741e2febf94622b103d0e6403aeebd4acec5a2a347d03232a56f7cb33298b94bd1e347e40a62b
7
- data.tar.gz: 9175449ecb0da4a81389203aeccd1c541f2fd6f2f6028c087e9c40f263b143ffebc5c768df3bb299007e6150fccdfa51cd98b180d274363f902642df3a47a316
6
+ metadata.gz: a125b70df0a8cfaafb3acb4adc7fbf8dc429c05208def6658927302e9880009bc6a9d471c24ca7c0cf5257484297c75ad020d282eafa99cad1230e9048957eba
7
+ data.tar.gz: b7041bf466e72998494a9ebeeec12b7d26ca504a47125e2b47e4903a996a4756c6f04926fc5818f9cffb61601be2ef2e91b6e8a25b20b2c294cd7e45996cc6ff
@@ -27,13 +27,13 @@ module RelatonBipm
27
27
  # @param structuredidentifier [RelatonBipm::StructuredIdentifier]
28
28
  def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
29
29
  if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage.value)
30
- warn "[relaton-bipm] Warning: invalid docstatus: #{args[:docstatus].stage.value}. " \
31
- "It should be one of: #{STATUSES}"
30
+ Util.warn "Warning: invalid docstatus: `#{args[:docstatus].stage.value}`. " \
31
+ "It should be one of: `#{STATUSES.join('`, `')}`"
32
32
  end
33
33
 
34
34
  if args[:si_aspect] && !SI_ASPECTS.include?(args[:si_aspect])
35
- warn "[relaton-bipm] Warning: invalid si_aspect: #{args[:si_aspect]}. " \
36
- "It should be one of: #{SI_ASPECTS}"
35
+ Util.warn "Warning: invalid si_aspect: `#{args[:si_aspect]}``. " \
36
+ "It should be one of: `#{SI_ASPECTS.join('`, `')}`"
37
37
  end
38
38
 
39
39
  @comment_period = args.delete :comment_period
@@ -9,15 +9,15 @@ module RelatonBipm
9
9
  # @param text [String]
10
10
  # @return [RelatonBipm::BipmBibliographicItem]
11
11
  def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
12
- warn "[relaton-bipm] (\"#{text}\") fetching..."
12
+ Util.warn "(#{text}) fetching..."
13
13
  ref = text.sub(/^BIPM\s/, "")
14
14
  item = get_bipm(ref, magent)
15
15
  unless item
16
- warn "[relaton-bipm] (\"#{text}\") not found."
16
+ Util.warn "(#{text}) not found."
17
17
  return
18
18
  end
19
19
 
20
- warn("[relaton-bipm] (\"#{text}\") found #{item.docidentifier[0].id}")
20
+ Util.warn("(#{text}) found `#{item.docidentifier[0].id}`")
21
21
  item
22
22
  rescue Mechanize::ResponseCodeError => e
23
23
  raise RelatonBib::RequestError, e.message unless e.response_code == "404"
@@ -11,8 +11,8 @@ module RelatonBipm
11
11
  def initialize(acronym:, content: nil)
12
12
  acronyms = YAML.load_file File.join(__dir__, "acronyms.yaml")
13
13
  unless acronyms[acronym]
14
- warn "[relaton-bipm] WARNING: invalid acronym: #{acronym}. Allowed " \
15
- "values: #{acronyms.map { |k, _v| k }.join ', '}"
14
+ Util.warn "WARNING: invalid acronym: `#{acronym}`. Allowed " \
15
+ "values: `#{acronyms.map { |k, _v| k }.join '`, `'}`"
16
16
  end
17
17
 
18
18
  @acronym = acronym
@@ -0,0 +1,10 @@
1
+ module RelatonBipm
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-bipm".freeze
9
+ end
10
+ end
@@ -76,7 +76,7 @@ module RelatonBipm
76
76
  def initialize(id)
77
77
  @id = Parser.new.parse(id)
78
78
  rescue Parslet::ParseFailed => e
79
- warn "[relaton-bipm] Incorrect reference: #{id}"
79
+ Util.warn "Incorrect reference: `#{id}`"
80
80
  # warn "[relaton-bipm] #{e.parse_failure_cause.ascii_tree}"
81
81
  raise RelatonBib::RequestError, e
82
82
  end
@@ -0,0 +1,9 @@
1
+ module RelatonBipm
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonBipm.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.16.1".freeze
3
3
  end
data/lib/relaton_bipm.rb CHANGED
@@ -3,6 +3,8 @@ require "fileutils"
3
3
  require "parslet"
4
4
  require "relaton_bib"
5
5
  require "relaton/index"
6
+ require "relaton_bipm/config"
7
+ require "relaton_bipm/util"
6
8
  require "relaton_bipm/id_parser"
7
9
  require "relaton_bipm/version"
8
10
  require "relaton_bipm/editorial_group"
@@ -28,10 +30,10 @@ module RelatonBipm
28
30
  # Returns hash of XML reammar
29
31
  # @return [String]
30
32
  def grammar_hash
31
- gem_path = File.expand_path "..", __dir__
32
- grammars_path = File.join gem_path, "grammars", "*"
33
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
34
- Digest::MD5.hexdigest grammars
33
+ # gem_path = File.expand_path "..", __dir__
34
+ # grammars_path = File.join gem_path, "grammars", "*"
35
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
36
+ Digest::MD5.hexdigest RelatonBipm::VERSION + RelatonBib::VERSION # grammars
35
37
  end
36
38
 
37
39
  extend self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
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: faraday
@@ -127,6 +127,7 @@ files:
127
127
  - lib/relaton_bipm/bipm_si_brochure_parser.rb
128
128
  - lib/relaton_bipm/comment_periond.rb
129
129
  - lib/relaton_bipm/committee.rb
130
+ - lib/relaton_bipm/config.rb
130
131
  - lib/relaton_bipm/data_fetcher.rb
131
132
  - lib/relaton_bipm/data_outcomes_parser.rb
132
133
  - lib/relaton_bipm/document_relation.rb
@@ -137,6 +138,7 @@ files:
137
138
  - lib/relaton_bipm/rawdata_bipm_metrologia/article_parser.rb
138
139
  - lib/relaton_bipm/rawdata_bipm_metrologia/fetcher.rb
139
140
  - lib/relaton_bipm/structured_identifier.rb
141
+ - lib/relaton_bipm/util.rb
140
142
  - lib/relaton_bipm/version.rb
141
143
  - lib/relaton_bipm/workgroup.rb
142
144
  - lib/relaton_bipm/xml_parser.rb