relaton-cli 1.7.pre3 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.adoc +2 -1
- data/lib/relaton/cli.rb +1 -0
- data/lib/relaton/cli/command.rb +12 -5
- data/lib/relaton/cli/subcommand_collection.rb +6 -3
- data/lib/relaton/cli/subcommand_db.rb +1 -0
- data/lib/relaton/cli/version.rb +1 -1
- data/relaton-cli.gemspec +2 -1
- metadata +23 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 117244541f4bff6b5e41ede9703dc58814cab590af276879ef90dddf1d10358e
|
4
|
+
data.tar.gz: 60102f93d726c6e5aa4d23faa0808c1b149648815d72773631df45c7736ff569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94dfb0dfcdc1091cb83145c5454fde257d34c69b5e4bf8f1399666bc45b3998f6419b068e4ba75fbf615ce4298537c522f2176f95dffeb6e1bccb73a4d9c869a
|
7
|
+
data.tar.gz: aa63575174009b87161354f447b4de6c3c1715d1bdd44d69ec43b53d5d849a7e9c69bdf6638df6a7383409b42d464517ee59ce79509a2429c7c96bc9573ba8f5
|
data/docs/README.adoc
CHANGED
@@ -10,6 +10,7 @@ Please refer to https://github.com/relaton/relaton.
|
|
10
10
|
|
11
11
|
== Commands
|
12
12
|
|
13
|
+
Each command has an option `--verbose` (short form is `-v`). Use the option to get warnings in the commands outpput.
|
13
14
|
The following commands are provided.
|
14
15
|
|
15
16
|
=== relaton concatenate
|
@@ -311,7 +312,7 @@ Import document or collection from XML `FILE` into `COLLECTION`.
|
|
311
312
|
|
312
313
|
=== Cache DB manipulation
|
313
314
|
|
314
|
-
==== Create
|
315
|
+
==== Create cache DB
|
315
316
|
|
316
317
|
----
|
317
318
|
$ relaton db create DIR
|
data/lib/relaton/cli.rb
CHANGED
data/lib/relaton/cli/command.rb
CHANGED
@@ -9,6 +9,8 @@ module Relaton
|
|
9
9
|
module Cli
|
10
10
|
class Command < Thor
|
11
11
|
include Relaton::Cli
|
12
|
+
class_before :relaton_config
|
13
|
+
class_option :verbose, aliases: :v, type: :boolean, desc: "Output warnings"
|
12
14
|
|
13
15
|
desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE"
|
14
16
|
option :type, aliases: :t, desc: "Type of standard to "\
|
@@ -24,7 +26,6 @@ module Relaton
|
|
24
26
|
"retries. Default 1."
|
25
27
|
|
26
28
|
def fetch(code)
|
27
|
-
# Relaton.db
|
28
29
|
io = IO.new(STDOUT.fcntl(::Fcntl::F_DUPFD), mode: "w:UTF-8")
|
29
30
|
io.puts(fetch_document(code, options) || supported_type_message)
|
30
31
|
end
|
@@ -43,8 +44,6 @@ module Relaton
|
|
43
44
|
option :title, aliases: :t, desc: "Title of resulting Relaton collection"
|
44
45
|
option :organization, aliases: :g, desc: "Organization owner of Relaton "\
|
45
46
|
"collection"
|
46
|
-
# option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
|
47
|
-
# "YAML format"
|
48
47
|
option :extension, aliases: :x, desc: "File extension of destination "\
|
49
48
|
"Relaton file, defaults to 'rxl'"
|
50
49
|
|
@@ -56,8 +55,6 @@ module Relaton
|
|
56
55
|
"Relaton Collection into multiple files"
|
57
56
|
option :extension, aliases: :x, default: "rxl", desc: "File extension "\
|
58
57
|
"of Relaton XML files, defaults to 'rxl'"
|
59
|
-
# option :new, aliases: :n, type: :boolean, desc: "Use the new Relaton "\
|
60
|
-
# "YAML format"
|
61
58
|
|
62
59
|
def split(source, outdir)
|
63
60
|
Relaton::Cli::RelatonFile.split(source, outdir, options)
|
@@ -149,6 +146,16 @@ module Relaton
|
|
149
146
|
|
150
147
|
desc "db SUBCOMMAND", "Cache DB manipulation"
|
151
148
|
subcommand "db", SubcommandDb
|
149
|
+
|
150
|
+
no_commands do
|
151
|
+
def relaton_config
|
152
|
+
log_types = %i[info error]
|
153
|
+
log_types << :warning if options[:verbose]
|
154
|
+
Relaton.configure do |conf|
|
155
|
+
conf.logs = log_types
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
152
159
|
end
|
153
160
|
|
154
161
|
private
|
@@ -3,6 +3,9 @@ require "relaton/cli/full_text_search"
|
|
3
3
|
module Relaton
|
4
4
|
module Cli
|
5
5
|
class SubcommandCollection < Thor
|
6
|
+
include Relaton::Cli
|
7
|
+
class_option :verbose, aliases: :v, type: :boolean, desc: "Output warnings"
|
8
|
+
|
6
9
|
desc "create COLLECTION", "Create collection"
|
7
10
|
option :dir, aliases: :d, desc: "Directory to store collection. Default "\
|
8
11
|
"is $HOME/.relaton/collections."
|
@@ -104,7 +107,7 @@ module Relaton
|
|
104
107
|
option :dir, aliases: :d, desc: "Directory with collections. Default is "\
|
105
108
|
"$HOME/.relaton/collections."
|
106
109
|
|
107
|
-
def fetch(code)
|
110
|
+
def fetch(code) # rubocop:disable Metrics/AbcSize
|
108
111
|
doc = Relaton.db.fetch(code, options[:year]&.to_s)
|
109
112
|
if doc
|
110
113
|
colfile = File.join directory, options[:collection]
|
@@ -117,8 +120,8 @@ module Relaton
|
|
117
120
|
|
118
121
|
desc "import FILE", "Import document or collection from an XML file "\
|
119
122
|
"into another collection"
|
120
|
-
option :collection, aliases: :c, required: true, desc: "Collection "\
|
121
|
-
"
|
123
|
+
option :collection, aliases: :c, required: true, desc: "Collection to "\
|
124
|
+
"store a document. If collection doesn't exist then it'll be created."
|
122
125
|
option :dir, aliases: :d, desc: "Directory with collections. Default is "\
|
123
126
|
"$HOME/.relaton/collections."
|
124
127
|
|
data/lib/relaton/cli/version.rb
CHANGED
data/relaton-cli.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency "webmock"
|
37
37
|
|
38
38
|
spec.add_runtime_dependency "liquid", "~> 4"
|
39
|
-
spec.add_runtime_dependency "relaton", "1.7.
|
39
|
+
spec.add_runtime_dependency "relaton", ">=1.7.7"
|
40
40
|
spec.add_runtime_dependency "thor"
|
41
|
+
spec.add_runtime_dependency "thor-hollaback"
|
41
42
|
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.7.
|
4
|
+
version: 1.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -168,16 +168,16 @@ dependencies:
|
|
168
168
|
name: relaton
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.7.
|
173
|
+
version: 1.7.7
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.7.
|
180
|
+
version: 1.7.7
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: thor
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +192,20 @@ dependencies:
|
|
192
192
|
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: thor-hollaback
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
195
209
|
description: Relaton Command-line Interface
|
196
210
|
email:
|
197
211
|
- open.source@ribose.com
|
@@ -251,11 +265,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
251
265
|
version: 2.4.0
|
252
266
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
267
|
requirements:
|
254
|
-
- - "
|
268
|
+
- - ">="
|
255
269
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
270
|
+
version: '0'
|
257
271
|
requirements: []
|
258
|
-
rubygems_version: 3.
|
272
|
+
rubygems_version: 3.0.6
|
259
273
|
signing_key:
|
260
274
|
specification_version: 4
|
261
275
|
summary: Relaton Command-line Interface
|