philiprehberger-progress 0.1.7 → 0.2.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/CHANGELOG.md +33 -0
- data/README.md +50 -2
- data/lib/philiprehberger/progress/multi.rb +54 -1
- data/lib/philiprehberger/progress/version.rb +1 -1
- data/lib/philiprehberger/progress.rb +11 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c6f9be35e1424be64489b24f5d9b63bbf9a9b202b154c6c5c2139a8845a94f75
|
|
4
|
+
data.tar.gz: 0d8fedddb6f6a594f7ad766d996d2c98fb5a974ee4893942ce6be419eaaa653a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cefbeb2571f5812ffbacc35d5dbf1df5b36523d7a51809b7030e945c7a3081e24934066a8cf3b8d4a261d87104da492d4d75637657da485c70ad48506688ddd7
|
|
7
|
+
data.tar.gz: fff6cb774a53a996ec6c757c8d5c3123656691d5cf7fe91dc21169ff4ac37819070427980784b852ce908b240cc18394c7bb584a8fffe74352e6dab01343f25b
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this gem adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-04-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Multi-bar support via `Philiprehberger::Progress::Multi` for tracking concurrent tasks
|
|
14
|
+
- `Progress.multi` convenience method
|
|
15
|
+
- GitHub issue template gem version field
|
|
16
|
+
- Feature request "Alternatives considered" field
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Gemspec author and email to match standard template
|
|
20
|
+
|
|
21
|
+
## [0.1.11] - 2026-03-31
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- Add GitHub issue templates, dependabot config, and PR template
|
|
25
|
+
|
|
26
|
+
## [0.1.10] - 2026-03-31
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Standardize README badges, support section, and license format
|
|
30
|
+
|
|
31
|
+
## [0.1.9] - 2026-03-26
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Add Sponsor badge to README
|
|
35
|
+
- Fix License section format
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## [0.1.8] - 2026-03-24
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- Expand test coverage to 55+ examples covering edge cases and error paths
|
|
42
|
+
|
|
10
43
|
## [0.1.7] - 2026-03-24
|
|
11
44
|
|
|
12
45
|
### Fixed
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/philiprehberger/rb-progress/actions/workflows/ci.yml)
|
|
4
4
|
[](https://rubygems.org/gems/philiprehberger-progress)
|
|
5
|
-
[](https://github.com/philiprehberger/rb-progress/commits/main)
|
|
6
6
|
|
|
7
7
|
Terminal progress bars and spinners with ETA calculation and throughput display
|
|
8
8
|
|
|
@@ -77,6 +77,22 @@ Philiprehberger::Progress.each(items) do |item|
|
|
|
77
77
|
end
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
### Multi-bar
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
require "philiprehberger/progress"
|
|
84
|
+
|
|
85
|
+
multi = Philiprehberger::Progress.multi do |m|
|
|
86
|
+
downloads = m.add("Downloads", total: 100)
|
|
87
|
+
uploads = m.add("Uploads", total: 50)
|
|
88
|
+
|
|
89
|
+
100.times { downloads.advance }
|
|
90
|
+
50.times { uploads.advance }
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
multi.finished? # => true
|
|
94
|
+
```
|
|
95
|
+
|
|
80
96
|
## API
|
|
81
97
|
|
|
82
98
|
### `Philiprehberger::Progress::Bar`
|
|
@@ -103,12 +119,26 @@ end
|
|
|
103
119
|
| `#stopped?` | Whether the spinner is stopped |
|
|
104
120
|
| `#to_s` | Render the current frame with message |
|
|
105
121
|
|
|
122
|
+
### `Philiprehberger::Progress::Multi`
|
|
123
|
+
|
|
124
|
+
| Method | Description |
|
|
125
|
+
|--------|-------------|
|
|
126
|
+
| `Multi.new(output: $stderr)` | Create multi-bar tracker |
|
|
127
|
+
| `Multi#add(label, total:, width: 30)` | Add a named progress bar |
|
|
128
|
+
| `Multi#[](label)` | Retrieve a bar by label |
|
|
129
|
+
| `Multi#labels` | List of bar labels in order |
|
|
130
|
+
| `Multi#bars` | Hash of label to bar |
|
|
131
|
+
| `Multi#finished?` | True when all bars are finished |
|
|
132
|
+
| `Multi#render` | Render all bars to output |
|
|
133
|
+
| `Multi#reset` | Clear all bars |
|
|
134
|
+
|
|
106
135
|
### Module Methods
|
|
107
136
|
|
|
108
137
|
| Method | Description |
|
|
109
138
|
|--------|-------------|
|
|
110
139
|
| `Progress.bar(total:, &block)` | Create bar, auto-finish after block |
|
|
111
140
|
| `Progress.spin(message, &block)` | Create spinner, auto-stop after block |
|
|
141
|
+
| `Progress.multi(output: $stderr, &block)` | Create multi-bar tracker |
|
|
112
142
|
| `Progress.each(enumerable, label: nil) { \|item\| }` | Iterate with progress |
|
|
113
143
|
|
|
114
144
|
## Development
|
|
@@ -119,6 +149,24 @@ bundle exec rspec
|
|
|
119
149
|
bundle exec rubocop
|
|
120
150
|
```
|
|
121
151
|
|
|
152
|
+
## Support
|
|
153
|
+
|
|
154
|
+
If you find this project useful:
|
|
155
|
+
|
|
156
|
+
⭐ [Star the repo](https://github.com/philiprehberger/rb-progress)
|
|
157
|
+
|
|
158
|
+
🐛 [Report issues](https://github.com/philiprehberger/rb-progress/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
|
159
|
+
|
|
160
|
+
💡 [Suggest features](https://github.com/philiprehberger/rb-progress/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement)
|
|
161
|
+
|
|
162
|
+
❤️ [Sponsor development](https://github.com/sponsors/philiprehberger)
|
|
163
|
+
|
|
164
|
+
🌐 [All Open Source Projects](https://philiprehberger.com/open-source-packages)
|
|
165
|
+
|
|
166
|
+
💻 [GitHub Profile](https://github.com/philiprehberger)
|
|
167
|
+
|
|
168
|
+
🔗 [LinkedIn Profile](https://www.linkedin.com/in/philiprehberger)
|
|
169
|
+
|
|
122
170
|
## License
|
|
123
171
|
|
|
124
|
-
MIT
|
|
172
|
+
[MIT](LICENSE)
|
|
@@ -1,3 +1,56 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
module Philiprehberger
|
|
4
|
+
module Progress
|
|
5
|
+
class Multi
|
|
6
|
+
def initialize(output: $stderr)
|
|
7
|
+
@output = output
|
|
8
|
+
@bars = {}
|
|
9
|
+
@order = []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def add(label, total:, width: 30)
|
|
13
|
+
bar = Bar.new(total: total, width: width, output: @output)
|
|
14
|
+
@bars[label] = bar
|
|
15
|
+
@order << label unless @order.include?(label)
|
|
16
|
+
bar
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def [](label)
|
|
20
|
+
@bars[label]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def bars
|
|
24
|
+
@bars.dup
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def labels
|
|
28
|
+
@order.dup
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def finished?
|
|
32
|
+
return false if @bars.empty?
|
|
33
|
+
|
|
34
|
+
@bars.values.all?(&:finished?)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def render
|
|
38
|
+
return unless @output.respond_to?(:tty?) && @output.tty?
|
|
39
|
+
|
|
40
|
+
lines = @order.map do |label|
|
|
41
|
+
bar = @bars[label]
|
|
42
|
+
"#{label}: #{bar}"
|
|
43
|
+
end
|
|
44
|
+
@output.print("\e[#{lines.size}A") if @rendered_once
|
|
45
|
+
lines.each { |line| @output.puts(line) }
|
|
46
|
+
@rendered_once = true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def reset
|
|
50
|
+
@bars.clear
|
|
51
|
+
@order.clear
|
|
52
|
+
@rendered_once = false
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative 'progress/version'
|
|
4
4
|
require_relative 'progress/bar'
|
|
5
5
|
require_relative 'progress/spinner'
|
|
6
|
+
require_relative 'progress/multi'
|
|
6
7
|
|
|
7
8
|
module Philiprehberger
|
|
8
9
|
module Progress
|
|
@@ -30,6 +31,16 @@ module Philiprehberger
|
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
34
|
+
def self.multi(output: $stderr)
|
|
35
|
+
m = Multi.new(output: output)
|
|
36
|
+
if block_given?
|
|
37
|
+
yield m
|
|
38
|
+
m
|
|
39
|
+
else
|
|
40
|
+
m
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
33
44
|
def self.each(enumerable, label: nil, output: $stderr)
|
|
34
45
|
items = enumerable.to_a
|
|
35
46
|
bar = Bar.new(total: items.length, output: output)
|
metadata
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: philiprehberger-progress
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Philip Rehberger
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Display progress bars with percentage, ETA, and throughput, or spinners
|
|
14
14
|
for indeterminate tasks. Supports block-based usage, enumerable iteration, and auto-disables
|
|
15
15
|
rendering when not connected to a terminal.
|
|
16
16
|
email:
|
|
17
|
-
- philiprehberger
|
|
17
|
+
- me@philiprehberger.com
|
|
18
18
|
executables: []
|
|
19
19
|
extensions: []
|
|
20
20
|
extra_rdoc_files: []
|
|
@@ -27,11 +27,11 @@ files:
|
|
|
27
27
|
- lib/philiprehberger/progress/multi.rb
|
|
28
28
|
- lib/philiprehberger/progress/spinner.rb
|
|
29
29
|
- lib/philiprehberger/progress/version.rb
|
|
30
|
-
homepage: https://
|
|
30
|
+
homepage: https://philiprehberger.com/open-source-packages/ruby/philiprehberger-progress
|
|
31
31
|
licenses:
|
|
32
32
|
- MIT
|
|
33
33
|
metadata:
|
|
34
|
-
homepage_uri: https://
|
|
34
|
+
homepage_uri: https://philiprehberger.com/open-source-packages/ruby/philiprehberger-progress
|
|
35
35
|
source_code_uri: https://github.com/philiprehberger/rb-progress
|
|
36
36
|
changelog_uri: https://github.com/philiprehberger/rb-progress/blob/main/CHANGELOG.md
|
|
37
37
|
bug_tracker_uri: https://github.com/philiprehberger/rb-progress/issues
|