relaton-cli 1.15.2 → 1.15.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -0
- data/.github/workflows/release.yml +3 -2
- data/docs/README.adoc +33 -0
- data/lib/relaton/cli/command.rb +45 -43
- data/lib/relaton/cli/subcommand_db.rb +16 -15
- data/lib/relaton/cli/version.rb +1 -1
- data/lib/relaton/cli.rb +14 -0
- data/relaton-cli.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 244e033b7cdff373ffcc0a1532253f5449a923b5396dd56c69642c0d5d5b7576
|
4
|
+
data.tar.gz: 3283bfe1d9b4d41485ff1d920174ce7b7ffb7bc948084c600374320cd805b766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e26d7cf55198f3337eb1805b74b57889da7378a932396cfe1fd98a1285c2a437973eda1abb20edeb4783fd55b3076ac4b546a2358e687c6aa4cefd4392b73fd
|
7
|
+
data.tar.gz: 89b3aa3f8469b98b96bd5e541e3aa123d65e6491e9a3df925dab4093b1d11c93ead3ef4f8f7d91452f17dfb0318314e25ec22e9d9cd45515ad9a72c2e8cc7b0c
|
data/.github/workflows/rake.yml
CHANGED
data/docs/README.adoc
CHANGED
@@ -81,6 +81,7 @@ The following datasets are available:
|
|
81
81
|
* `oasis-open` - https://www.oasis-open.org/standards/
|
82
82
|
* `bipm-data-outcomes` - looks for the BIPM dataset in the local `./bipm-data-outcomes` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-data-outcomes repository
|
83
83
|
* `si-brochure` - looks for the SI-Brochure dataset in the local `./bipm-si-brocure` directory. The dataset could be downloaded from https://github.com/metanorma/bipm-si-brochure repository
|
84
|
+
* `ecma-standards` - https://www.ecma-international.org/publications/standards/
|
84
85
|
|
85
86
|
Options:
|
86
87
|
|
@@ -254,6 +255,38 @@ $ relaton convert XML -f FORMAT -o OUTPUT-FILE
|
|
254
255
|
|
255
256
|
Convert a Relaton XML document into YAML, AsciiBib, or BibTex format. Allowed -f or --format options are yaml, asciibib, bibtex. If the option -o or --output is omitted then a new file will be created in the folder where the original file is, with the same name but another appropriated extension.
|
256
257
|
|
258
|
+
=== relaton version
|
259
|
+
----
|
260
|
+
$ relaton version
|
261
|
+
CLI => 1.15.3
|
262
|
+
relaton => 1.15.1
|
263
|
+
relaton-bib => 1.14.11
|
264
|
+
relaton-iso-bib => 1.14.0
|
265
|
+
relaton-gb => 1.14.0
|
266
|
+
relaton-iec => 1.14.3
|
267
|
+
relaton-ietf => 1.14.3
|
268
|
+
relaton-iso => 1.15.1
|
269
|
+
relaton-itu => 1.14.1
|
270
|
+
relaton-nist => 1.14.3
|
271
|
+
relaton-ogc => 1.14.1
|
272
|
+
relaton-calconnect => 1.14.0
|
273
|
+
relaton-omg => 1.14.0
|
274
|
+
relaton-un => 1.14.1
|
275
|
+
relaton-w3c => 1.14.1
|
276
|
+
relaton-ieee => 1.14.6
|
277
|
+
relaton-iho => 1.14.2
|
278
|
+
relaton-bipm => 1.14.6
|
279
|
+
relaton-ecma => 1.14.1
|
280
|
+
relaton-cie => 1.14.0
|
281
|
+
relaton-bsi => 1.14.5
|
282
|
+
relaton-cen => 1.14.0
|
283
|
+
relaton-iana => 1.14.1
|
284
|
+
relaton-3gpp => 1.14.3
|
285
|
+
relaton-oasis => 1.14.2
|
286
|
+
relaton-doi => 1.14.3
|
287
|
+
relaton-jis => 1.14.1
|
288
|
+
----
|
289
|
+
|
257
290
|
=== relaton collection
|
258
291
|
|
259
292
|
The `relaton collection` is a set of subcommands for collections manipulations.
|
data/lib/relaton/cli/command.rb
CHANGED
@@ -13,18 +13,23 @@ module Relaton
|
|
13
13
|
class_before :relaton_config
|
14
14
|
class_option :verbose, aliases: :v, type: :boolean, desc: "Output warnings"
|
15
15
|
|
16
|
+
desc "version", "Show Relaton version"
|
17
|
+
|
18
|
+
def version
|
19
|
+
Relaton::Cli.version
|
20
|
+
end
|
21
|
+
|
16
22
|
desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE"
|
17
|
-
option :type, aliases: :t, desc: "Type of standard to "\
|
23
|
+
option :type, aliases: :t, desc: "Type of standard to " \
|
18
24
|
"get bibliographic entry for"
|
19
|
-
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
|
25
|
+
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). " \
|
20
26
|
"Default xml."
|
21
|
-
option :year, aliases: :y, type: :numeric, desc: "Year the standard was "
|
22
|
-
"published"
|
27
|
+
option :year, aliases: :y, type: :numeric, desc: "Year the standard was published"
|
23
28
|
option :"all-parts", type: :boolean, desc: "Fetch all parts"
|
24
|
-
option :"keep-year", type: :boolean, desc: "Undated reference should "\
|
29
|
+
option :"keep-year", type: :boolean, desc: "Undated reference should " \
|
25
30
|
"return actual reference with year"
|
26
|
-
option :retries, aliases: :r, type: :numeric, desc: "Number of network "\
|
27
|
-
|
31
|
+
option :retries, aliases: :r, type: :numeric, desc: "Number of network " \
|
32
|
+
"retries. Default 1."
|
28
33
|
|
29
34
|
def fetch(code)
|
30
35
|
io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
|
@@ -33,43 +38,42 @@ module Relaton
|
|
33
38
|
|
34
39
|
desc "extract Metanorma-XML-File / Directory Relaton-XML-Directory",
|
35
40
|
"Extract Relaton XML from Metanorma XML file / directory"
|
36
|
-
option :extension, aliases: :x, default: "rxl", desc: "File extension "\
|
37
|
-
|
41
|
+
option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, " \
|
42
|
+
"defaults to 'rxl'"
|
38
43
|
|
39
44
|
def extract(source_dir, outdir)
|
40
45
|
Relaton::Cli::RelatonFile.extract(source_dir, outdir, options)
|
41
46
|
end
|
42
47
|
|
43
|
-
desc "concatenate SOURCE-DIR COLLECTION-FILE",
|
44
|
-
|
48
|
+
desc "concatenate SOURCE-DIR COLLECTION-FILE",
|
49
|
+
"Concatenate entries in DIRECTORY (containing Relaton-XML or YAML) into a Relaton Collection"
|
45
50
|
option :title, aliases: :t, desc: "Title of resulting Relaton collection"
|
46
|
-
option :organization, aliases: :g, desc: "Organization owner of Relaton "
|
47
|
-
|
48
|
-
|
49
|
-
"Relaton file, defaults to 'rxl'"
|
51
|
+
option :organization, aliases: :g, desc: "Organization owner of Relaton collection"
|
52
|
+
option :extension, aliases: :x, desc: "File extension of destination " \
|
53
|
+
"Relaton file, defaults to 'rxl'"
|
50
54
|
|
51
55
|
def concatenate(source_dir, outfile)
|
52
56
|
Relaton::Cli::RelatonFile.concatenate(source_dir, outfile, options)
|
53
57
|
end
|
54
58
|
|
55
|
-
desc "split Relaton-Collection-File Relaton-XML-Directory",
|
56
|
-
|
57
|
-
option :extension, aliases: :x, default: "rxl", desc: "File extension "\
|
58
|
-
|
59
|
+
desc "split Relaton-Collection-File Relaton-XML-Directory",
|
60
|
+
"Split a Relaton Collection into multiple files"
|
61
|
+
option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, " \
|
62
|
+
"defaults to 'rxl'"
|
59
63
|
|
60
64
|
def split(source, outdir)
|
61
65
|
Relaton::Cli::RelatonFile.split(source, outdir, options)
|
62
66
|
end
|
63
67
|
|
64
|
-
desc "yaml2xml YAML", "Convert Relaton YAML into Relaton Collection XML "\
|
68
|
+
desc "yaml2xml YAML", "Convert Relaton YAML into Relaton Collection XML " \
|
65
69
|
"or separate files"
|
66
|
-
option :extension, aliases: :x, default: "rxl", desc: "File extension "\
|
67
|
-
|
68
|
-
option :prefix, aliases: :p, desc: "Filename prefix of individual "\
|
70
|
+
option :extension, aliases: :x, default: "rxl", desc: "File extension of Relaton XML files, " \
|
71
|
+
"defaults to 'rxl'"
|
72
|
+
option :prefix, aliases: :p, desc: "Filename prefix of individual " \
|
69
73
|
"Relaton XML files, defaults to empty"
|
70
|
-
option :outdir, aliases: :o, desc: "Output to the specified directory "\
|
71
|
-
|
72
|
-
option :require, aliases: :r, type: :array, desc: "Require LIBRARY "\
|
74
|
+
option :outdir, aliases: :o, desc: "Output to the specified directory " \
|
75
|
+
"with individual Relaton Bibdata XML files"
|
76
|
+
option :require, aliases: :r, type: :array, desc: "Require LIBRARY " \
|
73
77
|
"prior to execution"
|
74
78
|
option :overwrite, aliases: :f, type: :boolean, default: false,
|
75
79
|
desc: "Overwrite the existing file"
|
@@ -78,15 +82,15 @@ module Relaton
|
|
78
82
|
Relaton::Cli::YAMLConvertor.to_xml(filename, options)
|
79
83
|
end
|
80
84
|
|
81
|
-
desc "xml2yaml XML", "Convert Relaton XML into Relaton Bibdata / "\
|
85
|
+
desc "xml2yaml XML", "Convert Relaton XML into Relaton Bibdata / " \
|
82
86
|
"Bibcollection YAML (and separate files)"
|
83
|
-
option :extension, aliases: :x, default: "yaml", desc: "File extension "\
|
84
|
-
|
85
|
-
option :prefix, aliases: :p, desc: "Filename prefix of Relaton XML "\
|
87
|
+
option :extension, aliases: :x, default: "yaml", desc: "File extension of Relaton YAML files, " \
|
88
|
+
"defaults to 'yaml'"
|
89
|
+
option :prefix, aliases: :p, desc: "Filename prefix of Relaton XML " \
|
86
90
|
"files, defaults to empty"
|
87
|
-
option :outdir, aliases: :o, desc: "Output to the specified directory "\
|
91
|
+
option :outdir, aliases: :o, desc: "Output to the specified directory " \
|
88
92
|
"with individual Relaton Bibdata YAML files"
|
89
|
-
option :require, aliases: :r, type: :array, desc: "Require LIBRARY "\
|
93
|
+
option :require, aliases: :r, type: :array, desc: "Require LIBRARY " \
|
90
94
|
"prior to execution"
|
91
95
|
option :overwrite, aliases: :f, type: :boolean, default: false,
|
92
96
|
desc: "Overwrite the existing file"
|
@@ -95,12 +99,11 @@ module Relaton
|
|
95
99
|
Relaton::Cli::XMLConvertor.to_yaml(filename, options)
|
96
100
|
end
|
97
101
|
|
98
|
-
desc "xml2html RELATON-INDEX-XML", "Convert Relaton Collection XML into "
|
99
|
-
|
100
|
-
option :stylesheet, aliases: :s, desc: "Stylesheet file path for "\
|
102
|
+
desc "xml2html RELATON-INDEX-XML", "Convert Relaton Collection XML into HTML"
|
103
|
+
option :stylesheet, aliases: :s, desc: "Stylesheet file path for " \
|
101
104
|
"rendering HTML index"
|
102
|
-
option :templatedir, aliases: :t, desc: "Liquid template directory for "\
|
103
|
-
|
105
|
+
option :templatedir, aliases: :t, desc: "Liquid template directory for " \
|
106
|
+
"rendering Relaton items and collection"
|
104
107
|
option :overwrite, aliases: :f, type: :boolean, default: false,
|
105
108
|
desc: "Overwrite the existing file"
|
106
109
|
|
@@ -108,12 +111,12 @@ module Relaton
|
|
108
111
|
Relaton::Cli::XMLConvertor.to_html(file, style, template)
|
109
112
|
end
|
110
113
|
|
111
|
-
desc "yaml2html RELATON-INDEX-YAML", "Concatenate Relaton Collection "\
|
114
|
+
desc "yaml2html RELATON-INDEX-YAML", "Concatenate Relaton Collection " \
|
112
115
|
"YAML into HTML"
|
113
|
-
option :stylesheet, aliases: :s, desc: "Stylesheet file path for "\
|
116
|
+
option :stylesheet, aliases: :s, desc: "Stylesheet file path for " \
|
114
117
|
"rendering HTML index"
|
115
|
-
option :templatedir, aliases: :t, desc: "Liquid template directory for "\
|
116
|
-
|
118
|
+
option :templatedir, aliases: :t, desc: "Liquid template directory for " \
|
119
|
+
"rendering Relaton items and collection"
|
117
120
|
option :overwrite, aliases: :f, type: :boolean, default: false,
|
118
121
|
desc: "Overwrite the existing file"
|
119
122
|
|
@@ -122,8 +125,7 @@ module Relaton
|
|
122
125
|
end
|
123
126
|
|
124
127
|
desc "convert XML", "Convert Relaton XML document"
|
125
|
-
option :format, aliases: :f, required: true, desc: "Output format "
|
126
|
-
"(yaml, bibtex, asciibib)"
|
128
|
+
option :format, aliases: :f, required: true, desc: "Output format (yaml, bibtex, asciibib)"
|
127
129
|
option :output, aliases: :o, desc: "Output to the specified file"
|
128
130
|
|
129
131
|
def convert(file) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
@@ -4,8 +4,8 @@ module Relaton
|
|
4
4
|
include Relaton::Cli
|
5
5
|
class_option :verbose, aliases: :v, type: :boolean, desc: "Output warnings"
|
6
6
|
|
7
|
-
desc "create DIR", "Create new cache DB. Default DIR is "\
|
8
|
-
|
7
|
+
desc "create DIR", "Create new cache DB. Default DIR is " \
|
8
|
+
"/home/user/.relaon/cache/"
|
9
9
|
|
10
10
|
def create(dir = nil)
|
11
11
|
db = Relaton.db (dir && File.expand_path(dir))
|
@@ -27,18 +27,19 @@ module Relaton
|
|
27
27
|
desc "clear", "Clear cache DB"
|
28
28
|
|
29
29
|
def clear
|
30
|
-
Relaton.db
|
30
|
+
db = Relaton.db
|
31
|
+
db.clear
|
31
32
|
warn "Cache DB is cleared"
|
32
33
|
end
|
33
34
|
|
34
|
-
desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE
|
35
|
-
|
36
|
-
option :type, aliases: :t, desc: "Type of standard to "\
|
37
|
-
|
38
|
-
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
|
39
|
-
|
40
|
-
option :year, aliases: :y, type: :numeric, desc: "Year the standard
|
41
|
-
|
35
|
+
desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE " \
|
36
|
+
"from cache DB"
|
37
|
+
option :type, aliases: :t, desc: "Type of standard to " \
|
38
|
+
"get bibliographic entry for"
|
39
|
+
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). " \
|
40
|
+
"Default xml."
|
41
|
+
option :year, aliases: :y, type: :numeric, desc: "Year the standard " \
|
42
|
+
"was published"
|
42
43
|
|
43
44
|
def fetch(code)
|
44
45
|
io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
|
@@ -46,12 +47,12 @@ module Relaton
|
|
46
47
|
io.puts(fetch_document(code, opts) || supported_type_message)
|
47
48
|
end
|
48
49
|
|
49
|
-
desc "fetch_all TEXT", "Query for all documents in a cache DB for a "\
|
50
|
-
|
50
|
+
desc "fetch_all TEXT", "Query for all documents in a cache DB for a " \
|
51
|
+
"certain string"
|
51
52
|
option :edition, aliases: :e, desc: "Filter entries by edition"
|
52
53
|
option :year, aliases: :y, desc: "Filter entries by year"
|
53
|
-
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
|
54
|
-
|
54
|
+
option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). " \
|
55
|
+
"Default xml."
|
55
56
|
|
56
57
|
def fetch_all(text = nil) # rubocop:disable Metrics/AbcSize
|
57
58
|
io = IO.new($stdout.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
|
data/lib/relaton/cli/version.rb
CHANGED
data/lib/relaton/cli.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "thor"
|
2
2
|
require "thor/hollaback"
|
3
3
|
require "relaton"
|
4
|
+
require "relaton/cli/version"
|
4
5
|
require_relative "cli/command"
|
5
6
|
|
6
7
|
module Relaton
|
@@ -37,6 +38,19 @@ module Relaton
|
|
37
38
|
end
|
38
39
|
|
39
40
|
class << self
|
41
|
+
def version
|
42
|
+
registry = Relaton::Registry.instance
|
43
|
+
puts "CLI => #{Relaton::Cli::VERSION}"
|
44
|
+
puts "relaton => #{Relaton::VERSION}"
|
45
|
+
puts "relaton-bib => #{RelatonBib::VERSION}"
|
46
|
+
puts "relaton-iso-bib => #{RelatonIsoBib::VERSION}"
|
47
|
+
registry.processors.each_key do |k|
|
48
|
+
klass = "#{k.to_s.split('_').map(&:capitalize).join}::VERSION"
|
49
|
+
version = Kernel.const_get(klass)
|
50
|
+
puts "#{k.to_s.sub('_', '-')} => #{version}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
40
54
|
def start(arguments)
|
41
55
|
Relaton::Cli::Command.start(arguments)
|
42
56
|
end
|
data/relaton-cli.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "rspec-core", "~> 3.4"
|
30
30
|
|
31
31
|
spec.add_runtime_dependency "liquid", "~> 5"
|
32
|
-
spec.add_runtime_dependency "relaton", "~> 1.15.
|
32
|
+
spec.add_runtime_dependency "relaton", "~> 1.15.2"
|
33
33
|
spec.add_runtime_dependency "thor"
|
34
34
|
spec.add_runtime_dependency "thor-hollaback"
|
35
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.4
|
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: 2023-
|
11
|
+
date: 2023-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.15.
|
103
|
+
version: 1.15.2
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.15.
|
110
|
+
version: 1.15.2
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: thor
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,7 +186,7 @@ homepage: https://github.com/metanorma/relaton-cli
|
|
186
186
|
licenses:
|
187
187
|
- BSD-2-Clause
|
188
188
|
metadata: {}
|
189
|
-
post_install_message:
|
189
|
+
post_install_message:
|
190
190
|
rdoc_options: []
|
191
191
|
require_paths:
|
192
192
|
- lib
|
@@ -201,8 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
|
-
rubygems_version: 3.
|
205
|
-
signing_key:
|
204
|
+
rubygems_version: 3.4.9
|
205
|
+
signing_key:
|
206
206
|
specification_version: 4
|
207
207
|
summary: Relaton Command-line Interface
|
208
208
|
test_files: []
|