relaton-oasis 1.16.0 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +17 -6
- data/lib/relaton_oasis/config.rb +10 -0
- data/lib/relaton_oasis/index.rb +6 -1
- data/lib/relaton_oasis/oasis_bibliographic_item.rb +3 -2
- data/lib/relaton_oasis/oasis_bibliography.rb +8 -6
- data/lib/relaton_oasis/util.rb +9 -0
- data/lib/relaton_oasis/version.rb +1 -1
- data/lib/relaton_oasis.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: 186697624e16817571af23ec1665efd8a562bbba0c9b980ab3068b1d7dfb24e6
|
|
4
|
+
data.tar.gz: 327389bf02d3f0ba84ce42ae08f9473215305c9ca72017ca80cc0bc39c64ed20
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44148f1ebdc5e14d6ab59323192415e37f6d812df9147d0fb3fb9b73aab0a35cd65e59077c17ef3ffca684840e909df07975ebfe596bef5885e729a4814b5107
|
|
7
|
+
data.tar.gz: f9cf5995c54f4d0a086f523ed018857a38459c60667df2065fc6c5cd8e74e2d85a0c0b4c7c404d05161197c59734540dfe456aac91c48f0b5be52ef105efa569
|
data/README.adoc
CHANGED
|
@@ -30,18 +30,29 @@ Or install it yourself as:
|
|
|
30
30
|
|
|
31
31
|
== Usage
|
|
32
32
|
|
|
33
|
-
===
|
|
33
|
+
=== Configuration
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
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 `RelatonOasis.configure` block.
|
|
36
36
|
|
|
37
37
|
[source,ruby]
|
|
38
38
|
----
|
|
39
39
|
require 'relaton_oasis'
|
|
40
40
|
=> true
|
|
41
41
|
|
|
42
|
+
RelatonOasis.configure do |config|
|
|
43
|
+
config.logger.level = Logger::DEBUG
|
|
44
|
+
end
|
|
45
|
+
----
|
|
46
|
+
|
|
47
|
+
=== Get standard using reference.
|
|
48
|
+
|
|
49
|
+
All the OASIS documents are parsed from https://www.oasis-open.org/standards/ and stored in a GitHub repository https://github.com/relaton/relaton-data-oasis. You can find all possible references on the index page https://relaton.github.io/relaton-data-oasis/.
|
|
50
|
+
|
|
51
|
+
[source,ruby]
|
|
52
|
+
----
|
|
42
53
|
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
|
|
43
|
-
[relaton-oasis] (OASIS amqp-core
|
|
44
|
-
[relaton-oasis] (OASIS amqp-core)
|
|
54
|
+
[relaton-oasis] (OASIS) amqp-core Fetching from Relaton repository ...
|
|
55
|
+
[relaton-oasis] (OASIS amqp-core) Found: `OASIS amqp-core`
|
|
45
56
|
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea1aecb0
|
|
46
57
|
...
|
|
47
58
|
----
|
|
@@ -86,8 +97,8 @@ Some OASIS documents have `src` type link.
|
|
|
86
97
|
[source,ruby]
|
|
87
98
|
----
|
|
88
99
|
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core-types-v1.0-Pt1"
|
|
89
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1
|
|
90
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1)
|
|
100
|
+
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Fetching from Relaton repository ...
|
|
101
|
+
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Found: `OASIS amqp-core-types-v1.0-Pt1`
|
|
91
102
|
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceda0c5e08
|
|
92
103
|
...
|
|
93
104
|
|
data/lib/relaton_oasis/index.rb
CHANGED
|
@@ -69,7 +69,12 @@ module RelatonOasis
|
|
|
69
69
|
# Read from file or create empty index.
|
|
70
70
|
#
|
|
71
71
|
def read
|
|
72
|
-
@index = File.exist?(@file)
|
|
72
|
+
@index = if File.exist?(@file)
|
|
73
|
+
YAML.load_file(@file,
|
|
74
|
+
symbolize_names: true)
|
|
75
|
+
else
|
|
76
|
+
[]
|
|
77
|
+
end
|
|
73
78
|
end
|
|
74
79
|
end
|
|
75
80
|
end
|
|
@@ -16,8 +16,9 @@ module RelatonOasis
|
|
|
16
16
|
@technology_area = args.delete(:technology_area) || []
|
|
17
17
|
uta = @technology_area.reject { |a| AREAS.include? a }
|
|
18
18
|
if uta.any?
|
|
19
|
-
|
|
20
|
-
warn "
|
|
19
|
+
area = uta.size > 1 ? "areas" : "area"
|
|
20
|
+
Util.warn "WARNING Unknown technology #{area}: `#{uta.join('`, `')}`"
|
|
21
|
+
Util.warn "Valid values are: `#{AREAS.join('`, `')}`"
|
|
21
22
|
end
|
|
22
23
|
super
|
|
23
24
|
end
|
|
@@ -9,9 +9,11 @@ module RelatonOasis
|
|
|
9
9
|
class << self
|
|
10
10
|
# @param text [String]
|
|
11
11
|
# @return [RelatonOasis::HitCollection]
|
|
12
|
-
def search(text, _year = nil)
|
|
12
|
+
def search(text, _year = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
13
13
|
/^(?:OASIS\s)?(?<code>.+)/ =~ text
|
|
14
|
-
index = Relaton::Index.find_or_create
|
|
14
|
+
index = Relaton::Index.find_or_create(
|
|
15
|
+
:oasis, url: "#{ENDPOINT}index-v1.zip", file: INDEX_FILE
|
|
16
|
+
)
|
|
15
17
|
row = index.search(code).min_by { |i| i[:id] }
|
|
16
18
|
return unless row
|
|
17
19
|
|
|
@@ -34,15 +36,15 @@ module RelatonOasis
|
|
|
34
36
|
# reference is required
|
|
35
37
|
# @return [RelatonOasis::OasisBibliographicItem, nil]
|
|
36
38
|
def get(code, year = nil, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
37
|
-
warn "
|
|
39
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
|
38
40
|
bibitem = search code, year
|
|
39
41
|
if bibitem
|
|
40
42
|
docid = bibitem.docidentifier.detect(&:primary).id
|
|
41
|
-
warn "
|
|
42
|
-
bibitem
|
|
43
|
+
Util.warn "(#{code}) Found: `#{docid}`"
|
|
43
44
|
else
|
|
44
|
-
warn "
|
|
45
|
+
Util.warn "(#{code}) Not found."
|
|
45
46
|
end
|
|
47
|
+
bibitem
|
|
46
48
|
end
|
|
47
49
|
end
|
|
48
50
|
end
|
data/lib/relaton_oasis.rb
CHANGED
|
@@ -4,6 +4,8 @@ require "mechanize"
|
|
|
4
4
|
require "relaton/index"
|
|
5
5
|
require "relaton_bib"
|
|
6
6
|
require_relative "relaton_oasis/version"
|
|
7
|
+
require_relative "relaton_oasis/config"
|
|
8
|
+
require_relative "relaton_oasis/util"
|
|
7
9
|
require_relative "relaton_oasis/oasis_bibliographic_item"
|
|
8
10
|
require_relative "relaton_oasis/xml_parser"
|
|
9
11
|
require_relative "relaton_oasis/hash_converter"
|
|
@@ -21,9 +23,9 @@ module RelatonOasis
|
|
|
21
23
|
# Returns hash of XML reammar
|
|
22
24
|
# @return [String]
|
|
23
25
|
def self.grammar_hash
|
|
24
|
-
gem_path = File.expand_path "..", __dir__
|
|
25
|
-
grammars_path = File.join gem_path, "grammars", "*"
|
|
26
|
-
grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
27
|
-
Digest::MD5.hexdigest grammars
|
|
26
|
+
# gem_path = File.expand_path "..", __dir__
|
|
27
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
28
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp }.join
|
|
29
|
+
Digest::MD5.hexdigest RelatonOasis::VERSION + RelatonBib::VERSION # grammars
|
|
28
30
|
end
|
|
29
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-oasis
|
|
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-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mechanize
|
|
@@ -92,6 +92,7 @@ files:
|
|
|
92
92
|
- grammars/relaton-oasis-compile.rng
|
|
93
93
|
- grammars/relaton-oasis.rng
|
|
94
94
|
- lib/relaton_oasis.rb
|
|
95
|
+
- lib/relaton_oasis/config.rb
|
|
95
96
|
- lib/relaton_oasis/data_fetcher.rb
|
|
96
97
|
- lib/relaton_oasis/data_parser.rb
|
|
97
98
|
- lib/relaton_oasis/data_parser_utils.rb
|
|
@@ -101,6 +102,7 @@ files:
|
|
|
101
102
|
- lib/relaton_oasis/oasis_bibliographic_item.rb
|
|
102
103
|
- lib/relaton_oasis/oasis_bibliography.rb
|
|
103
104
|
- lib/relaton_oasis/processor.rb
|
|
105
|
+
- lib/relaton_oasis/util.rb
|
|
104
106
|
- lib/relaton_oasis/version.rb
|
|
105
107
|
- lib/relaton_oasis/xml_parser.rb
|
|
106
108
|
- relaton_oasis.gemspec
|