relaton-iana 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 +15 -4
- data/lib/relaton_iana/config.rb +10 -0
- data/lib/relaton_iana/iana_bibliography.rb +6 -3
- data/lib/relaton_iana/util.rb +9 -0
- data/lib/relaton_iana/version.rb +1 -1
- data/lib/relaton_iana.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: 509869bec996aebee5073ea3cc62c0f8cb547958c2f3b0710c3ecfde3b39d18f
|
4
|
+
data.tar.gz: 49ef563cfe9b109547eb305e9d82b4de6002f17173d4d15d07221f995fed7218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd097de3eeb75adbd95b1cf149e97278dc1d9169b26496d5c9d959565c2cbd76705efe1194cabcecc088b2a92ebced7687313f1728f1dc039792f58b77dbc21f
|
7
|
+
data.tar.gz: 9bd62ec81ef47fad29b48f2796148df25d0a26fedacfe302378491dcf7785843d1ea514822008a82920c22f01840895a6b4974edb050e7b8b2049296e122ee75
|
data/README.adoc
CHANGED
@@ -23,16 +23,27 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
== Usage
|
25
25
|
|
26
|
-
===
|
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 `RelatonIana.configure` block.
|
27
29
|
|
28
30
|
[source,ruby]
|
29
31
|
----
|
30
32
|
require 'relaton_iana'
|
31
33
|
=> true
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
35
|
+
RelatonIana.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
|
+
item = RelatonIana::IanaBibliography.get "IANA service-names-port-numbers"
|
45
|
+
[relaton-iana] (IANA service-names-port-numbers) Fetching from Relaton repository ...
|
46
|
+
[relaton-iana] (IANA service-names-port-numbers) Found: `IANA service-names-port-numbers`
|
36
47
|
=> #<RelatonIana::IanaBibliographicItem:0x00007f7c6cc024d0
|
37
48
|
...
|
38
49
|
----
|
@@ -34,11 +34,14 @@ module RelatonIana
|
|
34
34
|
# @param opts [Hash] options
|
35
35
|
# @return [RelatonIana::IanaBibliographicItem]
|
36
36
|
def get(ref, _year = nil, _opts = {})
|
37
|
-
warn "
|
37
|
+
Util.warn "(#{ref}) Fetching from Relaton repository ..."
|
38
38
|
result = search(ref)
|
39
|
-
|
39
|
+
unless result
|
40
|
+
Util.warn "(#{ref}) Not found."
|
41
|
+
return
|
42
|
+
end
|
40
43
|
|
41
|
-
warn "
|
44
|
+
Util.warn "(#{ref}) Found: `#{result.docidentifier[0].id}`"
|
42
45
|
result
|
43
46
|
end
|
44
47
|
|
data/lib/relaton_iana/version.rb
CHANGED
data/lib/relaton_iana.rb
CHANGED
@@ -4,6 +4,8 @@ require "faraday"
|
|
4
4
|
require "relaton/index"
|
5
5
|
require "relaton_bib"
|
6
6
|
require_relative "relaton_iana/version"
|
7
|
+
require_relative "relaton_iana/config"
|
8
|
+
require_relative "relaton_iana/util"
|
7
9
|
require_relative "relaton_iana/iana_bibliographic_item"
|
8
10
|
require_relative "relaton_iana/xml_parser"
|
9
11
|
require_relative "relaton_iana/hash_converter"
|
@@ -17,9 +19,9 @@ module RelatonIana
|
|
17
19
|
# Returns hash of XML reammar
|
18
20
|
# @return [String]
|
19
21
|
def self.grammar_hash
|
20
|
-
gem_path = File.expand_path "..", __dir__
|
21
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
22
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
23
|
-
Digest::MD5.hexdigest grammars
|
22
|
+
# gem_path = File.expand_path "..", __dir__
|
23
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
24
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
25
|
+
Digest::MD5.hexdigest RelatonIana::VERSION + RelatonBib::VERSION # grammars
|
24
26
|
end
|
25
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iana
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -77,12 +77,14 @@ files:
|
|
77
77
|
- grammars/relaton-iana-compile.rng
|
78
78
|
- grammars/relaton-iana.rng
|
79
79
|
- lib/relaton_iana.rb
|
80
|
+
- lib/relaton_iana/config.rb
|
80
81
|
- lib/relaton_iana/data_fetcher.rb
|
81
82
|
- lib/relaton_iana/hash_converter.rb
|
82
83
|
- lib/relaton_iana/iana_bibliographic_item.rb
|
83
84
|
- lib/relaton_iana/iana_bibliography.rb
|
84
85
|
- lib/relaton_iana/parser.rb
|
85
86
|
- lib/relaton_iana/processor.rb
|
87
|
+
- lib/relaton_iana/util.rb
|
86
88
|
- lib/relaton_iana/version.rb
|
87
89
|
- lib/relaton_iana/xml_parser.rb
|
88
90
|
- relaton_iana.gemspec
|