relaton-cli 1.9.0 → 1.9.1

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: a742751991033708b0285b4ae906c32c286c1f96c6187cf6ce3138ab866cbc56
4
- data.tar.gz: d8215fdf8f4a33f8f6d71e3dc5d5336395be5b5be958d59f1bd93d988ed8f035
3
+ metadata.gz: 39535b9c177165d658eeeab7b43592dbf2deb05575b3fec1ecb1502ec564b555
4
+ data.tar.gz: 8a7a53cc3d078fa0f9b26279f91f59cb521271b5d67d34fc006f81dabc326dca
5
5
  SHA512:
6
- metadata.gz: 9de6a8ec79b10ca88c674e38a5c6f39940b140e24e5e39f8572e65f8e9528d6ad848588ad1600fac67981f11835e610781f0093033ad6e29408c7f757ee786a3
7
- data.tar.gz: 8cb24d8a76dcd230706c74d51b0ec0bc4a7847042d1bd78a3cd5c30fff5f0a54405231ae90349ab06f9c5e640f89c84ef60e497b526063d57c3af92d98494c55
6
+ metadata.gz: 4a0e825551c8ec3fef0fca053352791d4d0747c22cf6fcf190af60e6a2e482bfced0c00623adb5c6a2671879d561337d1c2c6f16e82e034443653f25a3e0ed10
7
+ data.tar.gz: '0846c248faf4471db8a408a56101ac1ca543418365393b312c85492f281e3d3e085c8b25a7008c7075dad8e9e358e0aea8845e8336b1ef0eae0945aee9fffcf4'
data/docs/README.adoc CHANGED
@@ -54,7 +54,23 @@ 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 extract
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
+
70
+ Options:
71
+
72
+ * `DIR` - floder name to store documents (default `./data`).
73
+ * `FORMAT` - format in which the documents are saved. Possimle formats are: `yaml`, `xml` (default `yaml`).
58
74
 
59
75
  [source,console]
60
76
  ----
@@ -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"
@@ -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). 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,12 @@
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
+ processor.fetch_data source, options
7
+ end
8
+
9
+ extend DataFetcher
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cli
3
- VERSION = "1.9.0".freeze
3
+ VERSION = "1.9.1".freeze
4
4
  end
5
5
  end
data/relaton-cli.gemspec CHANGED
@@ -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.9.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.9.0
4
+ version: 1.9.1
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-26 00:00:00.000000000 Z
11
+ date: 2021-09-03 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.9.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.9.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