tty-progressbar 0.12.1 → 0.12.2

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: 4da140c43179f280941fdc51b4c7927fd9dcd648
4
- data.tar.gz: 76f93a77ce8edc4ee982476ae19f1c9c2372a5d0
3
+ metadata.gz: 464521adfe6e527ac1ab61aadd19cd657cf0f6aa
4
+ data.tar.gz: 6ec1edf3103f0675efe9af020d968583084ea0ec
5
5
  SHA512:
6
- metadata.gz: 4478e6b69a5d1531867f16808abd03dfbdfe2a86dc3faf789b94a33dd56d449d7e4058ac58958c994af442002e661be2b932fe72c253d03390c7c4edd04e34c2
7
- data.tar.gz: cf73492360d38934724f208ef727100444c5e6c73efdebb928edfbaec0ad790d5cf8f40bebb889c9f70136cea8512a29c9e291b91a9e047d28b4528a2f8b186e
6
+ metadata.gz: 49e8a4e0d022250c44ee782cae66ed1ce065062ae04388fbec78f4b25624861ce9f888257b30f06f5c5a1ba5bb35c4fa396837fe0afb02c04f5ecb3a5d4570d3
7
+ data.tar.gz: f835a9a2579497d5c3f1c08122ab61b401180f3987480c3b5c24ad1a6291606705c0296b5511ce537aecd48beb1c20f04a1da019eba56a552d9a61a44ca6da96
data/.travis.yml CHANGED
@@ -12,11 +12,12 @@ rvm:
12
12
  - 2.3.3
13
13
  - 2.4.0
14
14
  - ruby-head
15
- - jruby-9000
15
+ - jruby-9.1.5.0
16
16
  - jruby-head
17
17
  matrix:
18
18
  allow_failures:
19
19
  - rvm: ruby-head
20
+ - rvm: jruby-9.1.5.0
20
21
  - rvm: jruby-head
21
22
  fast_finish: true
22
23
  branches:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.12.2] - 2017-09-15
4
+
5
+ ### Changed
6
+ * Change to automatically start & update top level progress bar
7
+ when registered bars advance
8
+
3
9
  ## [v0.12.1] - 2017-09-09
4
10
 
5
11
  ### Added
@@ -138,6 +144,7 @@
138
144
 
139
145
  * Initial implementation and release
140
146
 
147
+ [v0.12.2]: https://github.com/peter-murach/tty-progressbar/compare/v0.12.1...v0.12.2
141
148
  [v0.12.1]: https://github.com/peter-murach/tty-progressbar/compare/v0.12.0...v0.12.1
142
149
  [v0.12.0]: https://github.com/peter-murach/tty-progressbar/compare/v0.11.0...v0.12.0
143
150
  [v0.11.0]: https://github.com/peter-murach/tty-progressbar/compare/v0.10.1...v0.11.0
data/README.md CHANGED
@@ -505,10 +505,10 @@ Finally, wait for the threads to finish:
505
505
 
506
506
  ### 6.4 start
507
507
 
508
- If you want your top level multi bar to be rendered as the first bar in the terminal before any registered bars call `start`:
508
+ By default the top level multi bar will be rendered as the first bar and have its timer started when on of the regsitered bars advances. However, if you wish to start timers and draw the top level multi bar do:
509
509
 
510
510
  ```ruby
511
- multibar.start
511
+ multibar.start # => sets timer and draws top level multi progress bar
512
512
  ```
513
513
 
514
514
  ### 6.5 finish
@@ -8,8 +8,6 @@ bar1 = bars.register "foo [:bar] :percent", total: 15
8
8
  bar2 = bars.register "bar [:bar] :percent", total: 15
9
9
  bar3 = bars.register "baz [:bar] :percent", total: 45
10
10
 
11
- bars.start
12
-
13
11
  th1 = Thread.new { 15.times { sleep(0.1); bar1.advance } }
14
12
  th2 = Thread.new { 15.times { sleep(0.1); bar2.advance } }
15
13
  th3 = Thread.new { 45.times { sleep(0.1); bar3.advance } }
@@ -136,6 +136,7 @@ module TTY
136
136
  return if done?
137
137
 
138
138
  synchronize do
139
+ emit(:progress)
139
140
  if progress.respond_to?(:to_hash)
140
141
  tokens, progress = progress, 1
141
142
  end
@@ -151,7 +152,6 @@ module TTY
151
152
  now = Time.now
152
153
  return if (now - @last_render_time) < @render_period
153
154
  render
154
- emit(:progress)
155
155
  end
156
156
  end
157
157
 
@@ -107,7 +107,7 @@ module TTY
107
107
  # @api private
108
108
  def progress_handler
109
109
  proc do
110
- @top_bar.current = current if @top_bar
110
+ @top_bar.advance if @top_bar
111
111
  emit(:progress)
112
112
  end
113
113
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  class ProgressBar
5
- VERSION = '0.12.1'
5
+ VERSION = '0.12.2'
6
6
  end # ProgressBar
7
7
  end # TTY
@@ -58,65 +58,55 @@ RSpec.describe TTY::ProgressBar::Multi, 'advance' do
58
58
  bar1 = bars.register("[:bar] one", total: 5)
59
59
  bar2 = bars.register("[:bar] two", total: 5)
60
60
 
61
- bars.start
62
-
63
61
  bar2.advance
64
62
  bar1.advance
65
63
 
66
64
  output.rewind
67
65
  expect(output.read).to eq([
68
- "\e[1G#{top}[ ] main\n",
66
+ "\e[1G#{top}[= ] main\n",
69
67
  "\e[1G#{bottom}[= ] two\n",
70
68
  save,
71
69
  "\e[2A", # up 2 lines
72
- "\e[1G#{top}[= ] main",
73
- restore,
74
- "\e[1G#{bottom}[= ] one\n",
75
- save,
76
- "\e[3A", # up 3 lines
77
70
  "\e[1G#{top}[== ] main",
78
- restore
71
+ restore,
72
+ "\e[1G#{bottom}[= ] one\n"
79
73
  ].join)
80
74
 
81
75
  bar2.advance
82
76
 
83
77
  output.rewind
84
78
  expect(output.read).to eq([
85
- "\e[1G#{top}[ ] main\n",
79
+ "\e[1G#{top}[= ] main\n",
86
80
  "\e[1G#{bottom}[= ] two\n",
87
81
  save,
88
82
  "\e[2A", # up 2 lines
89
- "\e[1G#{top}[= ] main",
83
+ "\e[1G#{top}[== ] main",
90
84
  restore,
91
85
  "\e[1G#{bottom}[= ] one\n",
92
86
  save,
93
87
  "\e[3A", # up 3 lines
94
- "\e[1G#{top}[== ] main",
88
+ "\e[1G#{top}[=== ] main",
95
89
  restore,
96
90
  save,
97
91
  "\e[2A", # up 2 lines,
98
92
  "\e[1G#{middle}[== ] two",
99
93
  restore,
100
- save,
101
- "\e[3A", # up 3 lines
102
- "\e[1G#{top}[=== ] main",
103
- restore
104
94
  ].join)
105
95
 
106
96
  bar1.advance
107
97
 
108
98
  output.rewind
109
99
  expect(output.read).to eq([
110
- "\e[1G#{top}[ ] main\n",
100
+ "\e[1G#{top}[= ] main\n",
111
101
  "\e[1G#{bottom}[= ] two\n",
112
102
  save,
113
103
  "\e[2A", # up 2 lines
114
- "\e[1G#{top}[= ] main",
104
+ "\e[1G#{top}[== ] main",
115
105
  restore,
116
106
  "\e[1G#{bottom}[= ] one\n",
117
107
  save,
118
108
  "\e[3A", # up 3 lines
119
- "\e[1G#{top}[== ] main",
109
+ "\e[1G#{top}[=== ] main",
120
110
  restore,
121
111
  save,
122
112
  "\e[2A", # up 2 lines,
@@ -124,15 +114,11 @@ RSpec.describe TTY::ProgressBar::Multi, 'advance' do
124
114
  restore,
125
115
  save,
126
116
  "\e[3A", # up 3 lines
127
- "\e[1G#{top}[=== ] main",
117
+ "\e[1G#{top}[==== ] main",
128
118
  restore,
129
119
  save,
130
120
  "\e[1A", # up 1 line
131
121
  "\e[1G#{bottom}[== ] one",
132
- restore,
133
- save,
134
- "\e[3A", # up 3 lines
135
- "\e[1G#{top}[==== ] main",
136
122
  restore
137
123
  ].join)
138
124
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tty-progressbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-09 00:00:00.000000000 Z
11
+ date: 2017-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-cursor