relaton-ieee 1.16.0 → 1.16.2

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: 1b3158476d1e01a14fa8ca158d5216f0aa4f0f67a29ecb642a297dc60ff70e2d
4
- data.tar.gz: 10a6247158f7f63edbfc26ba0598cb90fd9bee5413a533de18f1544a0d5c8210
3
+ metadata.gz: 0e079c3a74f3f1ee1a1c3571fad7415228bc2f97e302612adf3d308bd799f613
4
+ data.tar.gz: 56928364c2d39df1e75e2034348e0ae25dad573b6e99d4ebe7d6c2faf9419abd
5
5
  SHA512:
6
- metadata.gz: dac9f194398e435db9884395e146beaf10932612b27cf29a7283779d761b7c120f8db2b35908bc70bf6b749004cf995745d34c92ea3e04854e3b54e246e1f2ff
7
- data.tar.gz: 76fbc102622c419171bd15006722eaedfffa2ec70ee42f87f343960508309cfb439ad43dead51bc14dd3b6adeb9a0ace7e5a9085dfdb9e5e7ea197bcdea357d6
6
+ metadata.gz: 6298c1fb4d18e8cc8c03535978d5bfd1ab632fe6d772dde22357a5196da75a812bffbb53fea47b52017fa6e55fbcf41257c5140f8cebe2d8e2ec7d45a61f6697
7
+ data.tar.gz: 5137a02683f0bc8dd1032f216f574d2f9ecdc000a12faa807b0604467ef4c4c7e0339822cf7d603f1bbae3b8c7cde20eb5df070c77dc5b04030a50b055e01cc8
data/README.adoc CHANGED
@@ -23,13 +23,24 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
26
- === Search for a standard using keywords
26
+ === Configuration
27
+
28
+ 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 `RelatonIeee.configure` block.
27
29
 
28
30
  [source,ruby]
29
31
  ----
30
32
  require 'relaton_ieee'
31
33
  => true
32
34
 
35
+ RelatonIeee.configure do |config|
36
+ config.logger.level = Logger::DEBUG
37
+ end
38
+ ----
39
+
40
+ === Search for a standard using keywords
41
+
42
+ [source,ruby]
43
+ ----
33
44
  item = RelatonIeee::IeeeBibliography.search("IEEE 528-2019")
34
45
  => #<RelatonIeee::IeeeBibliographicItem:0x00007fe12ebc8cb8
35
46
  ...
@@ -73,8 +84,8 @@ item.to_xml bibdata: true
73
84
  [source,ruby]
74
85
  ----
75
86
  RelatonIeee::IeeeBibliography.get("IEEE 528-2019")
76
- [relaton-ieee] ("IEEE 528-2019") fetching...
77
- [relaton-ieee] ("IEEE 528-2019") found IEEE 528-2019
87
+ [relaton-ieee] (IEEE 528-2019) fetching...
88
+ [relaton-ieee] (IEEE 528-2019) found `IEEE 528-2019`
78
89
  => #<RelatonIeee::IeeeBibliographicItem:0x007fceb52a6e40
79
90
  ...
80
91
  ----
@@ -13,7 +13,7 @@ module RelatonIeee
13
13
  #
14
14
  def initialize(type:, content:)
15
15
  unless TYPES.include?(type)
16
- warn "[relaton-ieee] WARNING: type of Balloting group must be one of #{TYPES.join(', ')}"
16
+ Util.warn "WARNING: type of Balloting group must be one of `#{TYPES.join('`, `')}`"
17
17
  end
18
18
 
19
19
  @type = type
@@ -0,0 +1,10 @@
1
+ module RelatonIeee
2
+ module Config
3
+ include RelatonBib::Config
4
+ end
5
+ extend Config
6
+
7
+ class Configuration < RelatonBib::Configuration
8
+ PROGNAME = "relaton-ieee".freeze
9
+ end
10
+ end
@@ -5,7 +5,7 @@ module RelatonIeee
5
5
 
6
6
  def initialize(value:, abbreviation: nil)
7
7
  unless STAGES.include?(value.downcase)
8
- warn "[relaton-ieee] Stage value must be one of #{STAGES.join(', ')}"
8
+ Util.warn "Stage value must be one of: `#{STAGES.join('`, `')}`"
9
9
  end
10
10
  super
11
11
  end
@@ -25,12 +25,12 @@ module RelatonIeee
25
25
  #
26
26
  def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
27
27
  if args[:doctype] && !DOCTYPES.include?(args[:doctype])
28
- warn "[relaton-ieee] invalid doctype \"#{args[:doctype]}\". " \
29
- "It should be one of: #{DOCTYPES.join(', ')}."
28
+ Util.warn "Invalid doctype: `#{args[:doctype]}`. " \
29
+ "It should be one of: `#{DOCTYPES.join('`, `')}`."
30
30
  end
31
31
  if args[:docsubtype] && !SUBTYPES.include?(args[:docsubtype])
32
- warn "[relaton-ieee] invalid docsubtype \"#{args[:docsubtype]}\". " \
33
- "It should be one of: #{SUBTYPES.join(', ')}."
32
+ Util.warn "Invalid docsubtype: `#{args[:docsubtype]}`. " \
33
+ "It should be one of: `#{SUBTYPES.join('`, `')}`."
34
34
  end
35
35
  eg = args.delete(:editorialgroup)
36
36
  @trialuse = args.delete(:trialuse)
@@ -38,13 +38,14 @@ module RelatonIeee
38
38
  # if document is found else returns NilClass
39
39
  #
40
40
  def get(code, _year = nil, _opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
41
- warn "[relaton-ieee] (\"#{code}\") fetching..."
41
+ Util.warn "(#{code}) Fetching from Relaton repository ..."
42
42
  item = search(code)
43
43
  if item
44
- warn "[relaton-ieee] (\"#{code}\") found #{item.docidentifier.first.id}"
44
+ Util.warn "(#{code}) Found: `#{item.docidentifier.first.id}`"
45
45
  item
46
46
  else
47
- warn "[relaton-ieee] (\"#{code}\") not found"
47
+ Util.warn "(#{code}) Not found."
48
+ nil
48
49
  end
49
50
  end
50
51
  end
@@ -456,7 +456,7 @@ module RelatonIeee
456
456
  PubId.new(publisher: $1, number: $2)
457
457
 
458
458
  else
459
- warn %{Use stdnumber "#{stdnumber}" for nortitle "#{normtitle}"}
459
+ Util.warn %{Use stdnumber "#{stdnumber}" for nortitle "#{normtitle}"}
460
460
  PubId.new(publisher: "IEEE", number: stdnumber)
461
461
  end
462
462
  rescue ArgumentError => e
@@ -0,0 +1,9 @@
1
+ module RelatonIeee
2
+ module Util
3
+ extend RelatonBib::Util
4
+
5
+ def self.logger
6
+ RelatonIeee.configuration.logger
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.16.0".freeze
2
+ VERSION = "1.16.2".freeze
3
3
  end
data/lib/relaton_ieee.rb CHANGED
@@ -4,6 +4,8 @@ require "yaml"
4
4
  require "relaton/index"
5
5
  require "relaton_bib"
6
6
  require "relaton_ieee/version"
7
+ require "relaton_ieee/config"
8
+ require "relaton_ieee/util"
7
9
  require "relaton_ieee/document_status"
8
10
  require "relaton_ieee/ieee_bibliography"
9
11
  require "relaton_ieee/ieee_bibliographic_item"
@@ -20,9 +22,9 @@ module RelatonIeee
20
22
  # Returns hash of XML reammar
21
23
  # @return [String]
22
24
  def self.grammar_hash
23
- gem_path = File.expand_path "..", __dir__
24
- grammars_path = File.join gem_path, "grammars", "*"
25
- grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
26
- Digest::MD5.hexdigest grammars
25
+ # gem_path = File.expand_path "..", __dir__
26
+ # grammars_path = File.join gem_path, "grammars", "*"
27
+ # grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
28
+ Digest::MD5.hexdigest RelatonIeee::VERSION + RelatonBib::VERSION # grammars
27
29
  end
28
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.16.2
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-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -108,6 +108,7 @@ files:
108
108
  - lib/relaton_ieee.rb
109
109
  - lib/relaton_ieee/balloting_group.rb
110
110
  - lib/relaton_ieee/bibxml_parser.rb
111
+ - lib/relaton_ieee/config.rb
111
112
  - lib/relaton_ieee/data_fetcher.rb
112
113
  - lib/relaton_ieee/data_parser.rb
113
114
  - lib/relaton_ieee/document_status.rb
@@ -118,6 +119,7 @@ files:
118
119
  - lib/relaton_ieee/processor.rb
119
120
  - lib/relaton_ieee/pub_id.rb
120
121
  - lib/relaton_ieee/rawbib_id_parser.rb
122
+ - lib/relaton_ieee/util.rb
121
123
  - lib/relaton_ieee/version.rb
122
124
  - lib/relaton_ieee/xml_parser.rb
123
125
  - relaton_ieee.gemspec