elastics-client 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/elastics/prog_bar.rb +14 -11
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.9
|
data/lib/elastics/prog_bar.rb
CHANGED
@@ -33,28 +33,31 @@ module Elastics
|
|
33
33
|
attr_reader :pbar, :total_count
|
34
34
|
|
35
35
|
def initialize(total_count, batch_size=nil, prefix_message=nil)
|
36
|
-
bar_style = [:green, :reversed, :bold]
|
37
36
|
@successful_count = 0
|
38
37
|
@failed_count = 0
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
# we use the title to pass the sgr start style codes
|
39
|
+
start_style = Dye.color? ? "#{Dye.sgr(:clear, :green, :reversed, :bold)} " : ''
|
40
|
+
format = '%t%c/%C %p%% %E %b'
|
41
|
+
format += Dye.sgr(:clear) if Dye.color?
|
42
|
+
progress_mark = Dye.color? ? ' ' : '|'
|
43
|
+
@pbar = ::ProgressBar.create(:title => start_style,
|
44
|
+
:total => total_count,
|
45
|
+
:progress_mark => progress_mark,
|
46
|
+
:format => format )
|
45
47
|
@pbar.clear
|
46
|
-
|
48
|
+
puts
|
47
49
|
message = "#{prefix_message}Processing #{total_count} documents"
|
48
|
-
message << " in batches of #{batch_size}
|
50
|
+
message << " in batches of #{batch_size}" unless batch_size.nil?
|
49
51
|
Prompter.say_log message
|
50
52
|
@pbar.start
|
51
53
|
end
|
52
54
|
|
53
55
|
def process_result(result, inc)
|
54
56
|
unless result.nil? || result.empty?
|
55
|
-
|
57
|
+
if result.failed.size > 0
|
56
58
|
Conf.logger.error "Failed load:\n#{result.failed.to_yaml}"
|
57
|
-
@pbar.
|
59
|
+
@pbar.title = "#{Dye.sgr(:clear, :red, :reversed, :bold)} " if Dye.color?
|
60
|
+
@pbar.progress_mark = 'F' unless Dye.color?
|
58
61
|
end
|
59
62
|
@failed_count += result.failed.size
|
60
63
|
@successful_count += result.successful.size
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastics-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|