relaton-bib 1.18.5 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78cb618453b32794d9e5583b0985965b7dbd449655a86350e3e768bae2ce62fc
4
- data.tar.gz: c9588e46e7bac0c6af6253d871642a607be7760a25c723f963bb9abb445fbbc8
3
+ metadata.gz: '078eeaee528f7e51a51015dc49723903af554087be753a244d69ebb2d1c0ac83'
4
+ data.tar.gz: 1ab74dea087ac8a1a4366ed24630ca4869774cc8b8f938e275a3684e0a61ec69
5
5
  SHA512:
6
- metadata.gz: 0434d911a3c19805872da208af341c8750d12bbede958d18e24bece3b74b3852ac9623675aa50b01a9d525639578b314e73f00560dc735ed5c375f951e612582
7
- data.tar.gz: ec8c14e1e5da20d4c4fed885acb055e5bb28a38c2019bef254fc3381644deb8e1fff85c873e7dbd67a496aff52cc99d575b9bfc7a15437721af8fb0523704947
6
+ metadata.gz: 62b65c967d716d9680b6e1ec1a361a3f1f2a0d48f032e793585b3630f1146a49897b2d2563c40e165bc04ceb437aeb7da70f7581945fb3f08a23563c79438e58
7
+ data.tar.gz: 34f6adc6c2998fe912879615f71079963331d83eb12cbb7d7bcff9c8ce4276da73b252aa8240cc105314a2f0aff786f401c99579a50a7df0255ac87673544059
@@ -11,3 +11,5 @@ on:
11
11
  jobs:
12
12
  rake:
13
13
  uses: relaton/support/.github/workflows/rake.yml@main
14
+ secrets:
15
+ pat_token: ${{ secrets.RELATON_CI_PAT_TOKEN }}
data/README.adoc CHANGED
@@ -27,24 +27,13 @@ Or install it yourself as:
27
27
 
28
28
  == Usage
29
29
 
30
- === Configuration
31
-
32
- 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 `RelatonBib.configure` block.
30
+ === Create bibliographic item
33
31
 
34
32
  [source,ruby]
35
33
  ----
36
34
  require 'relaton_bib'
37
35
  => true
38
36
 
39
- RelatonBib.configure do |config|
40
- config.logger.level = Logger::DEBUG
41
- end
42
- ----
43
-
44
- === Create bibliographic item
45
-
46
- [source,ruby]
47
- ----
48
37
  hash = YAML.load_file "spec/examples/bib_item.yml"
49
38
  => {"id"=>"ISOTC211",
50
39
  "fetched"=>"2022-05-02",
@@ -304,6 +293,10 @@ item.to_bibxml
304
293
  </reference>"
305
294
  ----
306
295
 
296
+ === Logging
297
+
298
+ RelatonBib 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.
299
+
307
300
  == Development
308
301
 
309
302
  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.
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -1,9 +1,9 @@
1
1
  {
2
- "relaton-models": "v1.2.8",
3
- "basicdoc-models": "v1.1.2",
2
+ "relaton-models": "v1.2.9",
3
+ "basicdoc-models": "v1.1.3",
4
4
  "metanorma-requirements-models": "v1.0.1",
5
5
  "relaton-model-ieee": "v1.0.1",
6
- "relaton-model-iso": "v1.0.0",
6
+ "relaton-model-iso": "v1.0.3",
7
7
  "relaton-model-iec": "v1.0.0",
8
8
  "relaton-model-bsi": "v1.0.2",
9
9
  "relaton-model-gb": "v1.0.0",
@@ -29,6 +29,6 @@
29
29
  "relaton-model-oasis": "v1.0.1",
30
30
  "relaton-model-jis": "v0.0.1",
31
31
  "relaton-model-etsi": "v0.0.3",
32
- "metanorma-model": "v1.2.11",
33
- "date": "2024-01-04T03:55:06Z"
32
+ "metanorma-model": "v1.3.0",
33
+ "date": "2024-02-21T18:15:14Z"
34
34
  }
@@ -18,7 +18,7 @@ module RelatonBib
18
18
  whole|table|annex|figure|note|list|example|volume|issue|time|anchor|
19
19
  locality:[a-zA-Z0-9_]+}x
20
20
  unless type&.match? type_ptrn
21
- Util.warn "WARNING: invalid locality type: `#{type}`"
21
+ Util.warn "Invalid locality type: `#{type}`"
22
22
  end
23
23
 
24
24
  @type = type
@@ -207,7 +207,7 @@ module RelatonBib
207
207
  # @option link [String] :content
208
208
  def initialize(**args)
209
209
  if args[:type] && !TYPES.include?(args[:type])
210
- Util.warn %{WARNING: type `#{args[:type]}` is invalid.}
210
+ Util.warn %{Type `#{args[:type]}` is invalid.}
211
211
  end
212
212
 
213
213
  @title = if args[:title].is_a?(TypedTitleStringCollection)
@@ -10,18 +10,6 @@ module RelatonBib
10
10
  end
11
11
 
12
12
  class Configuration
13
- PROGNAME = "relaton-bib".freeze
14
-
15
- attr_accessor :logger
16
-
17
- def initialize
18
- @logger = ::Logger.new $stderr
19
- @logger.level = ::Logger::WARN
20
- @logger.progname = self.class::PROGNAME
21
- @logger.formatter = proc do |_severity, _datetime, progname, msg|
22
- "[#{progname}] #{msg}\n"
23
- end
24
- end
25
13
  end
26
14
 
27
15
  extend Config
@@ -22,7 +22,7 @@ module RelatonBib
22
22
  # @param description [Array<String>]
23
23
  def initialize(**args)
24
24
  if args[:type] && !TYPES.include?(args[:type])
25
- Util.warn %{WARNING: Contributor's type `#{args[:type]}` is invalid.}
25
+ Util.warn %{Contributor's type `#{args[:type]}` is invalid.}
26
26
  end
27
27
 
28
28
  @type = args[:type]
@@ -46,7 +46,7 @@ module RelatonBib
46
46
  source_locality: [])
47
47
  type = "obsoletes" if type == "Now withdrawn"
48
48
  unless self.class::TYPES.include? type
49
- Util.warn "WARNING: invalid relation type: `#{type}`"
49
+ Util.warn "Invalid relation type: `#{type}`"
50
50
  end
51
51
  @type = type
52
52
  @description = description
@@ -358,7 +358,7 @@ module RelatonBib
358
358
  if rel[:bibitem]
359
359
  rel[:bibitem] = bib_item hash_to_bib(rel[:bibitem])
360
360
  else
361
- Util.warn "WARNING: bibitem missing: `#{rel}`"
361
+ Util.warn "Bibitem missing: `#{rel}`"
362
362
  rel[:bibitem] = nil
363
363
  end
364
364
  end
@@ -2,16 +2,15 @@ module RelatonBib
2
2
  module Util
3
3
  extend self
4
4
 
5
- def method_missing(...)
6
- logger.send(...)
7
- end
5
+ PROGNAME = "relaton-bib".freeze
8
6
 
9
- def respond_to_missing?(method_name, include_private = false)
10
- logger.respond_to?(method_name) || super
7
+ def method_missing(method_name, msg = nil, prog = nil, **opts, &block)
8
+ prog ||= self::PROGNAME
9
+ Relaton.logger_pool.send method_name, msg, prog, **opts, &block
11
10
  end
12
11
 
13
- def logger
14
- RelatonBib.configuration.logger
12
+ def respond_to_missing?(method_name, include_private = false)
13
+ Relaton.logger_pool.respond_to?(method_name) || super
15
14
  end
16
15
  end
17
16
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.18.5".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -17,7 +17,7 @@ module RelatonBib
17
17
  if bibitem
18
18
  bib_item item_data(bibitem)
19
19
  else
20
- Util.warn "WARNING: can't find bibitem or bibdata element in the XML"
20
+ Util.warn "Can't find bibitem or bibdata element in the XML"
21
21
  nil
22
22
  end
23
23
  end
data/lib/relaton_bib.rb CHANGED
@@ -1,9 +1,9 @@
1
+ require "relaton/logger"
1
2
  require "forwardable"
2
3
  require "yaml"
3
4
  require "htmlentities"
4
5
  require "relaton_bib/version"
5
6
  require "relaton_bib/deep_dup"
6
- require "relaton_bib/config"
7
7
  require "relaton_bib/util"
8
8
  require "relaton_bib/localized_string"
9
9
  require "relaton_bib/forename"
data/relaton-bib.gemspec CHANGED
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "htmlentities"
29
29
  spec.add_dependency "iso639"
30
30
  spec.add_dependency "nokogiri", "~> 1.16"
31
+ spec.add_dependency "relaton-logger", "~> 0.2.0"
31
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.5
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-22 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: addressable
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.16'
83
+ - !ruby/object:Gem::Dependency
84
+ name: relaton-logger
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.2.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.2.0
83
97
  description: 'RelatonBib: Ruby XMLDOC impementation.'
84
98
  email:
85
99
  - open.source@ribose.com