es_dump_restore 1.2.0 → 2.0.0

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
  SHA1:
3
- metadata.gz: a45b3f41110e68aa160d81d3094501b4db2d914a
4
- data.tar.gz: 127abfad968e31cfd7fb1ea1d933dd55d9497839
3
+ metadata.gz: 4fd3daa61667baf72f9f0c62fe8b6f71e0e5c5de
4
+ data.tar.gz: a9d1eb03b685529be48895e92a856443e8cec280
5
5
  SHA512:
6
- metadata.gz: 7a888f720b201ec78d4a6b1c2ca75033f2fd98e07838282a3180fe3a3488d8d39faa4971073f4e5b027049e0f01ec038ef0a274cf710a89f07856241e4c564e4
7
- data.tar.gz: ca426d7becd4d7f59d2708d926a38aae42a56a23a4bd9b2b7657f65c5f860897e4da5578175cbe971b04fd48d3898b5de19ff7d2a1fe3c40ff5e8fcc5f2d88cb
6
+ metadata.gz: 2a5728d62cfd999870e6d19b3ba4ad8350dce18d8ec860616c39d475cd01d39f27bf85fa429e4da75f6c2fb5d7c6d339c6a89289cc0a808f2aeaf67bc4d6e5d3
7
+ data.tar.gz: 6076595aba9cb8c3beec6259fd70fef81917ea8841115c7fb1c76e2e858c531b25f06d92fb0d785cf582c89095629e0387adaae34a63c6e5ef3591bd26b82c28
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # Version 2.0.0 - July 1, 2015
2
+
3
+ Thanks to Alex Tomlins for this feature contribution
4
+
5
+ * Make progress bar options globally available
6
+ * VERY MINOR BREAKING CHANGE: Invert the `--noprogressbar` option, which is now `--progressbar` or `--no-progress-bar`
7
+
1
8
  # Version 1.2.0 - June 24, 2015
2
9
 
3
10
  * Allow overriding the batch size on the command line (thanks to Richard Boulton once again!)
@@ -6,8 +6,11 @@ require "multi_json"
6
6
 
7
7
  module EsDumpRestore
8
8
  class App < Thor
9
-
10
- option :noprogressbar, :type => :boolean # switch for showing progress bar
9
+ class_option :progressbar,
10
+ type: :boolean,
11
+ default: $stderr.isatty,
12
+ desc: "Whether to show the progress bar. Defaults to true if STDERR is a TTY, false otherwise."
13
+
11
14
  option :verbose, :type => :boolean # add some additional output
12
15
 
13
16
  desc "dump URL INDEX_NAME FILENAME", "Creates a dumpfile based on the given ElasticSearch index"
@@ -22,13 +25,13 @@ module EsDumpRestore
22
25
 
23
26
  client.start_scan do |scroll_id, total|
24
27
  dumpfile.num_objects = total
25
- bar = ProgressBar.new(total) unless options[:noprogressbar]
28
+ bar = ProgressBar.new(total) if options[:progressbar]
26
29
 
27
30
  dumpfile.get_objects_output_stream do |out|
28
31
  client.each_scroll_hit(scroll_id) do |hit|
29
32
  metadata = { index: { _type: hit["_type"], _id: hit["_id"] } }
30
33
  out.write("#{MultiJson.dump(metadata)}\n#{MultiJson.dump(hit["_source"])}\n")
31
- bar.increment! unless options[:noprogressbar]
34
+ bar.increment! if options[:progressbar]
32
35
  end
33
36
  end
34
37
  end
@@ -47,13 +50,13 @@ module EsDumpRestore
47
50
 
48
51
  client.start_scan do |scroll_id, total|
49
52
  dumpfile.num_objects = total
50
- bar = ProgressBar.new(total) unless options[:noprogressbar]
53
+ bar = ProgressBar.new(total) if options[:progressbar]
51
54
 
52
55
  dumpfile.get_objects_output_stream do |out|
53
56
  client.each_scroll_hit(scroll_id) do |hit|
54
57
  metadata = { index: { _type: hit["_type"], _id: hit["_id"] } }
55
58
  out.write("#{MultiJson.dump(metadata)}\n#{MultiJson.dump(hit["_source"])}\n")
56
- bar.increment! unless options[:noprogressbar]
59
+ bar.increment! if options[:progressbar]
57
60
  end
58
61
  end
59
62
  end
@@ -67,10 +70,10 @@ module EsDumpRestore
67
70
  Dumpfile.read(filename) do |dumpfile|
68
71
  client.create_index(dumpfile.index, overrides)
69
72
 
70
- bar = ProgressBar.new(dumpfile.num_objects) unless options[:noprogressbar]
73
+ bar = ProgressBar.new(dumpfile.num_objects) if options[:progressbar]
71
74
  dumpfile.scan_objects(batch_size.to_i) do |batch, size|
72
75
  client.bulk_index batch
73
- bar.increment!(size) unless options[:noprogressbar]
76
+ bar.increment!(size) if options[:progressbar]
74
77
  end
75
78
  end
76
79
  end
@@ -84,10 +87,10 @@ module EsDumpRestore
84
87
  Dumpfile.read(filename) do |dumpfile|
85
88
  client.create_index(dumpfile.index, overrides)
86
89
 
87
- bar = ProgressBar.new(dumpfile.num_objects) unless options[:noprogressbar]
90
+ bar = ProgressBar.new(dumpfile.num_objects) if options[:progressbar]
88
91
  dumpfile.scan_objects(batch_size.to_i) do |batch, size|
89
92
  client.bulk_index batch
90
- bar.increment!(size) unless options[:noprogressbar]
93
+ bar.increment!(size) if options[:progressbar]
91
94
  end
92
95
  end
93
96
 
@@ -1,3 +1,3 @@
1
1
  module EsDumpRestore
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: es_dump_restore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Budin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json