relaton-oasis 1.18.1 → 1.20.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/hash_converter.rb +6 -0
- data/lib/relaton_oasis/index.rb +1 -1
- data/lib/relaton_oasis/oasis_bibliographic_item.rb +7 -3
- 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 +7 -8
- 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: e74c293597d3b10f3434807b8a150846ef37de5946df81bf0cd4fd4505876925
|
4
|
+
data.tar.gz: 780ac30d91ca5a34b40ec91da8c92f0f65b93a593c4737fa85f5a94a4c80f7b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8864c2d988ab8236cd948816a1048bcb50b325b75551b25719c233621e0fa5aa472b18f726b0865fd8645d9d19ee4d9aa76a1c660c810daaed9b32c3ba11e012
|
7
|
+
data.tar.gz: e56f5948245ad158f6b39e8bcd99a84171ca3b4f60fc98b2fabaf8c318c30bbfbdfdf2b9967bfaedfc93276c9bdf597838b5753e8baae8d4296b0e350ded5392
|
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
|
@@ -74,10 +74,14 @@ module RelatonOasis
|
|
74
74
|
#
|
75
75
|
def to_hash(embedded: false)
|
76
76
|
hash = super
|
77
|
-
hash["technology_area"] = technology_area if technology_area.any?
|
77
|
+
hash["ext"]["technology_area"] = technology_area if technology_area.any?
|
78
78
|
hash
|
79
79
|
end
|
80
80
|
|
81
|
+
def has_ext?
|
82
|
+
super || technology_area.any?
|
83
|
+
end
|
84
|
+
|
81
85
|
#
|
82
86
|
# Render bibliographic item as AsciiBib.
|
83
87
|
#
|
@@ -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.20.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.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-13 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.20.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.20.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
|
@@ -113,7 +112,7 @@ licenses:
|
|
113
112
|
metadata:
|
114
113
|
homepage_uri: https://github.com/metanorma/relaton-oasis
|
115
114
|
source_code_uri: https://github.com/metanorma/relaton-oasis
|
116
|
-
post_install_message:
|
115
|
+
post_install_message:
|
117
116
|
rdoc_options: []
|
118
117
|
require_paths:
|
119
118
|
- lib
|
@@ -129,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
128
|
version: '0'
|
130
129
|
requirements: []
|
131
130
|
rubygems_version: 3.3.27
|
132
|
-
signing_key:
|
131
|
+
signing_key:
|
133
132
|
specification_version: 4
|
134
133
|
summary: 'RelatonOasis: retrieve OASIS Standards for bibliographic use using the BibliographicItem
|
135
134
|
model'
|