relaton-ietf 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: 7ccd4ea0f415da49834c5f36c55fab2221cc55513a2c3bcf2c84c3d2b3a286f4
4
- data.tar.gz: ab1c7c6723f9b539169008884cf9046b2bf468b9e998177d8b559ffbb5f83680
3
+ metadata.gz: 03b7d70436b1b0e29c81ad94edaa90ec760e0aa967221741968244814ef90843
4
+ data.tar.gz: 30e46687eb8e4db1166f2bfb7eee7dee973d4e07b98c83d70fc7d15289145a75
5
5
  SHA512:
6
- metadata.gz: c5dff62f7628ed91866d1c7e40e1b713c83902baecd9766db1dd2774c0aaed1de4a2b47af2747c8fd0bc60c65e3ff41b3c6b7e81343016aa8188abe4cb471f9b
7
- data.tar.gz: 63cf7decbfcd31a77138ed61d82563bff5896eb6e83a8ac278529983bdc1b59de88928e11306bbff7ffa86cde7c1002342c034730741393f83a4b587cf49c961
6
+ metadata.gz: 69445fabf05f86f46b9b44aa606e9cf6095625bc37ce1b13063b0c78f557b772415bd062c756c84f05918eddc6b78dc6350d38baa934c95d7a39a370c0b29f64
7
+ data.tar.gz: 3c0c12e1eaa48c80d25e8eb2a540655c5ea22133951518780406b22c87d727776bf69098204c90d9cf0b1c466e8621db21c1f71d0ef8e9dc36c5b59144cb6844
data/README.adoc CHANGED
@@ -33,24 +33,13 @@ Or install it yourself as:
33
33
 
34
34
  == Usage
35
35
 
36
- === Configuration
37
-
38
- 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 `RelatonIetf.configure` block.
36
+ === Fetching documents
39
37
 
40
38
  [source,ruby]
41
39
  ----
42
40
  require 'relaton_ietf'
43
41
  => true
44
42
 
45
- RelatonIetf.configure do |config|
46
- config.logger.level = Logger::DEBUG
47
- end
48
- ----
49
-
50
- === Fetching documents
51
-
52
- [source,ruby]
53
- ----
54
43
  # Fetch RFC document
55
44
  item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
56
45
  [relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
@@ -165,6 +154,10 @@ Done in: 360 sec.
165
154
  => nil
166
155
  ----
167
156
 
157
+ === Logging
158
+
159
+ RelatonIetf 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.
160
+
168
161
  == Contributing
169
162
 
170
163
  Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-ietf.
@@ -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"/>
@@ -168,8 +168,8 @@ module RelatonIetf
168
168
  rfc_index.xpath("xmlns:rfc-entry").each do |doc|
169
169
  save_doc RfcEntry.parse(doc)
170
170
  rescue StandardError => e
171
- warn "Error parsing #{doc.at('./xmlns:doc-id').text}: #{e.message}"
172
- warn e.backtrace[0..5].join("\n")
171
+ Util.error "Error parsing #{doc.at('./xmlns:doc-id').text}: #{e.message}\n" \
172
+ "#{e.backtrace[0..5].join("\n")}"
173
173
  end
174
174
  end
175
175
 
@@ -199,7 +199,7 @@ module RelatonIetf
199
199
  end
200
200
  file = file_name entry
201
201
  if check_duplicate && @files.include?(file)
202
- warn "File #{file} already exists. Document: #{entry.docnumber}"
202
+ Util.warn "File #{file} already exists. Document: #{entry.docnumber}"
203
203
  elsif check_duplicate
204
204
  @files << file
205
205
  end
@@ -9,7 +9,7 @@ module RelatonIetf
9
9
 
10
10
  def check_type(type)
11
11
  unless DOCTYPES.include? type
12
- Util.warn "WARNING: Invalid doctype: `#{type}`"
12
+ Util.warn "Invalid doctype: `#{type}`"
13
13
  end
14
14
  end
15
15
  end
@@ -18,13 +18,13 @@ module RelatonIetf
18
18
  # reference is required
19
19
  # @return [RelatonIetf::IetfBibliographicItem] Relaton of reference
20
20
  def get(code, _year = nil, _opts = {})
21
- Util.warn "(#{code}) Fetching from Relaton repository ..."
21
+ Util.info "Fetching from Relaton repository ...", key: code
22
22
  result = search code
23
23
  if result
24
24
  docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
25
- Util.warn "(#{code}) Found: `#{docid.id}`"
25
+ Util.info "Found: `#{docid.id}`", key: code
26
26
  else
27
- Util.warn "(#{code}) Not found."
27
+ Util.info "Not found.", key: code
28
28
  end
29
29
  result
30
30
  end
@@ -123,10 +123,12 @@ module RelatonIetf
123
123
  #
124
124
  def parse_relation
125
125
  @is_also.map do |ref|
126
- fref = RelatonBib::FormattedRef.new content: ref
127
- id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
128
- docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
129
- bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
126
+ entry = @doc.at("/xmlns:rfc-index/xmlns:rfc-entry[xmlns:doc-id = '#{ref}']")
127
+ bib = RfcEntry.parse entry
128
+ # fref = RelatonBib::FormattedRef.new content: ref
129
+ # id = ref.sub(/^([A-Z]+)0*(\d+)$/, '\1 \2')
130
+ # docid = RelatonBib::DocumentIdentifier.new(type: "IETF", id: id, primary: true)
131
+ # bib = IetfBibliographicItem.new formattedref: fref, docid: [docid]
130
132
  { type: "includes", bibitem: bib }
131
133
  end
132
134
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonIetf
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonIetf.configuration.logger
7
- end
4
+ PROGNAME = "relaton-ietf".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.18.0".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -32,6 +32,10 @@ module RelatonIetf
32
32
  end
33
33
  RelatonBib::EditorialGroup.new eg if eg.any?
34
34
  end
35
+
36
+ def create_doctype(type)
37
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
38
+ end
35
39
  end
36
40
  end
37
41
  end
data/lib/relaton_ietf.rb CHANGED
@@ -4,7 +4,6 @@ require "net/http"
4
4
  require "relaton/index"
5
5
  require "relaton_bib"
6
6
  require "relaton_ietf/version"
7
- require "relaton_ietf/config"
8
7
  require "relaton_ietf/util"
9
8
  require "relaton_ietf/document_type"
10
9
  require "relaton_ietf/bibxml_parser"
data/relaton_ietf.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "relaton-bib", "~> 1.18.0"
32
+ spec.add_dependency "base64"
33
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
33
34
  spec.add_dependency "relaton-index", "~> 0.2.3"
34
35
  end
metadata CHANGED
@@ -1,29 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
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
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: relaton-bib
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - "~>"
18
32
  - !ruby/object:Gem::Version
19
- version: 1.18.0
33
+ version: 1.19.0
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
- version: 1.18.0
40
+ version: 1.19.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: relaton-index
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -71,7 +85,6 @@ files:
71
85
  - lib/relaton_ietf.rb
72
86
  - lib/relaton_ietf/bibxml_parser.rb
73
87
  - lib/relaton_ietf/committee.rb
74
- - lib/relaton_ietf/config.rb
75
88
  - lib/relaton_ietf/data_fetcher.rb
76
89
  - lib/relaton_ietf/document_type.rb
77
90
  - lib/relaton_ietf/hash_converter.rb
@@ -105,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
118
  - !ruby/object:Gem::Version
106
119
  version: '0'
107
120
  requirements: []
108
- rubygems_version: 3.3.26
121
+ rubygems_version: 3.3.27
109
122
  signing_key:
110
123
  specification_version: 4
111
124
  summary: 'RelatonIetf: retrieve IETF Standards for bibliographic use using the BibliographicItem
@@ -1,10 +0,0 @@
1
- module RelatonIetf
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-ietf".freeze
9
- end
10
- end