relaton-bipm 1.18.2 → 1.19.0

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: 7e3b95a4edc9d788cb85a8ac616dcaf8c3ae1957a3138ee45c049e20d92cd168
4
- data.tar.gz: bf39e7f015de4adddbda44451bac4efc9691f1e50df4cc6ea5969067677a5f44
3
+ metadata.gz: f192fd171fc919d9b30fabc3ba8f0e17ecc1a3c58e0ade979f42847c4266ed06
4
+ data.tar.gz: bcf449487cef0842578309f4c00305ac25dd0da5154748c662c2499a1e04cc21
5
5
  SHA512:
6
- metadata.gz: 31ae9b9e3a97df4ee2bbaaa539a496babf1a28de8749fff8dbdd076251d63f188ac1ec88615ba651764fdfa730f242c4dbef535eb2a1fbe1d61d674e8970e631
7
- data.tar.gz: 4b883547bd97402ec22c9896c6aa535708748358aabf637755a2f305c7d64a30cbb2526ef689d3398fb4d5592680f5c40c87da61e71e50c4059d6df3dbd2a260
6
+ metadata.gz: 0da90de53422e0c080b29fb73cd5472a36018beeece575afe413eac28a698497b7be6d7a3ba352684d7dda6467136be08a3f6bfe0ef99a992991303a54257cc5
7
+ data.tar.gz: 866df7ec30e56762cc588bb710450b2dcf58ca2b8f066f9473410957f340034856e8426d7705223fc44357c4142d54fca88525554ca3fa649363cdde80929978
data/README.adoc CHANGED
@@ -179,24 +179,13 @@ Recommendation JCRB/43-1 (2021) / Recommandation JCRB/43-1 (2021)
179
179
  JCRB REC JCRB/43-1 (2021)
180
180
  ----
181
181
 
182
- === Configuration
183
-
184
- 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 `RelatonBipm.configure` block.
182
+ ==== Examples
185
183
 
186
184
  [source,ruby]
187
185
  ----
188
- require 'relaton_bipm'
186
+ require "relaton_bipm"
189
187
  => true
190
188
 
191
- RelatonBipm.configure do |config|
192
- config.logger.level = Logger::DEBUG
193
- end
194
- ----
195
-
196
- ==== Examples
197
-
198
- [source,ruby]
199
- ----
200
189
  # get BIPM brochure
201
190
  item = RelatonBipm::BipmBibliography.get "BIPM SI Brochure"
202
191
  [relaton-bipm] (BIPM SI Brochure) Fetching from Relaton repository ...
@@ -269,7 +258,7 @@ RelatonBipm::BipmBibliography.get "CIPM REC 1 (2005, FR)"
269
258
  [source,ruby]
270
259
  ----
271
260
  item.to_xml
272
- => "<bibitem id="BIPMSIBrochure" type="standard" schema-version="v1.2.1">
261
+ => "<bibitem id="BIPMSIBrochurePart1" type="standard" schema-version="v1.2.1">
273
262
  <fetched>2022-12-02</fetched>
274
263
  <title type="main" format="text/plain" language="en">The International System of Units</title>
275
264
  <title type="cover" format="text/plain" language="en">The International System of Units (SI)</title>
@@ -367,6 +356,10 @@ Done in: 82 sec.
367
356
  => nil
368
357
  ----
369
358
 
359
+ === Logging
360
+
361
+ RelatonBipm 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.
362
+
370
363
  == Development
371
364
 
372
365
  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.
@@ -23,12 +23,12 @@ module RelatonBipm
23
23
  # @param structuredidentifier [RelatonBipm::StructuredIdentifier]
24
24
  def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
25
25
  if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage.value)
26
- Util.warn "WARNING: Invalid docstatus: `#{args[:docstatus].stage.value}`. " \
26
+ Util.warn "Invalid docstatus: `#{args[:docstatus].stage.value}`. " \
27
27
  "It should be one of: `#{STATUSES.join('`, `')}`"
28
28
  end
29
29
 
30
30
  if args[:si_aspect] && !SI_ASPECTS.include?(args[:si_aspect])
31
- Util.warn "WARNING: Invalid si_aspect: `#{args[:si_aspect]}``. " \
31
+ Util.warn "Invalid si_aspect: `#{args[:si_aspect]}``. " \
32
32
  "It should be one of: `#{SI_ASPECTS.join('`, `')}`"
33
33
  end
34
34
 
@@ -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
- Util.warn "(#{text}) Fetching from Relaton repository ..."
12
+ Util.info "Fetching from Relaton repository ...", key: text
13
13
  ref = text.sub(/^BIPM\s/, "")
14
14
  item = get_bipm ref
15
15
  unless item
16
- Util.warn "(#{text}) Not found."
16
+ Util.info "Not found.", key: text
17
17
  return
18
18
  end
19
19
 
20
- Util.warn("(#{text}) Found: `#{item.docidentifier[0].id}`")
20
+ Util.info "Found: `#{item.docidentifier[0].id}`", key: text
21
21
  item
22
22
  rescue Mechanize::ResponseCodeError => e
23
23
  raise RelatonBib::RequestError, e.message unless e.response_code == "404"
@@ -11,7 +11,7 @@ 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
- Util.warn "WARNING: Invalid acronym: `#{acronym}`. Allowed " \
14
+ Util.warn "Invalid acronym: `#{acronym}`. Allowed " \
15
15
  "values: `#{acronyms.map { |k, _v| k }.join '`, `'}`"
16
16
  end
17
17
 
@@ -57,7 +57,7 @@ module RelatonBipm
57
57
  def write_file(path, item, warn_duplicate: true)
58
58
  content = serialize item
59
59
  if @files.include?(path)
60
- warn "File #{path} already exists" if warn_duplicate
60
+ Util.warn "File #{path} already exists" if warn_duplicate
61
61
  else
62
62
  @files << path
63
63
  end
@@ -22,7 +22,7 @@ module RelatonBipm
22
22
  #
23
23
  def check_type(type)
24
24
  # unless DOCTYPES.include? type
25
- # Util.warn "WARNING: invalid doctype: `#{type}`"
25
+ # Util.warn "invalid doctype: `#{type}`"
26
26
  # end
27
27
  end
28
28
  end
@@ -95,7 +95,7 @@ module RelatonBipm
95
95
  @id = match.named_captures.compact.transform_keys(&:to_sym)
96
96
  self
97
97
  rescue StandardError => e
98
- Util.warn "WARNING: Incorrect reference: `#{id}`"
98
+ Util.warn "Incorrect reference: `#{id}`"
99
99
  raise RelatonBib::RequestError, e
100
100
  end
101
101
 
@@ -1,9 +1,6 @@
1
1
  module RelatonBipm
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonBipm.configuration.logger
7
- end
4
+ PROGNAME = "relaton-bipm".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.18.2".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -97,6 +97,10 @@ module RelatonBipm
97
97
  # conts << RelatonBib::Address.new(city: city, country: country)
98
98
  # end
99
99
  # end
100
+
101
+ def create_doctype(type)
102
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
103
+ end
100
104
  end
101
105
  end
102
106
  end
data/lib/relaton_bipm.rb CHANGED
@@ -3,7 +3,6 @@ require "fileutils"
3
3
  require "parslet"
4
4
  require "relaton_bib"
5
5
  require "relaton/index"
6
- require "relaton_bipm/config"
7
6
  require "relaton_bipm/util"
8
7
  require "relaton_bipm/id_parser"
9
8
  require "relaton_bipm/version"
data/relaton_bipm.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
35
35
  spec.add_dependency "faraday", "~> 2.7.0"
36
36
  spec.add_dependency "mechanize", "~> 2.10"
37
37
  spec.add_dependency "parslet", "~> 2.0.0"
38
- spec.add_dependency "relaton-bib", "~> 1.18.0"
38
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
39
39
  spec.add_dependency "relaton-index", "~> 0.2.2"
40
40
  spec.add_dependency "rubyzip", "~> 2.3.0"
41
41
  end
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.18.2
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-18 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.18.0
61
+ version: 1.19.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.18.0
68
+ version: 1.19.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: relaton-index
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +127,6 @@ 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
131
130
  - lib/relaton_bipm/data_fetcher.rb
132
131
  - lib/relaton_bipm/data_outcomes_parser.rb
133
132
  - lib/relaton_bipm/document_relation.rb
@@ -1,10 +0,0 @@
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