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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dac6ccdcd3852748aecbcc84c9ed6e5228fe321ab6659de9d7bf2233f9850c5a
4
- data.tar.gz: 285d6b583d9ba375a41be2c82dc1c025353cb39e160c76652eef266170fbbf69
3
+ metadata.gz: 17e6c9703f4210dd9ce8674da36d2f55d3333adeae4327cead1916500568f379
4
+ data.tar.gz: b1949a584249b5b509e1b8178de12b9abd8c1c8cb8ca03da620ce7c2a8cb9d2e
5
5
  SHA512:
6
- metadata.gz: a9ff1cebaef0e7b8ea8e995aa47b9686042ff3e7ceb764dd6abbb4b60f3f16eee529514bd3a029d818ed55c1e1d05f214c578a4430592dc2f8231d356a94db66
7
- data.tar.gz: d814e66a65fb439b70ba32ce02942d26c20ea83c741f0ebb14b9299eb38ada6ae90367db992554c168f7f4d04f556501ca9e6eaedf8d2e043473faad1a7dae4a
6
+ metadata.gz: fba601c6195bb9bacc28fa4ed4e58f6ed0d1fdcaa944f313c1019b96e5b371e0c606214fe1ccc116bbf0e0e4195480fdf04ad40951a41819a8e3652a537dde8e
7
+ data.tar.gz: f2e4fc968c99c09d0704692221fbd16a1427e26001d22c1fff5c39816c5a39501a0c4ddf05ed21ea55163e8e61ebff3b6f673850190368c8b6f6b212fc8a30ee
data/README.adoc CHANGED
@@ -1,4 +1,4 @@
1
- = RelatonBipm: retrieve OASIS Standards for bibliographic use using the BibliographicItem model
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
- === Configuration
33
+ === Get standard using reference.
34
34
 
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.
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.8">
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.8">
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.8",
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
- DCTYPES = %w[specification memorandum resolution standard].freeze
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 DCTYPES.include? type
12
- Util.warn "WARNING: invalid doctype: `#{type}`"
11
+ unless DOCTYPES.include? type
12
+ Util.warn "invalid doctype: `#{type}`"
13
13
  end
14
14
  end
15
15
  end
@@ -23,7 +23,7 @@ module RelatonOasis
23
23
  end
24
24
  new file
25
25
  rescue StandardError => e
26
- warn "Failed to fetch index: #{e.message}"
26
+ Util.error "Failed to fetch index: #{e.message}"
27
27
  end
28
28
 
29
29
  #
@@ -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 "WARNING Unknown technology #{area}: `#{uta.join('`, `')}`"
21
- Util.warn "Valid values are: `#{AREAS.join('`, `')}`"
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.warn "(#{code}) Fetching from Relaton repository ..."
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.warn "(#{code}) Found: `#{docid}`"
43
+ Util.info "Found: `#{docid}`", key: code
44
44
  else
45
- Util.warn "(#{code}) Not found."
45
+ Util.info "Not found.", key: code
46
46
  end
47
47
  bibitem
48
48
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonOasis
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonOasis.configuration.logger
7
- end
4
+ PROGNAME = "relaton-oasis".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonOasis
4
- VERSION = "1.18.1"
4
+ VERSION = "1.19.0"
5
5
  end
@@ -20,6 +20,10 @@ module RelatonOasis
20
20
  def bib_item(item_hash)
21
21
  OasisBibliographicItem.new(**item_hash)
22
22
  end
23
+
24
+ def create_doctype(type)
25
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
26
+ end
23
27
  end
24
28
  end
25
29
  end
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"
@@ -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.18.0"
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.18.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-06-19 00:00:00.000000000 Z
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.18.0
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.18.0
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
@@ -1,10 +0,0 @@
1
- module RelatonOasis
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-oasis".freeze
9
- end
10
- end