relaton-ccsds 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: 69d80f031f0c147f71e47a5995bde9fd2bc1870d48cb14b72ce75a3696a759ff
4
- data.tar.gz: 10432fb3b7e23107f083e3b3a257252f57affb956671bc9b7efefef00ec1ae33
3
+ metadata.gz: d13a1ff82cb418e8778c916807bb43c5e8a3fe31f48f8f572c32e6f1631a59b1
4
+ data.tar.gz: 499cafc2a2dcfd2aa2f8b1040a6d0f2a7af4ad14851df92b980e73697b95ace2
5
5
  SHA512:
6
- metadata.gz: 42c9d010b92c8e44c55a50b25b02733dc3411b0ad29e984ad67b02dbbab72b9957bdc4b34c8f81bd79e527041fdca4ed69d30a2f0cfff125ae00e56559d3c0cc
7
- data.tar.gz: 0dc6886b36189ed8ab4e65943bab41983ce196be324c9f08fdc22c373e38d6b5b093fa7f1996f074a1d0b2f5bde8c850736998f15afab53982dc68974ae6c0b7
6
+ metadata.gz: 9cbac64eb97f0ca87f19c1274d9ff2864597fb62912a599ea8bd65c4ce722eb9c73e4c2466cdc915385425f9c08bab9f0392de64e62111c579c56df8ca6750c7
7
+ data.tar.gz: 37ccb6686d9b6cc55990561a205641d809d8ced600468f919588b7a56aa8c252e06076cee066bf3a97e17dbc76d12a05124d43069e5e1f8cab2d6376996fb91a
data/README.adoc CHANGED
@@ -23,24 +23,13 @@ Or install it yourself as:
23
23
 
24
24
  == Usage
25
25
 
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 `RelatonCcsds.configure` block.
26
+ === Search for a standard using keywords
29
27
 
30
28
  [source,ruby]
31
29
  ----
32
30
  require 'relaton_ccsds'
33
31
  => true
34
32
 
35
- RelatonCcsds.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
33
  hits = RelatonCcsds::Bibliography.search("CCSDS 230.2-G-1")
45
34
  => <RelatonCcsds::HitCollection:0x00000000001770 @ref=CCSDS 230.2-G-1 @fetched=false>
46
35
 
@@ -54,7 +43,7 @@ item = hits[0].doc
54
43
  [source,ruby]
55
44
  ----
56
45
  item.to_xml
57
- => "<bibitem id="CCSDS230.2-G-1" schema-version="v1.2.8">
46
+ => "<bibitem id="CCSDS230.2-G-1" schema-version="v1.2.9">
58
47
  <fetched>2023-08-25</fetched>
59
48
  <title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
60
49
  <uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
@@ -66,7 +55,7 @@ With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and ad
66
55
  [source,ruby]
67
56
  ----
68
57
  item.to_xml bibdata: true
69
- => "<bibdata schema-version="v1.2.8">
58
+ => "<bibdata schema-version="v1.2.9">
70
59
  <fetched>2023-08-25</fetched>
71
60
  <title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
72
61
  <uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
@@ -95,8 +84,8 @@ item.link
95
84
  @type="pdf">]
96
85
 
97
86
  RelatonCcsds::Bibliography.get("CCSDS 720.6-Y-1").link
98
- [relaton-ccsd] (CCSDS 720.6-Y-1) Fetching from Relaton repository ...
99
- [relaton-ccsd] (CCSDS 720.6-Y-1) Found: `CCSDS 720.6-Y-1`.
87
+ [relaton-ccsds] (CCSDS 720.6-Y-1) Fetching from Relaton repository ...
88
+ [relaton-ccsds] (CCSDS 720.6-Y-1) Found: `CCSDS 720.6-Y-1`.
100
89
  => [#<RelatonBib::TypedUri:0x0000000114183bb0
101
90
  @content=#<Addressable::URI:0xca8 URI:https://public.ccsds.org/Pubs/720x6y1.pdf>,
102
91
  @language=nil,
@@ -113,8 +102,8 @@ RelatonCcsds::Bibliography.get("CCSDS 720.6-Y-1").link
113
102
  [source,ruby]
114
103
  ----
115
104
  RelatonCcsds::Bibliography.get("CCSDS 230.2-G-1")
116
- [relaton-ccsd] (CCSDS 230.2-G-1) Fetching from Relaton repository ...
117
- [relaton-ccsd] (CCSDS 230.2-G-1) Found: `CCSDS 230.2-G-1`.
105
+ [relaton-ccsds] (CCSDS 230.2-G-1) Fetching from Relaton repository ...
106
+ [relaton-ccsds] (CCSDS 230.2-G-1) Found: `CCSDS 230.2-G-1`.
118
107
  => #<RelatonCcsds::BibliographicItem:0x00000001135dade0
119
108
  ...
120
109
  ----
@@ -124,8 +113,8 @@ RelatonCcsds::Bibliography.get("CCSDS 230.2-G-1")
124
113
  [source,ruby]
125
114
  ----
126
115
  item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (DOC)")
127
- [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) Fetching from Relaton repository ...
128
- [relaton-ccsd] (CCSDS 720.4-Y-1 (DOC)) Found: `CCSDS 720.4-Y-1`.
116
+ [relaton-ccsds] (CCSDS 720.4-Y-1 (DOC)) Fetching from Relaton repository ...
117
+ [relaton-ccsds] (CCSDS 720.4-Y-1 (DOC)) Found: `CCSDS 720.4-Y-1`.
129
118
  => #<RelatonCcsds::BibliographicItem:0x000000011100dfe0
130
119
  ...
131
120
 
@@ -139,8 +128,8 @@ pry(main)> item.link[0].content.to_s
139
128
  => "https://public.ccsds.org/Pubs/720x4y1.doc"
140
129
 
141
130
  item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (PDF)")
142
- [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) Fetching from Relaton repository ...
143
- [relaton-ccsd] (CCSDS 720.4-Y-1 (PDF)) Found: `CCSDS 720.4-Y-1`.
131
+ [relaton-ccsds] (CCSDS 720.4-Y-1 (PDF)) Fetching from Relaton repository ...
132
+ [relaton-ccsds] (CCSDS 720.4-Y-1 (PDF)) Found: `CCSDS 720.4-Y-1`.
144
133
  => #<RelatonCcsds::BibliographicItem:0x0000000111004620
145
134
  ...
146
135
 
@@ -195,6 +184,10 @@ Done in: 20 sec.
195
184
  => nil
196
185
  ----
197
186
 
187
+ === Logging
188
+
189
+ RelatonCcsds 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.
190
+
198
191
  == Development
199
192
 
200
193
  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.
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -27,14 +27,14 @@ module RelatonCcsds
27
27
  def get(reference, _year = nil, opts = {}) # rubocop:disable Metrics/MethodLength
28
28
  ref = reference.sub(/\s\((DOC|PDF)\)$/, "")
29
29
  opts[:format] ||= Regexp.last_match(1)
30
- Util.warn "(#{reference}) Fetching from Relaton repository ..."
30
+ Util.info "Fetching from Relaton repository ...", key: reference
31
31
  hits = search ref
32
32
  doc = hits.first&.doc&.to_format(opts[:format])
33
33
  unless doc
34
- Util.warn "(#{reference}) Not found."
34
+ Util.info "Not found.", key: reference
35
35
  return nil
36
36
  end
37
- Util.warn "(#{reference}) Found: `#{hits.first.code}`."
37
+ Util.info "Found: `#{hits.first.code}`.", key: reference
38
38
  doc
39
39
  end
40
40
  end
@@ -112,7 +112,7 @@ module RelatonCcsds
112
112
  id = bib.docidentifier.first.id
113
113
  file = File.join @output, "#{id.gsub(/[.\s-]+/, '-')}.#{@ext}"
114
114
  if @files.include?(file)
115
- puts "(#{file}) file already exists. Trying to merge links ..."
115
+ Util.info "(#{file}) file already exists. Trying to merge links ..."
116
116
  merge_links bib, file
117
117
  else @files << file
118
118
  end
@@ -235,10 +235,10 @@ module RelatonCcsds
235
235
  hash = YAML.load_file file
236
236
  bib2 = BibliographicItem.from_hash hash
237
237
  if bib.link[0].type == bib2.link[0].type
238
- warn "(#{file}) links are the same."
238
+ Util.info "links are the same.", key: file
239
239
  return
240
240
  end
241
- warn "(#{file}) links are merged."
241
+ Util.info "links are merged.", key: file
242
242
  bib.link << bib2.link[0]
243
243
  end
244
244
 
@@ -1,9 +1,6 @@
1
1
  module RelatonCcsds
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonCcsds.configuration.logger
7
- end
4
+ PROGNAME = "relaton-ccsds".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonCcsds
4
- VERSION = "1.18.1"
4
+ VERSION = "1.19.0"
5
5
  end
@@ -26,6 +26,10 @@ module RelatonCcsds
26
26
  def bib_item(item_hash)
27
27
  BibliographicItem.new(**item_hash)
28
28
  end
29
+
30
+ def create_doctype(type)
31
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
32
+ end
29
33
  end
30
34
  end
31
35
  end
data/lib/relaton_ccsds.rb CHANGED
@@ -5,7 +5,6 @@ require "relaton_bib"
5
5
  require "relaton/index"
6
6
  require_relative "relaton_ccsds/version"
7
7
  require_relative "relaton_ccsds/bibliographic_item"
8
- require_relative "relaton_ccsds/config"
9
8
  require_relative "relaton_ccsds/util"
10
9
  require_relative "relaton_ccsds/document_type"
11
10
  require_relative "relaton_ccsds/bibliography"
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  # Uncomment to register a new dependency of your gem
27
27
  spec.add_dependency "mechanize", "~> 2.10"
28
- spec.add_dependency "relaton-bib", "~> 1.18.0"
28
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
29
29
  spec.add_dependency "relaton-index", "~> 0.2.0"
30
30
 
31
31
  # For more information and examples about making a new gem, check out our
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ccsds
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-18 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.18.0
33
+ version: 1.19.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.18.0
40
+ version: 1.19.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaton-index
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -76,7 +76,6 @@ files:
76
76
  - lib/relaton_ccsds.rb
77
77
  - lib/relaton_ccsds/bibliographic_item.rb
78
78
  - lib/relaton_ccsds/bibliography.rb
79
- - lib/relaton_ccsds/config.rb
80
79
  - lib/relaton_ccsds/data_fetcher.rb
81
80
  - lib/relaton_ccsds/data_parser.rb
82
81
  - lib/relaton_ccsds/document_type.rb
@@ -1,10 +0,0 @@
1
- module RelatonCcsds
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-ccsd".freeze
9
- end
10
- end