relaton-oasis 1.18.1 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +10 -17
- data/lib/relaton_oasis/data_fetcher.rb +1 -1
- data/lib/relaton_oasis/data_parser_utils.rb +1 -2
- data/lib/relaton_oasis/document_type.rb +3 -3
- data/lib/relaton_oasis/index.rb +1 -1
- data/lib/relaton_oasis/oasis_bibliographic_item.rb +2 -2
- data/lib/relaton_oasis/oasis_bibliography.rb +3 -3
- data/lib/relaton_oasis/util.rb +1 -4
- data/lib/relaton_oasis/version.rb +1 -1
- data/lib/relaton_oasis/xml_parser.rb +4 -0
- data/lib/relaton_oasis.rb +0 -1
- data/relaton_oasis.gemspec +1 -1
- metadata +4 -5
- data/lib/relaton_oasis/config.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17e6c9703f4210dd9ce8674da36d2f55d3333adeae4327cead1916500568f379
|
4
|
+
data.tar.gz: b1949a584249b5b509e1b8178de12b9abd8c1c8cb8ca03da620ce7c2a8cb9d2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba601c6195bb9bacc28fa4ed4e58f6ed0d1fdcaa944f313c1019b96e5b371e0c606214fe1ccc116bbf0e0e4195480fdf04ad40951a41819a8e3652a537dde8e
|
7
|
+
data.tar.gz: f2e4fc968c99c09d0704692221fbd16a1427e26001d22c1fff5c39816c5a39501a0c4ddf05ed21ea55163e8e61ebff3b6f673850190368c8b6f6b212fc8a30ee
|
data/README.adoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= RelatonOasis: retrieve OASIS Standards for bibliographic use using the BibliographicItem model
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-oasis.svg["Gem Version", link="https://rubygems.org/gems/relaton-oasis"]
|
4
4
|
image:https://github.com/relaton/relaton-oasis/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-oasis/actions?workflow=macos"]
|
@@ -30,26 +30,15 @@ Or install it yourself as:
|
|
30
30
|
|
31
31
|
== Usage
|
32
32
|
|
33
|
-
===
|
33
|
+
=== Get standard using reference.
|
34
34
|
|
35
|
-
|
35
|
+
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/.
|
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
|
-
----
|
53
42
|
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
|
54
43
|
[relaton-oasis] (OASIS) amqp-core Fetching from Relaton repository ...
|
55
44
|
[relaton-oasis] (OASIS amqp-core) Found: `OASIS amqp-core`
|
@@ -62,7 +51,7 @@ item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
|
|
62
51
|
[source,ruby]
|
63
52
|
----
|
64
53
|
item.to_xml
|
65
|
-
=> "<bibitem id="OASISamqp-core" type="standard" schema-version="v1.2.
|
54
|
+
=> "<bibitem id="OASISamqp-core" type="standard" schema-version="v1.2.9">
|
66
55
|
<fetched>2022-12-05</fetched>
|
67
56
|
<title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
|
68
57
|
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
|
@@ -75,7 +64,7 @@ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and add
|
|
75
64
|
[source,ruby]
|
76
65
|
----
|
77
66
|
item.to_xml bibdata: true
|
78
|
-
=> "<bibdata type="standard" schema-version="v1.2.
|
67
|
+
=> "<bibdata type="standard" schema-version="v1.2.9">
|
79
68
|
<fetched>2022-12-05</fetched>
|
80
69
|
<title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
|
81
70
|
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
|
@@ -121,7 +110,7 @@ RelatonOasis::XMLParser.from_xml File.read("spec/fixtures/oasis_bibdata.xml")
|
|
121
110
|
[source,ruby]
|
122
111
|
----
|
123
112
|
hash = YAML.load_file "spec/fixtures/oasis_bibdata.yaml"
|
124
|
-
=> {"schema-version"=>"v1.2.
|
113
|
+
=> {"schema-version"=>"v1.2.9",
|
125
114
|
"id"=>"OASISamqp-core",
|
126
115
|
...
|
127
116
|
|
@@ -150,6 +139,10 @@ Done in: 5 sec.
|
|
150
139
|
=> nil
|
151
140
|
----
|
152
141
|
|
142
|
+
=== Logging
|
143
|
+
|
144
|
+
RelatonOasis 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.
|
145
|
+
|
153
146
|
== Development
|
154
147
|
|
155
148
|
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.
|
@@ -73,7 +73,7 @@ module RelatonOasis
|
|
73
73
|
end
|
74
74
|
file = file_name doc
|
75
75
|
if @files.include? file
|
76
|
-
warn "File #{file} already exists. Document: #{doc.docnumber}"
|
76
|
+
Util.warn "File #{file} already exists. Document: #{doc.docnumber}"
|
77
77
|
else
|
78
78
|
@files << file
|
79
79
|
@index[doc] = file
|
@@ -53,8 +53,7 @@ module RelatonOasis
|
|
53
53
|
agent.get url
|
54
54
|
rescue Errno::ETIMEDOUT, Net::OpenTimeout => e
|
55
55
|
retry if (retries -= 1).positive?
|
56
|
-
Util.error "Failed to get page `#{url}
|
57
|
-
Util.error e.message
|
56
|
+
Util.error "Failed to get page `#{url}`\n#{e.message}"
|
58
57
|
nil
|
59
58
|
end
|
60
59
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RelatonOasis
|
2
2
|
class DocumentType < RelatonBib::DocumentType
|
3
|
-
|
3
|
+
DOCTYPES = %w[specification memorandum resolution standard].freeze
|
4
4
|
|
5
5
|
def initialize(type:, abbreviation: nil)
|
6
6
|
chceck_type type
|
@@ -8,8 +8,8 @@ module RelatonOasis
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def chceck_type(type)
|
11
|
-
unless
|
12
|
-
Util.warn "
|
11
|
+
unless DOCTYPES.include? type
|
12
|
+
Util.warn "invalid doctype: `#{type}`"
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/relaton_oasis/index.rb
CHANGED
@@ -17,8 +17,8 @@ module RelatonOasis
|
|
17
17
|
uta = @technology_area.reject { |a| AREAS.include? a }
|
18
18
|
if uta.any?
|
19
19
|
area = uta.size > 1 ? "areas" : "area"
|
20
|
-
Util.warn "
|
21
|
-
|
20
|
+
Util.warn "Unknown technology #{area}: `#{uta.join('`, `')}`\n" \
|
21
|
+
"Valid values are: `#{AREAS.join('`, `')}`"
|
22
22
|
end
|
23
23
|
super
|
24
24
|
end
|
@@ -36,13 +36,13 @@ module RelatonOasis
|
|
36
36
|
# reference is required
|
37
37
|
# @return [RelatonOasis::OasisBibliographicItem, nil]
|
38
38
|
def get(code, year = nil, _opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
39
|
-
Util.
|
39
|
+
Util.info "Fetching from Relaton repository ...", key: code
|
40
40
|
bibitem = search code, year
|
41
41
|
if bibitem
|
42
42
|
docid = bibitem.docidentifier.detect(&:primary).id
|
43
|
-
Util.
|
43
|
+
Util.info "Found: `#{docid}`", key: code
|
44
44
|
else
|
45
|
-
Util.
|
45
|
+
Util.info "Not found.", key: code
|
46
46
|
end
|
47
47
|
bibitem
|
48
48
|
end
|
data/lib/relaton_oasis/util.rb
CHANGED
data/lib/relaton_oasis.rb
CHANGED
@@ -4,7 +4,6 @@ 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
7
|
require_relative "relaton_oasis/util"
|
9
8
|
require_relative "relaton_oasis/document_type"
|
10
9
|
require_relative "relaton_oasis/oasis_bibliographic_item"
|
data/relaton_oasis.gemspec
CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_dependency "mechanize", "~> 2.10"
|
35
35
|
spec.add_dependency "multi_json", "~> 1.15.0"
|
36
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
36
|
+
spec.add_dependency "relaton-bib", "~> 1.19.0"
|
37
37
|
spec.add_dependency "relaton-index", "~> 0.2.0"
|
38
38
|
|
39
39
|
# For more information and examples about making a new gem, checkout our
|
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.
|
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-
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
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.
|
54
|
+
version: 1.19.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: relaton-index
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,7 +92,6 @@ 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
|
96
95
|
- lib/relaton_oasis/data_fetcher.rb
|
97
96
|
- lib/relaton_oasis/data_parser.rb
|
98
97
|
- lib/relaton_oasis/data_parser_utils.rb
|