relaton-bipm 1.18.2 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +7 -14
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +2 -2
- data/lib/relaton_bipm/bipm_bibliography.rb +3 -3
- data/lib/relaton_bipm/committee.rb +1 -1
- data/lib/relaton_bipm/data_fetcher.rb +1 -1
- data/lib/relaton_bipm/document_type.rb +1 -1
- data/lib/relaton_bipm/id_parser.rb +1 -1
- data/lib/relaton_bipm/util.rb +1 -4
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/xml_parser.rb +4 -0
- data/lib/relaton_bipm.rb +0 -1
- data/relaton_bipm.gemspec +1 -1
- metadata +4 -5
- data/lib/relaton_bipm/config.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f192fd171fc919d9b30fabc3ba8f0e17ecc1a3c58e0ade979f42847c4266ed06
|
4
|
+
data.tar.gz: bcf449487cef0842578309f4c00305ac25dd0da5154748c662c2499a1e04cc21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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="
|
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 "
|
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 "
|
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.
|
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.
|
16
|
+
Util.info "Not found.", key: text
|
17
17
|
return
|
18
18
|
end
|
19
19
|
|
20
|
-
Util.
|
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 "
|
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
|
@@ -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 "
|
98
|
+
Util.warn "Incorrect reference: `#{id}`"
|
99
99
|
raise RelatonBib::RequestError, e
|
100
100
|
end
|
101
101
|
|
data/lib/relaton_bipm/util.rb
CHANGED
data/lib/relaton_bipm/version.rb
CHANGED
data/lib/relaton_bipm.rb
CHANGED
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.
|
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.
|
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-
|
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.
|
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.
|
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
|