relaton-ieee 1.18.0 → 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: cf78a4fc108fabc66a60e78c2d778815e73b80b2123f0e5899cb9d566da600d0
4
- data.tar.gz: 52979885f297a4f1682ba8b56f5a966f6cd73d11253ddef6769c3cd8c692ad48
3
+ metadata.gz: 4e671fb3b9fe9adc6d69c46f8d5757dd73e35dd324df9516eda63452ca5c3e8d
4
+ data.tar.gz: aa265d86a448bfdd00b893f93b8008f3fb22794419f6ecf63bcf0932bb4af46e
5
5
  SHA512:
6
- metadata.gz: bab3ad84a8178bc8a5e357d263eecfe473d12f17b626a5c7ccfb923571264559f4e792baf1821bbc63dd022ffd320cd81774a383cb384c89d9c2a88f6d89e8e6
7
- data.tar.gz: c37818c7d5c83941740ad6ace8844b17facdec4c65c198de601d7a59a6b018af7f0929a924cda66ad5b0c5c3894e4a34e11d510f52e3d667a05d55bbeb824b2b
6
+ metadata.gz: 5f690ba8cc419d3065b62bc2a5cc3dfd195a3d892219a05bf644e5a5e6f7ad081ce4d5486e5e65ee872a3640e709c1c0f639d7abd604139af5f18fd715591e0f
7
+ data.tar.gz: 5774082f3f48195883cdba7fa4d5cb9e092049405513f69c790db981ff159234827d16d698e4c57cc953eec0d4c15fe96359880e350eff21872f48af69768590
data/README.adoc CHANGED
@@ -23,24 +23,13 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
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.
26
+ === Search for a standard using keywords
29
27
 
30
28
  [source,ruby]
31
29
  ----
32
30
  require 'relaton_ieee'
33
31
  => true
34
32
 
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
- ----
44
33
  item = RelatonIeee::IeeeBibliography.search("IEEE 528-2019")
45
34
  => #<RelatonIeee::IeeeBibliographicItem:0x00007fe12ebc8cb8
46
35
  ...
@@ -139,6 +128,10 @@ Done in: 143 sec.
139
128
  => nil
140
129
  ----
141
130
 
131
+ === Logging
132
+
133
+ RelatonIeee 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.
134
+
142
135
  == Development
143
136
 
144
137
  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"/>
@@ -13,7 +13,7 @@ module RelatonIeee
13
13
  #
14
14
  def initialize(type:, content:)
15
15
  unless TYPES.include?(type)
16
- Util.warn "WARNING: type of Balloting group must be one of `#{TYPES.join('`, `')}`"
16
+ Util.warn "type of Balloting group must be one of `#{TYPES.join('`, `')}`"
17
17
  end
18
18
 
19
19
  @type = type
@@ -61,9 +61,7 @@ module RelatonIeee
61
61
  end
62
62
  fetch_doc xml, f
63
63
  rescue StandardError => e
64
- warn "File: #{f}"
65
- warn e.message
66
- warn e.backtrace
64
+ Util.error "File: #{f}\n#{e.message}\n#{e.backtrace}"
67
65
  end
68
66
  # File.write "normtitles.txt", @normtitles.join("\n")
69
67
  update_relations
@@ -92,7 +90,7 @@ module RelatonIeee
92
90
  def fetch_doc(xml, filename) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
93
91
  doc = Nokogiri::XML(xml).at("/publication")
94
92
  unless doc
95
- warn "Empty file: #{filename}"
93
+ Util.warn "Empty file: `#{filename}`"
96
94
  return
97
95
  end
98
96
  stdid = doc.at("./publicationinfo/standard_id")&.text
@@ -102,14 +100,14 @@ module RelatonIeee
102
100
  bib = fetcher.parse
103
101
  if bib.docnumber.nil?
104
102
  nt = doc&.at("./normtitle")&.text
105
- warn "PubID parse error. Normtitle: #{nt}, file: #{filename}"
103
+ Util.warn "PubID parse error. Normtitle: `#{nt}`, file: `#{filename}`"
106
104
  return
107
105
  end
108
106
  amsid = doc.at("./publicationinfo/amsid").text
109
107
  if backrefs.value?(bib.docidentifier[0].id) && /updates\.\d+/ !~ filename
110
108
  oamsid = backrefs.key bib.docidentifier[0].id
111
- warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: " \
112
- "\"#{amsid}\" source: \"#{filename}\". Other AMSID: \"#{oamsid}\""
109
+ Util.warn "Document exists ID: `#{bib.docidentifier[0].id}` AMSID: " \
110
+ "`#{amsid}` source: `#{filename}`. Other AMSID: `#{oamsid}`"
113
111
  if bib.docidentifier[0].id.include?(doc.at("./publicationinfo/stdnumber").text)
114
112
  save_doc bib # rewrite file if the PubID matches to the stdnumber
115
113
  backrefs[amsid] = bib.docidentifier[0].id
@@ -177,7 +175,7 @@ module RelatonIeee
177
175
  save_doc bib
178
176
  end
179
177
  else
180
- warn "Unresolved relation: '#{rf[:amsid]}' type: '#{rf[:type]}' for '#{dnum}'"
178
+ Util.warn "Unresolved relation: '#{rf[:amsid]}' type: '#{rf[:type]}' for '#{dnum}'"
181
179
  end
182
180
  end
183
181
  end
@@ -9,8 +9,7 @@ module RelatonIeee
9
9
 
10
10
  def check_type(type)
11
11
  unless DOCTYPES.include? type
12
- Util.warn "Invalid doctype: `#{type}`. " \
13
- "It should be one of: `#{DOCTYPES.join('`, `')}`."
12
+ Util.warn "Invalid doctype: `#{type}`. It should be one of: `#{DOCTYPES.join('`, `')}`."
14
13
  end
15
14
  end
16
15
  end
@@ -38,13 +38,13 @@ 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
- Util.warn "(#{code}) Fetching from Relaton repository ..."
41
+ Util.info "Fetching from Relaton repository ...", key: code
42
42
  item = search(code)
43
43
  if item
44
- Util.warn "(#{code}) Found: `#{item.docidentifier.first.id}`"
44
+ Util.info "Found: `#{item.docidentifier.first.id}`", key: code
45
45
  item
46
46
  else
47
- Util.warn "(#{code}) Not found."
47
+ Util.info "Not found.", key: code
48
48
  nil
49
49
  end
50
50
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonIeee
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonIeee.configuration.logger
7
- end
4
+ PROGNAME = "relaton-ieee".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.18.0".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -57,6 +57,10 @@ module RelatonIeee
57
57
 
58
58
  BallotingGroup.new type: bg[:type], content: bg.text
59
59
  end
60
+
61
+ def create_doctype(type)
62
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
63
+ end
60
64
  end
61
65
  end
62
66
  end
data/lib/relaton_ieee.rb CHANGED
@@ -4,7 +4,6 @@ require "yaml"
4
4
  require "relaton/index"
5
5
  require "relaton_bib"
6
6
  require "relaton_ieee/version"
7
- require "relaton_ieee/config"
8
7
  require "relaton_ieee/util"
9
8
  require "relaton_ieee/document_type"
10
9
  require "relaton_ieee/document_status"
data/relaton_ieee.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
 
34
34
  spec.add_dependency "faraday", "~> 2.7.0"
35
35
  spec.add_dependency "mini_portile2", "~> 2.8.0"
36
- spec.add_dependency "relaton-bib", "~> 1.18.0"
36
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
37
37
  spec.add_dependency "relaton-index", "~> 0.2.0"
38
38
  spec.add_dependency "rubyzip", "~> 2.3.0"
39
39
  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.18.0
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-01-07 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
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.18.0
47
+ version: 1.19.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.18.0
54
+ version: 1.19.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: relaton-index
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,6 @@ files:
109
109
  - lib/relaton_ieee.rb
110
110
  - lib/relaton_ieee/balloting_group.rb
111
111
  - lib/relaton_ieee/bibxml_parser.rb
112
- - lib/relaton_ieee/config.rb
113
112
  - lib/relaton_ieee/data_fetcher.rb
114
113
  - lib/relaton_ieee/data_parser.rb
115
114
  - lib/relaton_ieee/document_status.rb
@@ -146,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
145
  - !ruby/object:Gem::Version
147
146
  version: '0'
148
147
  requirements: []
149
- rubygems_version: 3.3.26
148
+ rubygems_version: 3.3.27
150
149
  signing_key:
151
150
  specification_version: 4
152
151
  summary: 'RelatonIeee: retrieve IEEE Standards for bibliographic use using the IeeeBibliographicItem
@@ -1,10 +0,0 @@
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