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 +4 -4
- data/.travis.yml +2 -1
- data/CHANGELOG.md +7 -0
- data/README.md +2 -2
- data/examples/multi/main_bar.rb +0 -2
- data/lib/tty/progressbar.rb +1 -1
- data/lib/tty/progressbar/multi.rb +1 -1
- data/lib/tty/progressbar/version.rb +1 -1
- data/spec/unit/multi/advance_spec.rb +10 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 464521adfe6e527ac1ab61aadd19cd657cf0f6aa
|
4
|
+
data.tar.gz: 6ec1edf3103f0675efe9af020d968583084ea0ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49e8a4e0d022250c44ee782cae66ed1ce065062ae04388fbec78f4b25624861ce9f888257b30f06f5c5a1ba5bb35c4fa396837fe0afb02c04f5ecb3a5d4570d3
|
7
|
+
data.tar.gz: f835a9a2579497d5c3f1c08122ab61b401180f3987480c3b5c24ad1a6291606705c0296b5511ce537aecd48beb1c20f04a1da019eba56a552d9a61a44ca6da96
|
data/.travis.yml
CHANGED
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
|
-
|
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
|
data/examples/multi/main_bar.rb
CHANGED
@@ -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 } }
|
data/lib/tty/progressbar.rb
CHANGED
@@ -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
|
|
@@ -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}[
|
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}[
|
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}[
|
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}[
|
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}[
|
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}[
|
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}[
|
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}[
|
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.
|
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-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-cursor
|