relaton-ietf 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 +4 -4
- data/README.adoc +18 -7
- data/lib/relaton_ietf/config.rb +10 -0
- data/lib/relaton_ietf/ietf_bibliographic_item.rb +1 -1
- data/lib/relaton_ietf/ietf_bibliography.rb +3 -3
- data/lib/relaton_ietf/util.rb +9 -0
- data/lib/relaton_ietf/version.rb +1 -1
- data/lib/relaton_ietf.rb +6 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f991e579da3f0e467e20d1af8eb3215fc4f7c03f8dca773359da7262b4557a71
|
4
|
+
data.tar.gz: a8993337405ef4de678ce8b40670b93478dda1cf43c4e44bb33f1a0b13a960a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98d758c3fbaaf0c76e8c4c144e1a7fc5d3e55ccf4f922dd242f11882c7e6d2c759f027dc9f06b344ad6d3486c84d35f237ca878e3e6c9befcfaace406c1b698c
|
7
|
+
data.tar.gz: d5d739811a64be1aa4417a2958ffc9a91ca159c9a94c2655a50e6a0d6ea2d9c73684cc639edcc23939672aeae9d238f6c430216f79787ab29aae589ef6a1888a
|
data/README.adoc
CHANGED
@@ -33,31 +33,42 @@ Or install it yourself as:
|
|
33
33
|
|
34
34
|
== Usage
|
35
35
|
|
36
|
-
===
|
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.
|
37
39
|
|
38
40
|
[source,ruby]
|
39
41
|
----
|
40
42
|
require 'relaton_ietf'
|
41
43
|
=> true
|
42
44
|
|
45
|
+
RelatonIetf.configure do |config|
|
46
|
+
config.logger.level = Logger::DEBUG
|
47
|
+
end
|
48
|
+
----
|
49
|
+
|
50
|
+
=== Fetching documents
|
51
|
+
|
52
|
+
[source,ruby]
|
53
|
+
----
|
43
54
|
# Fetch RFC document
|
44
55
|
item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
|
45
|
-
[relaton-ietf] (
|
46
|
-
[relaton-ietf] (
|
56
|
+
[relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
|
57
|
+
[relaton-ietf] (IETF RFC 8341) Found: `RFC 8341`
|
47
58
|
=> #<RelatonIetf::IetfBibliographicItem:0x007fd1875e7f58
|
48
59
|
...
|
49
60
|
|
50
61
|
# Fetch Internet-Draft document
|
51
62
|
RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
|
52
|
-
[relaton-ietf] (
|
53
|
-
[relaton-ietf] (
|
63
|
+
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Fetching from Relaton repository ...
|
64
|
+
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Found: `draft-abarth-cake-01`
|
54
65
|
=> #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
|
55
66
|
...
|
56
67
|
|
57
68
|
# Return nil if a document doesn't exist.
|
58
69
|
RelatonIetf::IetfBibliography.get 'IETF 1111'
|
59
|
-
[relaton-ietf] (
|
60
|
-
[relaton-ietf] (
|
70
|
+
[relaton-ietf] (IETF 1111) Fetching from Relaton repository ...
|
71
|
+
[relaton-ietf] (IETF 1111) Not found.
|
61
72
|
=> nil
|
62
73
|
----
|
63
74
|
|
@@ -13,7 +13,7 @@ module RelatonIetf
|
|
13
13
|
# @param stream [String, nil]
|
14
14
|
def initialize(**args)
|
15
15
|
if args[:doctype] && !DOCTYPES.include?(args[:doctype])
|
16
|
-
warn "
|
16
|
+
Util.warn "WARNING: Invalid doctype: `#{args[:doctype]}`"
|
17
17
|
end
|
18
18
|
@stream = args.delete(:stream)
|
19
19
|
super
|
@@ -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
|
-
warn "
|
21
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
22
22
|
result = search code
|
23
23
|
if result
|
24
24
|
docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
|
25
|
-
warn "
|
25
|
+
Util.warn "(#{code}) Found: `#{docid.id}`"
|
26
26
|
else
|
27
|
-
warn "
|
27
|
+
Util.warn "(#{code}) Not found."
|
28
28
|
end
|
29
29
|
result
|
30
30
|
end
|
data/lib/relaton_ietf/version.rb
CHANGED
data/lib/relaton_ietf.rb
CHANGED
@@ -4,6 +4,8 @@ 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
|
+
require "relaton_ietf/util"
|
7
9
|
require "relaton_ietf/bibxml_parser"
|
8
10
|
require "relaton_ietf/ietf_bibliography"
|
9
11
|
require "relaton_ietf/xml_parser"
|
@@ -16,9 +18,9 @@ module RelatonIetf
|
|
16
18
|
# Returns hash of XML reammar
|
17
19
|
# @return [String]
|
18
20
|
def self.grammar_hash
|
19
|
-
gem_path = File.expand_path "..", __dir__
|
20
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
21
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
22
|
-
Digest::MD5.hexdigest grammars
|
21
|
+
# gem_path = File.expand_path "..", __dir__
|
22
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
23
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
24
|
+
Digest::MD5.hexdigest RelatonIetf::VERSION + RelatonBib::VERSION # grammars
|
23
25
|
end
|
24
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
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-
|
11
|
+
date: 2023-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton-bib
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/relaton_ietf.rb
|
72
72
|
- lib/relaton_ietf/bibxml_parser.rb
|
73
73
|
- lib/relaton_ietf/committee.rb
|
74
|
+
- lib/relaton_ietf/config.rb
|
74
75
|
- lib/relaton_ietf/data_fetcher.rb
|
75
76
|
- lib/relaton_ietf/hash_converter.rb
|
76
77
|
- lib/relaton_ietf/ietf_bibliographic_item.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/relaton_ietf/rfc_entry.rb
|
81
82
|
- lib/relaton_ietf/rfc_index_entry.rb
|
82
83
|
- lib/relaton_ietf/scrapper.rb
|
84
|
+
- lib/relaton_ietf/util.rb
|
83
85
|
- lib/relaton_ietf/version.rb
|
84
86
|
- lib/relaton_ietf/xml_parser.rb
|
85
87
|
- relaton_ietf.gemspec
|