relaton-w3c 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: 5ad3c2a2f3f43bd1b2f49932f6d380c9c27883287f7d70d7cbc9ab687ca24edd
4
- data.tar.gz: 35a4773f512ec8964b000cd1c13e29c3d0037007ad7a794c2a85972a300dc898
3
+ metadata.gz: dde70fdc615a88c4343add641e193635a5377af68180d96122b02af747aa50e5
4
+ data.tar.gz: 363d74d0a170b307006310bbbe2f6e645da40aabf12dbc2a94ebac4887f2452f
5
5
  SHA512:
6
- metadata.gz: 19bcd85f66199e6615d582a00ecffe168c9528d9d21e10ad1ce3d7c216123e0bee38dc204565d44d0442f37f4acf1c1979f5804c1dcf37875b9a84c05806f910
7
- data.tar.gz: 30fb3565ec766e6103e16c9b1b29fb64ca46826b43c8367a5fb109141b0228118dd972a887393671dab4c9a3074d559e4de720574134f8949ae0bae97d3bec4d
6
+ metadata.gz: fec1491eaa3108fd8726dfa0af50f54b98d7c28286c936d827088eed8ee7badbe6be430dd4588ad6324936f6cce8824379750a71ac4da9aa8d88788a47fceec4
7
+ data.tar.gz: e9d4074458f1a01e12ab84619861dda851ce668573d3b3e843a2c7ba8effed42e6c94545b49157626ba922ebfc31b57ff9d5877461626d2578a9ebdf128d314c
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 `RelatonW3c.configure` block.
26
+ === Search for a standard using keywords
29
27
 
30
28
  [source,ruby]
31
29
  ----
32
30
  require 'relaton_w3c'
33
31
  => true
34
32
 
35
- RelatonW3c.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
  item = RelatonW3c::W3cBibliography.get "W3C REC-json-ld11-20200716"
45
34
  [relaton-w3c] (W3C REC-json-ld11-20200716) Fetching from Relaton repository ...
46
35
  [relaton-w3c] (W3C REC-json-ld11-20200716) Found: `REC-json-ld11-20200716`
@@ -139,6 +128,10 @@ Done in: 155 sec.
139
128
  => nil
140
129
  ----
141
130
 
131
+ === Logging
132
+
133
+ RelatonW3c 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.
134
+
142
135
  == Development
143
136
 
144
137
  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.
@@ -55,8 +55,7 @@ module RelatonW3c
55
55
  save_doc bib
56
56
  rescue StandardError => e
57
57
  link = sl.respond_to?(:link) ? sl.link : sl.version_of
58
- warn "Error: document #{link} #{e.message}"
59
- warn e.backtrace.join("\n")
58
+ Util.error "Error: document #{link} #{e.message}\n#{e.backtrace.join("\n")}"
60
59
  end
61
60
  end
62
61
  end
@@ -218,7 +217,7 @@ module RelatonW3c
218
217
  # id = bib.docidentifier.detect(&:primary)&.id || bib.formattedref.content
219
218
  file = file_name(bib.docnumber)
220
219
  if @files.include?(file)
221
- warn "File #{file} already exists. Document: #{bib.docnumber}" if warn_duplicate
220
+ Util.warn "File #{file} already exists. Document: #{bib.docnumber}" if warn_duplicate
222
221
  else
223
222
  pubid = PubId.parse bib.docnumber
224
223
  @index.add pubid, file
@@ -443,7 +443,7 @@ module RelatonW3c
443
443
  rwg = RelatonBib::WorkGroup.new name: wg["name"]
444
444
  obj << RelatonBib::TechnicalCommittee.new(rwg)
445
445
  else
446
- Util.warn "WARNING: Working group name not found for: `#{edg.home_page}`"
446
+ Util.warn "Working group name not found for: `#{edg.home_page}`"
447
447
  end
448
448
  end
449
449
  RelatonBib::EditorialGroup.new tc
@@ -9,7 +9,7 @@ module RelatonW3c
9
9
 
10
10
  def check_type(type)
11
11
  unless DOCTYPES.include? type
12
- Util.warn "WARNING: invalid doctype: `#{type}`"
12
+ Util.warn "invalid doctype: `#{type}`"
13
13
  end
14
14
  end
15
15
  end
@@ -8,5 +8,9 @@ module RelatonW3c
8
8
  def bib_item(item_hash)
9
9
  W3cBibliographicItem.new(**item_hash)
10
10
  end
11
+
12
+ def create_doctype(**args)
13
+ DocumentType.new(**args)
14
+ end
11
15
  end
12
16
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonW3c
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonW3c.configuration.logger
7
- end
4
+ PROGNAME = "relaton-w3c".freeze
8
5
  end
9
6
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonW3c
2
- VERSION = "1.18.1".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
@@ -39,15 +39,15 @@ module RelatonW3c
39
39
  # @param opts [Hash] options
40
40
  # @return [RelatonW3c::W3cBibliographicItem]
41
41
  def get(ref, _year = nil, _opts = {})
42
- Util.warn "(#{ref}) Fetching from Relaton repository ..."
42
+ Util.info "Fetching from Relaton repository ...", key: ref
43
43
  result = search(ref)
44
44
  unless result
45
- Util.warn "(#{ref}) Not found."
45
+ Util.info "Not found.", key: ref
46
46
  return
47
47
  end
48
48
 
49
49
  found = result.docidentifier.first.id
50
- Util.warn "(#{ref}) Found: `#{found}`"
50
+ Util.info "Found: `#{found}`", key: ref
51
51
  result
52
52
  end
53
53
  end
@@ -20,6 +20,10 @@ module RelatonW3c
20
20
  def bib_item(item_hash)
21
21
  W3cBibliographicItem.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_w3c.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require "relaton_bib"
2
2
  require "relaton/index"
3
3
  require "relaton_w3c/version"
4
- require "relaton_w3c/config"
5
4
  require "relaton_w3c/util"
6
5
  require "relaton_w3c/document_type"
7
6
  require "relaton_w3c/w3c_bibliography"
data/relaton_w3c.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency "mechanize", "~> 2.10"
36
36
  spec.add_dependency "rdf", "~> 3.2"
37
37
  spec.add_dependency "rdf-normalize", "~> 0.6"
38
- spec.add_dependency "relaton-bib", "~> 1.18.0"
38
+ spec.add_dependency "relaton-bib", "~> 1.19.0"
39
39
  spec.add_dependency "relaton-index", "~> 0.2.8"
40
40
  spec.add_dependency "rubyzip", "~> 2.3"
41
41
  spec.add_dependency "shex", "~> 0.7"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-w3c
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: linkeddata
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.18.0
75
+ version: 1.19.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.18.0
82
+ version: 1.19.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: relaton-index
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +178,6 @@ files:
178
178
  - grammars/relaton-w3c.rng
179
179
  - lib/relaton_w3c.rb
180
180
  - lib/relaton_w3c/bibxml_parser.rb
181
- - lib/relaton_w3c/config.rb
182
181
  - lib/relaton_w3c/data_fetcher.rb
183
182
  - lib/relaton_w3c/data_index.rb
184
183
  - lib/relaton_w3c/data_parser.rb
@@ -1,10 +0,0 @@
1
- module RelatonW3c
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-w3c".freeze
9
- end
10
- end