ruby-progress 1.3.2 → 1.3.5
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/.rubocop_todo.yml +37 -18
- data/CHANGELOG.md +64 -118
- data/DAEMON_MODE.md +127 -0
- data/Gemfile +9 -1
- data/Gemfile.lock +25 -18
- data/JOB_CLI_REFACTOR.md +67 -0
- data/README.md +90 -94
- data/bin/prg +10 -16
- data/demo_screencast.rb +130 -122
- data/examples/daemon_job_example.sh +8 -10
- data/lib/ruby-progress/cli/fill_options.rb +8 -6
- data/lib/ruby-progress/cli/job_cli.rb +170 -131
- data/lib/ruby-progress/cli/ripple_cli.rb +19 -56
- data/lib/ruby-progress/cli/ripple_options.rb +18 -3
- data/lib/ruby-progress/cli/twirl_cli.rb +3 -1
- data/lib/ruby-progress/cli/twirl_options.rb +4 -4
- data/lib/ruby-progress/cli/twirl_runner.rb +3 -37
- data/lib/ruby-progress/cli/worm_cli.rb +2 -50
- data/lib/ruby-progress/cli/worm_options.rb +4 -6
- data/lib/ruby-progress/cli/worm_runner.rb +16 -5
- data/lib/ruby-progress/daemon.rb +2 -64
- data/lib/ruby-progress/fill_cli.rb +4 -72
- data/lib/ruby-progress/output_capture.rb +174 -37
- data/lib/ruby-progress/utils.rb +11 -6
- data/lib/ruby-progress/version.rb +5 -5
- data/lib/ruby-progress/worm.rb +8 -61
- data/ruby-progress.gemspec +41 -0
- data/screencast +2497 -26
- data/screencast.svg +1 -0
- data/scripts/coverage_analysis.rb +49 -0
- data/test_daemon.sh +20 -0
- metadata +31 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a22fcfc5ae8ffc222ac1f19f4d7b5295f9205c8ae95bce7ec8be8884e076f578
|
|
4
|
+
data.tar.gz: f96675ec9f6bcc1e6dd905763b45ea776bbf3f78f57629fc50a2cac4a13d22b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a61a58643c367f94645d5f3fded92473c44f72ee17553f47f89e27403780cbb3c7bb0fb3a3b36876be8928162434cd28aa847ef6e2ec488ec115c64f06bee2e
|
|
7
|
+
data.tar.gz: 9a7eda5a91f80ea1be162bb6bd250da3134f0567fa1c47f6c9e782f6aa80e16ed379e60da48a1ebd59f44dcb80a50cc92467ed9ec42be7196ceb973be66113fb
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2025-10-
|
|
3
|
+
# on 2025-10-15 10:46:34 UTC using RuboCop version 1.75.7.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count:
|
|
9
|
+
# Offense count: 3
|
|
10
10
|
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
|
11
11
|
# SupportedStyles: Gemfile, gems.rb, gemspec
|
|
12
12
|
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
|
@@ -22,10 +22,11 @@ Layout/TrailingEmptyLines:
|
|
|
22
22
|
Exclude:
|
|
23
23
|
- 'test_worm_flags.rb'
|
|
24
24
|
|
|
25
|
-
# Offense count:
|
|
25
|
+
# Offense count: 5
|
|
26
26
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
27
27
|
Lint/DuplicateBranch:
|
|
28
28
|
Exclude:
|
|
29
|
+
- 'lib/ruby-progress/output_capture.rb'
|
|
29
30
|
- 'lib/ruby-progress/utils.rb'
|
|
30
31
|
- 'lib/ruby-progress/worm.rb'
|
|
31
32
|
|
|
@@ -56,41 +57,46 @@ Lint/UselessAssignment:
|
|
|
56
57
|
- 'demo_gem.rb'
|
|
57
58
|
- 'spec/cli_integration_spec.rb'
|
|
58
59
|
|
|
59
|
-
# Offense count:
|
|
60
|
+
# Offense count: 46
|
|
60
61
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
61
62
|
Metrics/AbcSize:
|
|
62
|
-
Max:
|
|
63
|
+
Max: 121
|
|
63
64
|
|
|
64
|
-
# Offense count:
|
|
65
|
+
# Offense count: 56
|
|
65
66
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
66
67
|
# AllowedMethods: refine
|
|
67
68
|
Metrics/BlockLength:
|
|
68
|
-
Max:
|
|
69
|
+
Max: 136
|
|
69
70
|
|
|
70
|
-
# Offense count:
|
|
71
|
+
# Offense count: 5
|
|
71
72
|
# Configuration parameters: CountComments, CountAsOne.
|
|
72
73
|
Metrics/ClassLength:
|
|
73
|
-
Max:
|
|
74
|
+
Max: 200
|
|
74
75
|
|
|
75
|
-
# Offense count:
|
|
76
|
+
# Offense count: 29
|
|
76
77
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
77
78
|
Metrics/CyclomaticComplexity:
|
|
78
|
-
Max:
|
|
79
|
+
Max: 22
|
|
79
80
|
|
|
80
81
|
# Offense count: 68
|
|
81
82
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
82
83
|
Metrics/MethodLength:
|
|
83
|
-
Max:
|
|
84
|
+
Max: 140
|
|
84
85
|
|
|
85
|
-
# Offense count:
|
|
86
|
+
# Offense count: 10
|
|
86
87
|
# Configuration parameters: CountComments, CountAsOne.
|
|
87
88
|
Metrics/ModuleLength:
|
|
88
|
-
Max:
|
|
89
|
+
Max: 231
|
|
89
90
|
|
|
90
|
-
# Offense count:
|
|
91
|
+
# Offense count: 1
|
|
92
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
|
93
|
+
Metrics/ParameterLists:
|
|
94
|
+
Max: 6
|
|
95
|
+
|
|
96
|
+
# Offense count: 28
|
|
91
97
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
92
98
|
Metrics/PerceivedComplexity:
|
|
93
|
-
Max:
|
|
99
|
+
Max: 22
|
|
94
100
|
|
|
95
101
|
# Offense count: 1
|
|
96
102
|
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
|
@@ -116,7 +122,7 @@ Style/Documentation:
|
|
|
116
122
|
- 'spec/**/*'
|
|
117
123
|
- 'test/**/*'
|
|
118
124
|
- 'lib/ruby-progress.rb'
|
|
119
|
-
- 'lib/ruby-progress/
|
|
125
|
+
- 'lib/ruby-progress/cli/job_cli.rb'
|
|
120
126
|
|
|
121
127
|
# Offense count: 1
|
|
122
128
|
# This cop supports safe autocorrection (--autocorrect).
|
|
@@ -126,6 +132,13 @@ Style/EmptyElse:
|
|
|
126
132
|
Exclude:
|
|
127
133
|
- 'lib/ruby-progress/ripple.rb'
|
|
128
134
|
|
|
135
|
+
# Offense count: 3
|
|
136
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
137
|
+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, Mode, AllowedMethods, AllowedPatterns.
|
|
138
|
+
# SupportedStyles: annotated, template, unannotated
|
|
139
|
+
Style/FormatStringToken:
|
|
140
|
+
EnforcedStyle: unannotated
|
|
141
|
+
|
|
129
142
|
# Offense count: 1
|
|
130
143
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
131
144
|
# Configuration parameters: EnforcedStyle.
|
|
@@ -149,6 +162,12 @@ Style/InfiniteLoop:
|
|
|
149
162
|
Exclude:
|
|
150
163
|
- 'lib/ruby-progress/ripple.rb'
|
|
151
164
|
|
|
165
|
+
# Offense count: 2
|
|
166
|
+
Style/MultilineBlockChain:
|
|
167
|
+
Exclude:
|
|
168
|
+
- 'spec/cli/twirl_options_unit_spec.rb'
|
|
169
|
+
- 'spec/job_cli_spec.rb'
|
|
170
|
+
|
|
152
171
|
# Offense count: 1
|
|
153
172
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
154
173
|
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
|
@@ -174,7 +193,7 @@ Style/StringLiterals:
|
|
|
174
193
|
Exclude:
|
|
175
194
|
- 'test_worm_flags.rb'
|
|
176
195
|
|
|
177
|
-
# Offense count:
|
|
196
|
+
# Offense count: 50
|
|
178
197
|
# This cop supports safe autocorrection (--autocorrect).
|
|
179
198
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
180
199
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
|
@@ -5,180 +5,126 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## 1.3.
|
|
8
|
+
## [1.3.5] - 2025-10-15
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- `prg job
|
|
15
|
-
-
|
|
16
|
-
-
|
|
12
|
+
- **Job CLI refactoring**: Restructured `prg job` command to use proper subcommands instead of hardcoded send behavior
|
|
13
|
+
- `prg job stop` - Stop a running progress indicator (replaces `prg job send`)
|
|
14
|
+
- `prg job status` - Check if a daemon is running and show its PID
|
|
15
|
+
- `prg job advance` - Advance a fill progress bar by a specified amount
|
|
16
|
+
- Backward compatibility: `prg job send` still works but shows deprecation warning
|
|
17
|
+
- Silent operation for job commands - no confirmation messages, only daemon output shown
|
|
18
|
+
- Control message framework using JSON files and USR2 signal for daemon communication
|
|
19
|
+
- Comprehensive test coverage improvements (from 10.63% to 31.38%)
|
|
20
|
+
- 119 new tests across 8 new spec files
|
|
21
|
+
- Unit tests for CLI options modules (twirl, ripple, fill, worm)
|
|
22
|
+
- Job CLI subcommand tests
|
|
23
|
+
- Custom icon propagation tests
|
|
17
24
|
|
|
18
25
|
### Changed
|
|
19
26
|
|
|
20
|
-
-
|
|
27
|
+
- **Daemon mode improvements**: All CLI subcommands now consistently use `PrgCLI.backgroundize`
|
|
28
|
+
- Removed `--no-detach` option from all CLIs (backgrounding is now always used)
|
|
29
|
+
- Fixed `backgroundize` method to use `Process.detach()` preventing shell job notifications
|
|
30
|
+
- Ripple completion messages now go to stderr (animation output stream) instead of stdout
|
|
31
|
+
- Enhanced `Utils.display_completion` to show custom icons even without checkmark flag
|
|
32
|
+
- Updated README with new job CLI subcommand documentation
|
|
33
|
+
- Updated documentation (DAEMON_MODE.md, JOB_CLI_REFACTOR.md)
|
|
21
34
|
|
|
22
|
-
###
|
|
23
|
-
|
|
24
|
-
- Added unit and integration tests covering job enqueueing, processing, and result persistence.
|
|
35
|
+
### Fixed
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
- Ripple CLI tests updated to check stderr for completion messages (not stdout)
|
|
38
|
+
- Ripple CLI tests updated to require `--stdout` flag to see command output
|
|
39
|
+
- Output capture compatibility for older Ruby versions (added `wait_readable` fallback)
|
|
40
|
+
- Fixed daemon PID file cleanup and signal handling
|
|
41
|
+
- Custom success/error icons now display correctly with `--success-icon` and `--error-icon` flags
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
### Removed
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
- `--no-detach` option from all progress indicator CLIs (ripple, worm, twirl, fill)
|
|
46
|
+
- Confirmation output from job control commands for script-friendly silent operation
|
|
31
47
|
|
|
32
|
-
|
|
48
|
+
## 1.3.4 - 2024-10-14
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Changed
|
|
50
|
+
### Fixed
|
|
37
51
|
|
|
38
|
-
-
|
|
39
|
-
- Demo: updated `demo_screencast.rb` to call the local `bin/prg` when stopping the demo daemon to avoid conflicts with system-installed versions.
|
|
52
|
+
- Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
|
|
40
53
|
|
|
41
54
|
### Changed
|
|
42
55
|
|
|
43
|
-
-
|
|
56
|
+
- Prepared for next patch release.
|
|
44
57
|
|
|
58
|
+
## 1.3.4 - 2025-10-14
|
|
45
59
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### Added
|
|
60
|
+
### Fixed
|
|
49
61
|
|
|
50
|
-
-
|
|
62
|
+
- Ensure non-live (`--stdout`) capture does not stream output to the terminal during animation; captured output is now emitted at completion only.
|
|
63
|
+
- Stabilized PTY-based output capture redraw/reserve logic and cursor save/restore fallback.
|
|
51
64
|
|
|
52
65
|
### Changed
|
|
53
66
|
|
|
54
|
-
-
|
|
67
|
+
- Bumped main gem `VERSION` to 1.3.4.
|
|
68
|
+
- Cleaned up one-off debug/init traces written during development.
|
|
55
69
|
|
|
56
|
-
## 1.
|
|
70
|
+
## 1.3.3 - 2025-10-14
|
|
57
71
|
|
|
58
|
-
###
|
|
72
|
+
### Fixed
|
|
59
73
|
|
|
60
|
-
-
|
|
74
|
+
- Output capture: ensure `--output-lines N` is honored when reserving terminal rows for captured output; coerce the `lines` option to an integer and stabilize the reserve/redraw logic so live captured output does not overwrite the prompt or animation.
|
|
61
75
|
|
|
62
|
-
###
|
|
76
|
+
### Changed
|
|
63
77
|
|
|
64
|
-
-
|
|
78
|
+
- Removed one-off init trace writes and cleaned debug logging.
|
|
65
79
|
|
|
66
|
-
## 1.2
|
|
80
|
+
## 1.3.2 - 2025-10-13
|
|
67
81
|
|
|
68
82
|
### Added
|
|
69
83
|
|
|
70
|
-
-
|
|
71
|
-
- Ensured SimpleCov finalization runs reliably across Ruby versions during tests.
|
|
72
|
-
- Minor CLI help text clarifications and version constant alignment.
|
|
84
|
+
- `fill` subcommand: added `-c, --command COMMAND` so the determinate progress bar can run and capture command output like the other subcommands. This includes `--output-lines` and `--output-position` support for reserving terminal rows during capture.
|
|
73
85
|
|
|
74
86
|
### Changed
|
|
75
87
|
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
- Affects all three commands: ripple, worm, and twirl
|
|
79
|
-
- Resolves issue where completion messages appeared mid-line after animation ended
|
|
80
|
-
- Improved professional appearance of CLI output
|
|
81
|
-
|
|
82
|
-
Technical
|
|
83
|
-
|
|
84
|
-
- **Enhanced display_completion method**: Added proper line clearing and cursor positioning
|
|
85
|
-
- Uses `re[2K` sequence followed by clean message display
|
|
86
|
-
- Updated test expectations to match new output format
|
|
87
|
-
- Maintains backward compatibility with existing functionality
|
|
88
|
+
- Added `--stop-id NAME` shorthand for targeting named daemons (implies `--stop` and normalizes the name to the canonical PID filename). This is a small convenience used by the demo and scripts.
|
|
89
|
+
- Demo: updated `demo_screencast.rb` to call the local `bin/prg` when stopping the demo daemon to avoid conflicts with system-installed versions.
|
|
88
90
|
|
|
89
|
-
## 1.2.
|
|
91
|
+
## 1.2.4 - 2025-10-12
|
|
90
92
|
|
|
91
93
|
### Added
|
|
92
94
|
|
|
93
|
-
-
|
|
94
|
-
- Accepts even-length strings split in half for start and end characters
|
|
95
|
-
- Works across all three commands: ripple, worm, and twirl
|
|
96
|
-
- Examples: `--ends "[]"` → `[animation]`, `--ends "<<>>"` → `<<animation>>`
|
|
97
|
-
- Multi-byte character support for emojis: `--ends "🎯🎪"` → `🎯animation🎪`
|
|
98
|
-
- Graceful fallback for invalid input (odd-length strings)
|
|
99
|
-
|
|
100
|
-
- **Comprehensive test coverage for new features**: Added extensive test suites
|
|
101
|
-
- Direction control tests: Forward-only vs bidirectional animation behavior
|
|
102
|
-
- Custom style tests: ASCII, Unicode, emoji, and mixed character pattern validation
|
|
103
|
-
- CLI integration tests: End-to-end testing for all new command-line options
|
|
104
|
-
- Ends functionality tests: Multi-byte character handling, error cases, help documentation
|
|
105
|
-
- Total: 58 new test examples covering all edge cases
|
|
106
|
-
|
|
107
|
-
- **Worm direction control**: Fine-grained animation movement control
|
|
108
|
-
- `--direction forward` (or `-d f`): Animation moves only forward, resets at end
|
|
109
|
-
- `--direction bidirectional` (or `-d b`): Default back-and-forth movement
|
|
110
|
-
- Compatible with all worm styles including custom patterns
|
|
111
|
-
|
|
112
|
-
- **Worm custom styles**: User-defined 3-character animation patterns
|
|
113
|
-
- Format: `--style custom=abc` where `abc` defines baseline, midline, peak characters
|
|
114
|
-
- ASCII support: `--style custom=_-=` → `___-=___`
|
|
115
|
-
- Unicode support: `--style custom=▫▪■` → geometric patterns
|
|
116
|
-
- Emoji support: `--style custom=🟦🟨🟥` → colorful animations
|
|
117
|
-
- Mixed characters: `--style custom=.🟡*` → combined ASCII and emoji
|
|
118
|
-
- Proper multi-byte character counting for accurate 3-character validation
|
|
119
|
-
- **Ripple style flags**: `--spinner`, `--rainbow`, `--inverse`, and `--caps` flags deprecated in favor of unified `--style` system (backward
|
|
120
|
-
compatibility maintained)
|
|
121
|
-
|
|
122
|
-
### Fixed
|
|
123
|
-
|
|
124
|
-
- **OptionParser conflicts**: Resolved parsing issues with optional arguments that could consume following flags
|
|
125
|
-
- **Daemon workflow**: Streamlined daemon start/stop workflow eliminating need for redundant flag combinations
|
|
95
|
+
- Small bug fixes and test stability improvements; ensured SimpleCov finalization runs reliably across Ruby versions during tests and minor CLI help clarifications.
|
|
126
96
|
|
|
127
|
-
## 1.
|
|
128
|
-
|
|
129
|
-
## 1.1.0 - 2025-10-09
|
|
97
|
+
## 1.2.3 - 2025-10-11
|
|
130
98
|
|
|
131
99
|
### Added
|
|
132
100
|
|
|
133
|
-
-
|
|
134
|
-
- Unified daemon flags across ripple and worm: `--daemon`, `--status`, `--stop`, `--pid-file`, `--stop-success`, `--stop-error`,
|
|
135
|
-
`--stop-checkmark`
|
|
136
|
-
- Ripple: daemon parity with worm, including clean shutdown on SIGUSR1/TERM/HUP/INT
|
|
101
|
+
- Dedicated `fill` shim: added `bin/fill` that delegates to `prg fill`.
|
|
137
102
|
|
|
138
|
-
|
|
103
|
+
## 1.2.2 - 2025-10-11
|
|
139
104
|
|
|
140
|
-
|
|
141
|
-
- README updated with new daemon usage examples and flag descriptions
|
|
105
|
+
### Improved
|
|
142
106
|
|
|
143
|
-
|
|
107
|
+
- Demo script enhancements: updated quick demo with better visual examples.
|
|
144
108
|
|
|
145
|
-
|
|
109
|
+
## 1.2.0 - 2025-10-11
|
|
146
110
|
|
|
147
111
|
### Added
|
|
148
112
|
|
|
149
|
-
-
|
|
150
|
-
- Added RSpec test suite with comprehensive coverage
|
|
151
|
-
- Added Rake tasks for version management and packaging
|
|
152
|
-
- Added --checkmark and --stdout flags to Worm (ported from Ripple)
|
|
153
|
-
- Added infinite mode to Worm (runs indefinitely without command like Ripple)
|
|
154
|
-
- **Added unified `prg` binary with subcommands for both `ripple` and `worm`**
|
|
155
|
-
- **Enhanced command-line interface with consistent flag support across both tools**
|
|
156
|
-
- **Added `RubyProgress::Utils` module with universal terminal control utilities**
|
|
157
|
-
- **Centralized cursor control, line clearing, and completion message functionality**
|
|
158
|
-
- **Added daemon mode for background progress indicators in bash scripts**
|
|
159
|
-
- **Implemented signal-based control (SIGUSR1) for clean daemon shutdown**
|
|
160
|
-
|
|
161
|
-
### Changed
|
|
113
|
+
- `--ends` flag for all commands and lots of smaller UX and testing improvements.
|
|
162
114
|
|
|
163
|
-
|
|
164
|
-
- Separated logic into lib/ruby-progress/ structure
|
|
165
|
-
- Created proper bin/ executables for ripple and worm
|
|
166
|
-
- Updated README with gem installation and usage instructions
|
|
115
|
+
## 1.1.0 - 2025-10-09
|
|
167
116
|
|
|
168
|
-
###
|
|
117
|
+
### Added
|
|
169
118
|
|
|
170
|
-
-
|
|
171
|
-
- Improved signal handling and cursor management
|
|
119
|
+
- Shared daemon helpers module `RubyProgress::Daemon` and unified daemon flags across ripple and worm.
|
|
172
120
|
|
|
173
121
|
## 1.0.0 - 2025-10-09
|
|
174
122
|
|
|
175
123
|
### Added
|
|
176
124
|
|
|
177
|
-
- Initial release with two progress indicators
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
- Support for custom speeds, messages, and styling options
|
|
182
|
-
- Integration with system commands and process monitoring
|
|
125
|
+
- Initial release with two progress indicators (Ripple and Worm) and basic CLI tooling.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## 1.0.1 - 2025-01-01
|
|
183
129
|
|
|
184
130
|
|
data/DAEMON_MODE.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Daemon Mode Usage
|
|
2
|
+
|
|
3
|
+
## Summary of Changes
|
|
4
|
+
|
|
5
|
+
We've simplified daemon mode to ALWAYS use backgrounding (not detaching). This means:
|
|
6
|
+
|
|
7
|
+
1. **The `--no-detach` option has been removed** (it's now the default behavior)
|
|
8
|
+
2. **Daemon mode backgrounds in the same terminal** so you can see the progress indicator while running other commands
|
|
9
|
+
3. **All CLI subcommands (twirl, ripple, worm, fill) now use `PrgCLI.backgroundize`** instead of conditionally using `daemonize`
|
|
10
|
+
|
|
11
|
+
## How to Use Daemon Mode
|
|
12
|
+
|
|
13
|
+
### Starting a background progress indicator
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Start a twirl spinner in the background
|
|
17
|
+
./bin/prg twirl --daemon-as my_task
|
|
18
|
+
|
|
19
|
+
# Start a ripple animation in the background
|
|
20
|
+
./bin/prg ripple --daemon-as my_task
|
|
21
|
+
|
|
22
|
+
# Start a worm animation in the background
|
|
23
|
+
./bin/prg worm --daemon-as my_task
|
|
24
|
+
|
|
25
|
+
# Start a fill progress bar in the background
|
|
26
|
+
./bin/prg fill --daemon-as my_task --total 100
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The indicator will appear in your terminal and remain visible while you
|
|
30
|
+
continue working.
|
|
31
|
+
|
|
32
|
+
### Stopping a background indicator
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Stop with default message
|
|
36
|
+
./bin/prg job stop --daemon-name my_task
|
|
37
|
+
|
|
38
|
+
# Stop with custom message
|
|
39
|
+
./bin/prg job stop --daemon-name my_task --message "Task completed!"
|
|
40
|
+
|
|
41
|
+
# Stop with success checkmark
|
|
42
|
+
./bin/prg job stop --daemon-name my_task --message "Success!" --checkmark
|
|
43
|
+
|
|
44
|
+
# Stop with error state
|
|
45
|
+
./bin/prg job stop --daemon-name my_task --message "Failed" --error
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Checking daemon status
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Check if a daemon is running
|
|
52
|
+
./bin/prg job status --daemon-name my_task
|
|
53
|
+
|
|
54
|
+
# The PID file is stored at:
|
|
55
|
+
/tmp/ruby-progress/my_task.pid
|
|
56
|
+
|
|
57
|
+
# Or check the process manually:
|
|
58
|
+
ps aux | grep "prg twirl"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Advancing a fill progress bar
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Advance by 1 (default)
|
|
65
|
+
./bin/prg job advance --daemon-name mybar
|
|
66
|
+
|
|
67
|
+
# Advance by a specific amount
|
|
68
|
+
./bin/prg job advance --daemon-name mybar --amount 10
|
|
69
|
+
|
|
70
|
+
# Advance and update total
|
|
71
|
+
./bin/prg job advance --daemon-name mybar --amount 5 --total 100
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Using in shell scripts
|
|
75
|
+
|
|
76
|
+
Daemons are designed to work cleanly in shell scripts with no extraneous
|
|
77
|
+
output:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
#!/usr/bin/env bash
|
|
81
|
+
|
|
82
|
+
# Start a background progress indicator
|
|
83
|
+
prg twirl --daemon-as build --message "Building..."
|
|
84
|
+
|
|
85
|
+
# Do your work
|
|
86
|
+
make build
|
|
87
|
+
|
|
88
|
+
# Stop the indicator
|
|
89
|
+
prg job stop --daemon-name build --message "Build complete!" --checkmark
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The daemon will background silently with no shell job notifications, making
|
|
93
|
+
it perfect for scripts and automation.
|
|
94
|
+
|
|
95
|
+
## Technical Details
|
|
96
|
+
|
|
97
|
+
- **`PrgCLI.backgroundize`**: Forks the process; parent detaches child and
|
|
98
|
+
exits (returning control to shell), child creates new process group with
|
|
99
|
+
`Process.setsid` but keeps stdin/stdout/stderr so output remains visible
|
|
100
|
+
on the TTY. The use of `Process.detach` prevents shell job notifications.
|
|
101
|
+
- **PID files**: Stored in `/tmp/ruby-progress/DAEMON_NAME.pid`
|
|
102
|
+
- **Signal handling**: Daemons listen for INT, USR1, TERM, and HUP signals
|
|
103
|
+
to gracefully stop; USR2 for control messages (advance, etc.)
|
|
104
|
+
- **Control messages**: `job` subcommands use signal + message file to pass
|
|
105
|
+
messages to the daemon
|
|
106
|
+
- **Shell scripting**: No shell job completion messages are emitted, making
|
|
107
|
+
daemons suitable for use in scripts
|
|
108
|
+
|
|
109
|
+
## Job Subcommands
|
|
110
|
+
|
|
111
|
+
The `prg job` command provides control over running progress indicators:
|
|
112
|
+
|
|
113
|
+
- **`stop`**: Gracefully stop a running indicator with optional message,
|
|
114
|
+
checkmark, or error state
|
|
115
|
+
- **`advance`**: Increment a fill progress bar (sends data via control
|
|
116
|
+
message file)
|
|
117
|
+
- **`status`**: Check if a daemon is running and show its PID
|
|
118
|
+
|
|
119
|
+
### Backward Compatibility
|
|
120
|
+
|
|
121
|
+
The old `prg job send` command still works but is deprecated. It now
|
|
122
|
+
maps to `prg job stop` and displays a deprecation warning. Update your
|
|
123
|
+
scripts to use `prg job stop` instead.
|
|
124
|
+
|
|
125
|
+
## Fixed Bug
|
|
126
|
+
|
|
127
|
+
The `backgroundize` method had a logic error where the child process would return immediately instead of continuing execution. This has been fixed - the child now properly executes the daemon code and writes the PID file.
|
data/Gemfile
CHANGED
|
@@ -8,6 +8,14 @@ gemspec
|
|
|
8
8
|
group :development, :test do
|
|
9
9
|
gem 'rake', '~> 13.0'
|
|
10
10
|
gem 'rspec', '~> 3.0'
|
|
11
|
-
|
|
11
|
+
# RuboCop requires Ruby >= 2.7 for older versions, >= 3.0 for recent versions
|
|
12
|
+
# Pin to a version compatible with Ruby 2.7/3.0 for CI
|
|
13
|
+
if RUBY_VERSION >= '3.1'
|
|
14
|
+
gem 'rubocop', '~> 1.50'
|
|
15
|
+
else
|
|
16
|
+
gem 'rubocop', '~> 1.21.0'
|
|
17
|
+
end
|
|
12
18
|
gem 'simplecov', '~> 0.21', require: false
|
|
19
|
+
gem 'tty-cursor', '~> 0.7'
|
|
20
|
+
gem 'tty-screen', '~> 0.8'
|
|
13
21
|
end
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ruby-progress (1.3.
|
|
4
|
+
ruby-progress (1.3.5)
|
|
5
|
+
tty-cursor (~> 0.7)
|
|
6
|
+
tty-screen (~> 0.8)
|
|
5
7
|
|
|
6
8
|
GEM
|
|
7
9
|
remote: https://rubygems.org/
|
|
@@ -9,32 +11,32 @@ GEM
|
|
|
9
11
|
ast (2.4.3)
|
|
10
12
|
diff-lcs (1.6.2)
|
|
11
13
|
docile (1.4.1)
|
|
12
|
-
json (2.
|
|
14
|
+
json (2.15.1)
|
|
13
15
|
language_server-protocol (3.17.0.5)
|
|
14
16
|
lint_roller (1.1.0)
|
|
15
17
|
parallel (1.27.0)
|
|
16
|
-
parser (3.3.
|
|
18
|
+
parser (3.3.9.0)
|
|
17
19
|
ast (~> 2.4.1)
|
|
18
20
|
racc
|
|
19
|
-
prism (1.5.
|
|
21
|
+
prism (1.5.2)
|
|
20
22
|
racc (1.8.1)
|
|
21
23
|
rainbow (3.1.1)
|
|
22
24
|
rake (13.3.0)
|
|
23
|
-
regexp_parser (2.
|
|
24
|
-
rspec (3.13.
|
|
25
|
+
regexp_parser (2.11.3)
|
|
26
|
+
rspec (3.13.1)
|
|
25
27
|
rspec-core (~> 3.13.0)
|
|
26
28
|
rspec-expectations (~> 3.13.0)
|
|
27
29
|
rspec-mocks (~> 3.13.0)
|
|
28
|
-
rspec-core (3.13.
|
|
30
|
+
rspec-core (3.13.5)
|
|
29
31
|
rspec-support (~> 3.13.0)
|
|
30
32
|
rspec-expectations (3.13.5)
|
|
31
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
34
|
rspec-support (~> 3.13.0)
|
|
33
|
-
rspec-mocks (3.13.
|
|
35
|
+
rspec-mocks (3.13.5)
|
|
34
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
37
|
rspec-support (~> 3.13.0)
|
|
36
38
|
rspec-support (3.13.6)
|
|
37
|
-
rubocop (1.
|
|
39
|
+
rubocop (1.81.1)
|
|
38
40
|
json (~> 2.3)
|
|
39
41
|
language_server-protocol (~> 3.17.0.2)
|
|
40
42
|
lint_roller (~> 1.1.0)
|
|
@@ -42,10 +44,10 @@ GEM
|
|
|
42
44
|
parser (>= 3.3.0.2)
|
|
43
45
|
rainbow (>= 2.2.2, < 4.0)
|
|
44
46
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
45
|
-
rubocop-ast (>= 1.
|
|
47
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
46
48
|
ruby-progressbar (~> 1.7)
|
|
47
49
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
48
|
-
rubocop-ast (1.
|
|
50
|
+
rubocop-ast (1.47.1)
|
|
49
51
|
parser (>= 3.3.7.2)
|
|
50
52
|
prism (~> 1.4)
|
|
51
53
|
ruby-progressbar (1.13.0)
|
|
@@ -53,22 +55,27 @@ GEM
|
|
|
53
55
|
docile (~> 1.1)
|
|
54
56
|
simplecov-html (~> 0.11)
|
|
55
57
|
simplecov_json_formatter (~> 0.1)
|
|
56
|
-
simplecov-html (0.13.
|
|
58
|
+
simplecov-html (0.13.2)
|
|
57
59
|
simplecov_json_formatter (0.1.4)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
unicode-
|
|
60
|
+
tty-cursor (0.7.1)
|
|
61
|
+
tty-screen (0.8.2)
|
|
62
|
+
unicode-display_width (3.2.0)
|
|
63
|
+
unicode-emoji (~> 4.1)
|
|
64
|
+
unicode-emoji (4.1.0)
|
|
61
65
|
|
|
62
66
|
PLATFORMS
|
|
67
|
+
arm64-darwin-23
|
|
63
68
|
arm64-darwin-24
|
|
64
|
-
|
|
69
|
+
arm64-darwin-25
|
|
65
70
|
|
|
66
71
|
DEPENDENCIES
|
|
67
72
|
rake (~> 13.0)
|
|
68
73
|
rspec (~> 3.0)
|
|
69
|
-
rubocop (~> 1.
|
|
74
|
+
rubocop (~> 1.50)
|
|
70
75
|
ruby-progress!
|
|
71
76
|
simplecov (~> 0.21)
|
|
77
|
+
tty-cursor (~> 0.7)
|
|
78
|
+
tty-screen (~> 0.8)
|
|
72
79
|
|
|
73
80
|
BUNDLED WITH
|
|
74
|
-
2.
|
|
81
|
+
2.4.22
|