tty-progressbar 0.8.1 → 0.9.0
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.
- checksums.yaml +4 -4
- data/.codeclimate.yml +4 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/README.md +19 -11
- data/lib/tty/progressbar.rb +1 -11
- data/lib/tty/progressbar/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/tty-progressbar.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 439fab8fa2f01250536b13ccc0449b45666cc5b4
|
4
|
+
data.tar.gz: 71ba8ed5afc229ce963fbb0024c1412b3aa03a2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da558151e07076430689c8342ddafb2960d8ef8f15cffc0cb9dc70c3d2b20f07b9c51361ffad8990d0d0985ee5df07db7da3530676d020f4bd32bfeceb8b3728
|
7
|
+
data.tar.gz: 5ac177be8d609806e52c83ae78e2cda8d9a1990c0376f6febb06a783d4d30d4f2dbfab427bcf26b2b41319ed1e967503837fb30f43413ef78391474cd05ba212
|
data/.codeclimate.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.9.0] - 2016-04-09
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
* Fix #resize to stop raising error when finished
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
* Remove #register_signals and leave the choice on how exit and resize are handled to developer
|
10
|
+
|
3
11
|
## [v0.8.1] - 2016-02-27
|
4
12
|
|
5
13
|
### Added
|
@@ -77,6 +85,7 @@
|
|
77
85
|
|
78
86
|
* Initial implementation and release
|
79
87
|
|
88
|
+
[v0.8.2]: https://github.com/peter-murach/tty-progressbar/compare/v0.8.1...v0.8.2
|
80
89
|
[v0.8.1]: https://github.com/peter-murach/tty-progressbar/compare/v0.8.0...v0.8.1
|
81
90
|
[v0.8.0]: https://github.com/peter-murach/tty-progressbar/compare/v0.7.0...v0.8.0
|
82
91
|
[v0.7.0]: https://github.com/peter-murach/tty-progressbar/compare/v0.6.0...v0.7.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
# TTY::ProgressBar
|
2
2
|
[][gem]
|
3
|
-
[][travis]
|
4
|
+
[][codeclimate]
|
5
|
+
[][coverage]
|
6
|
+
[][inchpages]
|
7
7
|
|
8
8
|
[gem]: http://badge.fury.io/rb/tty-progressbar
|
9
|
-
[travis]: http://travis-ci.org/
|
10
|
-
[codeclimate]: https://codeclimate.com/github/
|
11
|
-
[
|
9
|
+
[travis]: http://travis-ci.org/piotrmurach/tty-progressbar
|
10
|
+
[codeclimate]: https://codeclimate.com/github/piotrmurach/tty-progressbar
|
11
|
+
[coverage]: https://coveralls.io/github/piotrmurach/tty-progressbar
|
12
|
+
[inchpages]: http://inch-ci.org/github/piotrmurach/tty-progressbar
|
12
13
|
|
13
14
|
> A flexible progress bars drawing in terminal emulators.
|
14
15
|
|
15
|
-
**TTY::ProgressBar** provides independent progress bars component for [TTY](https://github.com/
|
16
|
+
**TTY::ProgressBar** provides independent progress bars component for [TTY](https://github.com/piotrmurach/tty) toolkit.
|
16
17
|
|
17
18
|
## Features
|
18
19
|
|
@@ -160,12 +161,19 @@ bar.reset
|
|
160
161
|
|
161
162
|
### 1.9 resize
|
162
163
|
|
163
|
-
If you wish for a progress bar to change it's current width, you can use `resize` by passing in a new desired length
|
164
|
+
If you wish for a progress bar to change it's current width, you can use `resize` by passing in a new desired length. However, if you don't provide any width the `resize` will use terminal current width as its base for scaling.
|
164
165
|
|
165
166
|
```ruby
|
167
|
+
bar.resize # => determine terminal width and scale accordingly
|
166
168
|
bar.resize(50) # => will resize bar proportionately from this point onwards
|
167
169
|
```
|
168
170
|
|
171
|
+
To handle automatic resizing you can trap `:WINCH` signal:
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
trap(:WINCH) { bar.resize }
|
175
|
+
```
|
176
|
+
|
169
177
|
## 2. Configuration
|
170
178
|
|
171
179
|
There are number of configuration options that can be provided:
|
@@ -319,7 +327,7 @@ This section demonstrates some of the possible uses for the **TTY::ProgressBar**
|
|
319
327
|
|
320
328
|
### 5.1 Colors
|
321
329
|
|
322
|
-
Creating a progress bar that displays in color is as simple as coloring the `:complete` and `:incomplete` character options. In order to help with coloring you can use [pastel](https://github.com/
|
330
|
+
Creating a progress bar that displays in color is as simple as coloring the `:complete` and `:incomplete` character options. In order to help with coloring you can use [pastel](https://github.com/piotrmurach/pastel) library like so:
|
323
331
|
|
324
332
|
```ruby
|
325
333
|
require 'pastel'
|
@@ -367,7 +375,7 @@ downloading [======================= ] 4.12MB/s
|
|
367
375
|
|
368
376
|
## Contributing
|
369
377
|
|
370
|
-
1. Fork it ( https://github.com/
|
378
|
+
1. Fork it ( https://github.com/piotrmurach/tty-progressbar/fork )
|
371
379
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
372
380
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
373
381
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/tty/progressbar.rb
CHANGED
@@ -74,7 +74,6 @@ module TTY
|
|
74
74
|
@meter = Meter.new(options.fetch(:interval, 1))
|
75
75
|
|
76
76
|
@formatter.load
|
77
|
-
register_signals
|
78
77
|
end
|
79
78
|
|
80
79
|
# Start progression by drawing bar and setting time
|
@@ -185,7 +184,7 @@ module TTY
|
|
185
184
|
#
|
186
185
|
# @api public
|
187
186
|
def resize(new_width = nil)
|
188
|
-
|
187
|
+
return if @done
|
189
188
|
clear_line
|
190
189
|
if new_width
|
191
190
|
self.width = new_width
|
@@ -301,14 +300,5 @@ module TTY
|
|
301
300
|
end
|
302
301
|
message
|
303
302
|
end
|
304
|
-
|
305
|
-
# Handle resize and kill signals
|
306
|
-
#
|
307
|
-
# @api private
|
308
|
-
def register_signals
|
309
|
-
trap(:WINCH) { resize }
|
310
|
-
|
311
|
-
trap(:INT) { exit! }
|
312
|
-
end
|
313
303
|
end # ProgressBar
|
314
304
|
end # TTY
|
data/spec/spec_helper.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
if RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])
|
4
4
|
require 'simplecov'
|
5
|
-
require '
|
5
|
+
require 'coveralls'
|
6
6
|
|
7
7
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
8
8
|
SimpleCov::Formatter::HTMLFormatter,
|
9
|
-
|
9
|
+
Coveralls::SimpleCov::Formatter
|
10
10
|
]
|
11
11
|
|
12
12
|
SimpleCov.start do
|
data/tty-progressbar.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = [""]
|
11
11
|
spec.summary = %q{A flexible progress bars drawing in terminal emulators.}
|
12
12
|
spec.description = %q{A flexible progress bars drawing in terminal emulators.}
|
13
|
-
spec.homepage = "
|
13
|
+
spec.homepage = "https://piotrmurach.github.io/tty/"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-screen
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
- tasks/coverage.rake
|
138
138
|
- tasks/spec.rake
|
139
139
|
- tty-progressbar.gemspec
|
140
|
-
homepage:
|
140
|
+
homepage: https://piotrmurach.github.io/tty/
|
141
141
|
licenses:
|
142
142
|
- MIT
|
143
143
|
metadata: {}
|