relaton-cli 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +5 -1
- data/lib/relaton/cli/command.rb +5 -2
- data/lib/relaton/cli/data_fetcher.rb +1 -1
- data/lib/relaton/cli/version.rb +1 -1
- data/lib/relaton/cli/yaml_convertor.rb +1 -1
- data/lib/relaton/cli.rb +14 -5
- data/relaton-cli.gemspec +2 -2
- metadata +9 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eeeb27905c2ef6fda052508001bbc157f08934caaf2a9a88dee35bc30a1d9d5c
|
|
4
|
+
data.tar.gz: e8a1fd32e4ca6a19b664053885d99e2ef91d35db021843e6a1349ec12e41207b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56004eae280afd81714ee54bcbf7718f674f67472b5ceb4e785a0469e140fc8d3292666672201b498fd47cd8e30f15923d98e5666e29964946abc9ab23c80fa4
|
|
7
|
+
data.tar.gz: 9e41422c0f5f4a04284698f60edcf5a168fc888e1b61cc193ae19362bd48dead59256a0dea114f70e5d570841bc2a9dcf3fe00bc386d2c76e795552adf4c1873
|
data/Gemfile
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
+
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
4
|
+
|
|
3
5
|
# Specify your gem's dependencies in gemspec
|
|
4
6
|
gemspec
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
# The v3 line tracks relaton main; drop this pin when the next
|
|
9
|
+
# 3.0.0.pre.alpha reaches rubygems (released pres lag main).
|
|
10
|
+
gem "relaton", github: "relaton/relaton", branch: "main"
|
|
7
11
|
|
|
8
12
|
gem "byebug", "~> 11.0"
|
|
9
13
|
gem "equivalent-xml", "~> 0.6"
|
data/lib/relaton/cli/command.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "date"
|
|
2
|
+
require "parslet"
|
|
2
3
|
require "relaton/cli/relaton_file"
|
|
3
4
|
require "relaton/cli/xml_convertor"
|
|
4
5
|
require "relaton/cli/yaml_convertor"
|
|
@@ -218,7 +219,7 @@ module Relaton
|
|
|
218
219
|
dup_opts[key] = parse_date_option(dup_opts[key], key.to_s.tr("_", "-").prepend("--")) if dup_opts[key]
|
|
219
220
|
end
|
|
220
221
|
validate_date_range dup_opts[:publication_date_after], dup_opts[:publication_date_before]
|
|
221
|
-
if (processor = Relaton::
|
|
222
|
+
if (processor = Relaton::Cli.registry.by_type options[:type]&.upcase)
|
|
222
223
|
doc = Relaton.db.fetch_std code, year, processor.short, **dup_opts
|
|
223
224
|
elsif options[:type] then return
|
|
224
225
|
else doc = Relaton.db.fetch(code, year, **dup_opts)
|
|
@@ -226,6 +227,8 @@ module Relaton
|
|
|
226
227
|
return "No matching bibliographic entry found" unless doc
|
|
227
228
|
|
|
228
229
|
serialize doc, options[:format]
|
|
230
|
+
rescue Parslet::ParseFailed
|
|
231
|
+
%("#{code}" is not a recognized standards identifier)
|
|
229
232
|
rescue Relaton::RequestError => e
|
|
230
233
|
e.message
|
|
231
234
|
end
|
|
@@ -247,7 +250,7 @@ module Relaton
|
|
|
247
250
|
|
|
248
251
|
def registered_types
|
|
249
252
|
@registered_types ||=
|
|
250
|
-
Relaton::
|
|
253
|
+
Relaton::Cli.registry.processors.each.map { |_n, pr| pr.prefix }
|
|
251
254
|
end
|
|
252
255
|
end
|
|
253
256
|
end
|
|
@@ -2,7 +2,7 @@ module Relaton
|
|
|
2
2
|
module Cli
|
|
3
3
|
module DataFetcher
|
|
4
4
|
def fetch(source, options)
|
|
5
|
-
processor = Relaton::
|
|
5
|
+
processor = Relaton::Cli.registry.find_processor_by_dataset source
|
|
6
6
|
unless processor
|
|
7
7
|
Util.warn "no processor found for `#{source}`"
|
|
8
8
|
return
|
data/lib/relaton/cli/version.rb
CHANGED
|
@@ -34,7 +34,7 @@ module Relaton
|
|
|
34
34
|
# RelatonIso::IsoBiblioraphicItem]
|
|
35
35
|
def convert_single_file(content)
|
|
36
36
|
flavor = content.dig("ext", "flavor") || doctype(content["docidentifier"])
|
|
37
|
-
if (processor =
|
|
37
|
+
if (processor = Relaton::Cli.registry.by_type(flavor))
|
|
38
38
|
begin
|
|
39
39
|
processor.from_yaml content.to_yaml
|
|
40
40
|
rescue RuntimeError
|
data/lib/relaton/cli.rb
CHANGED
|
@@ -40,15 +40,24 @@ module Relaton
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
class << self
|
|
43
|
+
# The processor registry moved in relaton v3: the top-level
|
|
44
|
+
# Relaton::Registry became Relaton::Db::Registry. The v2 line keeps
|
|
45
|
+
# the old constant, so resolve whichever is present.
|
|
46
|
+
def registry
|
|
47
|
+
Relaton::Db::Registry.instance
|
|
48
|
+
rescue NameError
|
|
49
|
+
Relaton::Registry.instance
|
|
50
|
+
end
|
|
51
|
+
|
|
43
52
|
def version
|
|
44
53
|
require "relaton/bib"
|
|
45
|
-
registry =
|
|
54
|
+
registry = registry()
|
|
46
55
|
puts "CLI => #{Relaton::Cli::VERSION}"
|
|
47
56
|
puts "relaton => #{Gem.loaded_specs['relaton'].version}"
|
|
48
|
-
puts "relaton-bib => #{Gem.loaded_specs['relaton-bib'].version}"
|
|
49
57
|
registry.processors.each_key do |k|
|
|
50
58
|
name = k.to_s.sub("_", "-")
|
|
51
|
-
|
|
59
|
+
spec = Gem.loaded_specs[name]
|
|
60
|
+
puts "#{name} => #{spec.version}" if spec
|
|
52
61
|
end
|
|
53
62
|
end
|
|
54
63
|
|
|
@@ -91,7 +100,7 @@ module Relaton
|
|
|
91
100
|
proc = get_proc docid
|
|
92
101
|
return proc if proc
|
|
93
102
|
|
|
94
|
-
|
|
103
|
+
registry.by_type(docid&.text&.match(/^\w+/)&.to_s)
|
|
95
104
|
end
|
|
96
105
|
|
|
97
106
|
private
|
|
@@ -104,7 +113,7 @@ module Relaton
|
|
|
104
113
|
def get_proc(docid)
|
|
105
114
|
return unless docid && docid[:type]
|
|
106
115
|
|
|
107
|
-
|
|
116
|
+
registry.by_type(docid[:type])
|
|
108
117
|
end
|
|
109
118
|
end
|
|
110
119
|
end
|
data/relaton-cli.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
|
|
11
11
|
spec.summary = "Relaton Command-line Interface"
|
|
12
12
|
spec.description = "Relaton Command-line Interface"
|
|
13
|
-
spec.homepage = "https://github.com/
|
|
13
|
+
spec.homepage = "https://github.com/relaton/relaton-cli"
|
|
14
14
|
spec.license = "BSD-2-Clause"
|
|
15
15
|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
24
24
|
|
|
25
25
|
spec.add_runtime_dependency "liquid", "~> 5"
|
|
26
|
-
spec.add_runtime_dependency "relaton", "
|
|
26
|
+
spec.add_runtime_dependency "relaton", ">= 3.0.0.pre.alpha"
|
|
27
27
|
spec.add_runtime_dependency "thor"
|
|
28
28
|
spec.add_runtime_dependency "thor-hollaback"
|
|
29
29
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: liquid
|
|
@@ -28,16 +27,16 @@ dependencies:
|
|
|
28
27
|
name: relaton
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - "
|
|
30
|
+
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
32
|
+
version: 3.0.0.pre.alpha
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - "
|
|
37
|
+
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
39
|
+
version: 3.0.0.pre.alpha
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
41
|
name: thor
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -87,8 +86,8 @@ executables:
|
|
|
87
86
|
- relaton
|
|
88
87
|
extensions: []
|
|
89
88
|
extra_rdoc_files:
|
|
90
|
-
- docs/README.adoc
|
|
91
89
|
- LICENSE
|
|
90
|
+
- docs/README.adoc
|
|
92
91
|
files:
|
|
93
92
|
- ".github/workflows/rake.yml"
|
|
94
93
|
- ".github/workflows/release.yml"
|
|
@@ -128,11 +127,10 @@ files:
|
|
|
128
127
|
- templates/_document.liquid
|
|
129
128
|
- templates/_index.liquid
|
|
130
129
|
- templates/index-style.css
|
|
131
|
-
homepage: https://github.com/
|
|
130
|
+
homepage: https://github.com/relaton/relaton-cli
|
|
132
131
|
licenses:
|
|
133
132
|
- BSD-2-Clause
|
|
134
133
|
metadata: {}
|
|
135
|
-
post_install_message:
|
|
136
134
|
rdoc_options: []
|
|
137
135
|
require_paths:
|
|
138
136
|
- lib
|
|
@@ -147,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
147
145
|
- !ruby/object:Gem::Version
|
|
148
146
|
version: '0'
|
|
149
147
|
requirements: []
|
|
150
|
-
rubygems_version:
|
|
151
|
-
signing_key:
|
|
148
|
+
rubygems_version: 4.0.16
|
|
152
149
|
specification_version: 4
|
|
153
150
|
summary: Relaton Command-line Interface
|
|
154
151
|
test_files: []
|