relaton-cli 1.8.2 → 1.9.3

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: 4cbb72fe1858ab6501f431377716305f5a597c75d53cec88d9185423d6c97125
4
- data.tar.gz: dd0189d20b1c61df323ba73029c305bf2867c51397c5bf27c36aaeee3a3408d0
3
+ metadata.gz: 8bae2b8248683a44779dd5aa26bebb771457a250ed4cd7ed593622505e6f0e62
4
+ data.tar.gz: 7bd70875874902cea3dd3c0b2098dc8d1f4b48583b07ada0e014a2e3f04f2aac
5
5
  SHA512:
6
- metadata.gz: bed73ee60f00ca3d9f0ea1aee4638969fb339862f1877cf027fd97c7ea7d95ab1df8d96a38ea4d10edda948222ea6b2df145dbf41cf4a06f9afbd071a68e79b2
7
- data.tar.gz: b595d3c7c8c9d8d47c3a06f14fd8807fe03dcfa14ccb503aa9e63701e3e392b5c3afced86907e7ba1fea929e8bcc37da51e2ceb1a47d7a5c21cbe028dd0c6e3d
6
+ metadata.gz: c87d54b87fe81b7950b7977c31bd35e29fcb297d456575f654ba8485dee0b36afdad9e304d92c4c64cb2a0abedb982e6c93a05f102e4356e50a983aa01985d33
7
+ data.tar.gz: a501917c8cfa0772a18a12742acde2efe4195f56019fd4b524fd9bf718dc65a8083c4682be3aa1fa9ff22fec8753e926eefa0585da3b09037a24e0f89b1647e3
data/docs/README.adoc CHANGED
@@ -54,6 +54,30 @@ Fetch the Relaton XML entry corresponding to the document identifier `CODE`.
54
54
  * `--all-parts` fetch all parts.
55
55
  * `--keep-year` undated reference should return actual reference with year.
56
56
 
57
+ === relaton fetch-data
58
+
59
+ [source,console]
60
+ ----
61
+ $ relaton fetch-data DATASET -o DIR -f FORMAT
62
+ ----
63
+
64
+ Fetch all the documents from a `DATASET` source and save them to a folder `DIR` in format `FORMAT`.
65
+
66
+ Foloowing datasets are availabe:
67
+
68
+ * `nist-tech-pubs` - https://raw.githubusercontent.com/usnistgov/NIST-Tech-Pubs/nist-pages/xml/allrecords.xml
69
+ * `cie-techstreet` - https://www.techstreet.com/cie/searches/31156444
70
+ * `calconnect-org` - https://standards.calconnect.org/relaton/index.yaml
71
+ * `ogc-naming-authority` - https://raw.githubusercontent.com/opengeospatial/NamingAuthority/master/incubation/bibliography/bibliography.json
72
+ * `ieee-rawbib` - looks for the IEEE dataset in local `./ieee-rawbib` directory. The dataset could be downloaded from https://github.com/ietf-ribose/ieee-rawbib repository
73
+ * `w3c-rdf` - http://www.w3.org/2002/01/tr-automation/tr.rdf
74
+ * `iana-registries` - https://github.com/ietf-ribose/iana-registries
75
+
76
+ Options:
77
+
78
+ * `DIR` - floder name to store documents (default `./data`).
79
+ * `FORMAT` - format in which the documents are saved. Possimle formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
80
+
57
81
  === relaton extract
58
82
 
59
83
  [source,console]
@@ -310,38 +334,38 @@ Import document or collection from XML `FILE` into `COLLECTION`.
310
334
  * `COLLECTION` is optional. If collection doesn't exist then it will be created.
311
335
  * `DIRECTORY` is optional, and specifies path to a directory with collections. Default is `$HOME/.relaton/collections`.
312
336
 
313
- === Cache DB manipulation
337
+ === Dadabase manipulation
314
338
 
315
- ==== Create cache DB
339
+ ==== Create database
316
340
 
317
341
  ----
318
342
  $ relaton db create DIR
319
343
  ----
320
344
 
321
- Creates a new cache DB in a directory `DIR` (optional, deafult is `/home/USER/.relaton/dbpath`). In case the target directory exists it will be used as a cache DB.
345
+ Creates a new database in a directory `DIR` (optional, deafult is `/home/USER/.relaton/dbpath`). In case the target directory exists it will be used as a database.
322
346
 
323
347
  ----
324
348
  $ relaton db create
325
- Cache DB is in "/Users/user/.relaton/cache"
349
+ Database is in "/Users/user/.relaton/cache"
326
350
 
327
351
  $ relaton db create cachedb
328
- Cache DB is in "/Users/user/RubyProjects/relaton-cli/cachedb"
352
+ Database is in "/Users/user/RubyProjects/relaton-cli/cachedb"
329
353
  ----
330
354
 
331
- ==== Move cache DB
355
+ ==== Move database
332
356
 
333
357
  ----
334
358
  $ relaton db mv DIR
335
359
  ----
336
360
 
337
- Move cache DB to another place `DIR`.
361
+ Move database to another place `DIR`.
338
362
 
339
363
  ----
340
364
  $ relaton db mv cache_dir
341
- Cache DB is moved to "/Users/user/RubyProjects/relaton-cli/cache_dir"
365
+ Database is moved to "/Users/user/RubyProjects/relaton-cli/cache_dir"
342
366
  ----
343
367
 
344
- ==== Clear cache DB
368
+ ==== Clear database
345
369
 
346
370
  Delete all entries from a chache DB.
347
371
 
@@ -349,13 +373,13 @@ Delete all entries from a chache DB.
349
373
  $ relaton db clear
350
374
  ----
351
375
 
352
- ==== Fetch from cache DB
376
+ ==== Fetch from database
353
377
 
354
378
  ----
355
379
  $ relaton db fetch -t TYPE -f FORMAT -y YEAR
356
380
  ----
357
381
 
358
- Fetch an entry from a cache DB. See [relaton fetch](#relaton-fetch) for the arguments explanation.
382
+ Fetch an entry from a database. See [relaton fetch](#relaton-fetch) for the arguments explanation.
359
383
 
360
384
  ==== Fetch all
361
385
 
@@ -1,6 +1,7 @@
1
1
  require "relaton/cli/relaton_file"
2
2
  require "relaton/cli/xml_convertor"
3
3
  require "relaton/cli/yaml_convertor"
4
+ require "relaton/cli/data_fetcher"
4
5
  require "relaton/cli/subcommand_collection"
5
6
  require "relaton/cli/subcommand_db"
6
7
  require "fcntl"
@@ -14,14 +15,14 @@ module Relaton
14
15
 
15
16
  desc "fetch CODE", "Fetch Relaton XML for Standard identifier CODE"
16
17
  option :type, aliases: :t, desc: "Type of standard to "\
17
- "get bibliographic entry for"
18
+ "get bibliographic entry for"
18
19
  option :format, aliases: :f, desc: "Output format (xml, yaml, bibtex). "\
19
- "Default xml."
20
+ "Default xml."
20
21
  option :year, aliases: :y, type: :numeric, desc: "Year the standard was "\
21
- "published"
22
+ "published"
22
23
  option :"all-parts", type: :boolean, desc: "Fetch all parts"
23
24
  option :"keep-year", type: :boolean, desc: "Undated reference should "\
24
- "return actual reference with year"
25
+ "return actual reference with year"
25
26
  option :retries, aliases: :r, type: :numeric, desc: "Number of network "\
26
27
  "retries. Default 1."
27
28
 
@@ -43,7 +44,7 @@ module Relaton
43
44
  "DIRECTORY (containing Relaton-XML or YAML) into a Relaton Collection"
44
45
  option :title, aliases: :t, desc: "Title of resulting Relaton collection"
45
46
  option :organization, aliases: :g, desc: "Organization owner of Relaton "\
46
- "collection"
47
+ "collection"
47
48
  option :extension, aliases: :x, desc: "File extension of destination "\
48
49
  "Relaton file, defaults to 'rxl'"
49
50
 
@@ -61,15 +62,15 @@ module Relaton
61
62
  end
62
63
 
63
64
  desc "yaml2xml YAML", "Convert Relaton YAML into Relaton Collection XML "\
64
- "or separate files"
65
+ "or separate files"
65
66
  option :extension, aliases: :x, default: "rxl", desc: "File extension "\
66
67
  "of Relaton XML files, defaults to 'rxl'"
67
68
  option :prefix, aliases: :p, desc: "Filename prefix of individual "\
68
- "Relaton XML files, defaults to empty"
69
+ "Relaton XML files, defaults to empty"
69
70
  option :outdir, aliases: :o, desc: "Output to the specified directory "\
70
71
  "with individual Relaton Bibdata XML files"
71
72
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY "\
72
- "prior to execution"
73
+ "prior to execution"
73
74
  option :overwrite, aliases: :f, type: :boolean, default: false,
74
75
  desc: "Overwrite the existing file"
75
76
 
@@ -78,15 +79,15 @@ module Relaton
78
79
  end
79
80
 
80
81
  desc "xml2yaml XML", "Convert Relaton XML into Relaton Bibdata / "\
81
- "Bibcollection YAML (and separate files)"
82
+ "Bibcollection YAML (and separate files)"
82
83
  option :extension, aliases: :x, default: "yaml", desc: "File extension "\
83
84
  "of Relaton YAML files, defaults to 'yaml'"
84
85
  option :prefix, aliases: :p, desc: "Filename prefix of Relaton XML "\
85
- "files, defaults to empty"
86
+ "files, defaults to empty"
86
87
  option :outdir, aliases: :o, desc: "Output to the specified directory "\
87
- "with individual Relaton Bibdata YAML files"
88
+ "with individual Relaton Bibdata YAML files"
88
89
  option :require, aliases: :r, type: :array, desc: "Require LIBRARY "\
89
- "prior to execution"
90
+ "prior to execution"
90
91
  option :overwrite, aliases: :f, type: :boolean, default: false,
91
92
  desc: "Overwrite the existing file"
92
93
 
@@ -95,9 +96,9 @@ module Relaton
95
96
  end
96
97
 
97
98
  desc "xml2html RELATON-INDEX-XML", "Convert Relaton Collection XML into "\
98
- "HTML"
99
+ "HTML"
99
100
  option :stylesheet, aliases: :s, desc: "Stylesheet file path for "\
100
- "rendering HTML index"
101
+ "rendering HTML index"
101
102
  option :templatedir, aliases: :t, desc: "Liquid template directory for "\
102
103
  "rendering Relaton items and collection"
103
104
  option :overwrite, aliases: :f, type: :boolean, default: false,
@@ -108,9 +109,9 @@ module Relaton
108
109
  end
109
110
 
110
111
  desc "yaml2html RELATON-INDEX-YAML", "Concatenate Relaton Collection "\
111
- "YAML into HTML"
112
+ "YAML into HTML"
112
113
  option :stylesheet, aliases: :s, desc: "Stylesheet file path for "\
113
- "rendering HTML index"
114
+ "rendering HTML index"
114
115
  option :templatedir, aliases: :t, desc: "Liquid template directory for "\
115
116
  "rendering Relaton items and collection"
116
117
  option :overwrite, aliases: :f, type: :boolean, default: false,
@@ -141,6 +142,14 @@ module Relaton
141
142
  File.write output, result, encoding: "UTF-8"
142
143
  end
143
144
 
145
+ desc "fetch-data SOURCE", "Fetch all the documents from a source"
146
+ option :output, aliases: :o, desc: "Output dir. Default: ./data/"
147
+ option :format, aliases: :f, desc: "Output format (yaml, xml, bibxml). Default: yaml"
148
+
149
+ def fetch_data(source)
150
+ DataFetcher.fetch source, options
151
+ end
152
+
144
153
  desc "collection SUBCOMMAND", "Collection manipulations"
145
154
  subcommand "collection", SubcommandCollection
146
155
 
@@ -0,0 +1,15 @@
1
+ module Relaton
2
+ module Cli
3
+ module DataFetcher
4
+ def fetch(source, options)
5
+ processor = Relaton::Registry.instance.find_processor_by_dataset source
6
+ opts = {}
7
+ opts[:output] = options[:output] if options[:output]
8
+ opts[:format] = options[:format] if options[:format]
9
+ processor.fetch_data source, opts
10
+ end
11
+
12
+ extend DataFetcher
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cli
3
- VERSION = "1.8.2".freeze
3
+ VERSION = "1.9.3".freeze
4
4
  end
5
5
  end
data/relaton-cli.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "exe"
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
- spec.required_ruby_version = ">= 2.4.0"
23
+ spec.required_ruby_version = ">= 2.5.0"
24
24
 
25
25
  spec.add_development_dependency "byebug", "~> 11.0"
26
26
  # spec.add_development_dependency "debase"
@@ -36,7 +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.8.0"
39
+ spec.add_runtime_dependency "relaton", ">= 1.9.1"
40
40
  spec.add_runtime_dependency "thor"
41
41
  spec.add_runtime_dependency "thor-hollaback"
42
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.8.2
4
+ version: 1.9.3
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-08-16 00:00:00.000000000 Z
11
+ date: 2021-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 1.8.0
173
+ version: 1.9.1
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.8.0
180
+ version: 1.9.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: thor
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -237,6 +237,7 @@ files:
237
237
  - lib/relaton/cli.rb
238
238
  - lib/relaton/cli/base_convertor.rb
239
239
  - lib/relaton/cli/command.rb
240
+ - lib/relaton/cli/data_fetcher.rb
240
241
  - lib/relaton/cli/full_text_search.rb
241
242
  - lib/relaton/cli/relaton_file.rb
242
243
  - lib/relaton/cli/subcommand_collection.rb
@@ -262,7 +263,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
263
  requirements:
263
264
  - - ">="
264
265
  - !ruby/object:Gem::Version
265
- version: 2.4.0
266
+ version: 2.5.0
266
267
  required_rubygems_version: !ruby/object:Gem::Requirement
267
268
  requirements:
268
269
  - - ">="