ruby-progress 1.3.4 → 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 +26 -13
- data/CHANGELOG.md +29 -49
- data/DAEMON_MODE.md +127 -0
- data/Gemfile +7 -1
- data/Gemfile.lock +19 -18
- data/JOB_CLI_REFACTOR.md +67 -0
- data/README.md +90 -94
- data/bin/prg +10 -16
- data/examples/daemon_job_example.sh +8 -10
- data/lib/ruby-progress/cli/fill_options.rb +2 -6
- data/lib/ruby-progress/cli/job_cli.rb +170 -131
- data/lib/ruby-progress/cli/ripple_cli.rb +13 -55
- data/lib/ruby-progress/cli/ripple_options.rb +14 -3
- data/lib/ruby-progress/cli/twirl_cli.rb +3 -1
- data/lib/ruby-progress/cli/twirl_options.rb +0 -4
- data/lib/ruby-progress/cli/twirl_runner.rb +0 -36
- data/lib/ruby-progress/cli/worm_cli.rb +2 -51
- data/lib/ruby-progress/cli/worm_options.rb +0 -6
- data/lib/ruby-progress/cli/worm_runner.rb +7 -1
- data/lib/ruby-progress/daemon.rb +2 -64
- data/lib/ruby-progress/fill_cli.rb +2 -72
- data/lib/ruby-progress/output_capture.rb +7 -2
- data/lib/ruby-progress/utils.rb +11 -6
- data/lib/ruby-progress/version.rb +5 -5
- data/ruby-progress.gemspec +41 -0
- data/scripts/coverage_analysis.rb +49 -0
- data/test_daemon.sh +20 -0
- metadata +6 -15
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
|
@@ -57,28 +57,28 @@ Lint/UselessAssignment:
|
|
57
57
|
- 'demo_gem.rb'
|
58
58
|
- 'spec/cli_integration_spec.rb'
|
59
59
|
|
60
|
-
# Offense count:
|
60
|
+
# Offense count: 46
|
61
61
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
62
62
|
Metrics/AbcSize:
|
63
63
|
Max: 121
|
64
64
|
|
65
|
-
# Offense count:
|
65
|
+
# Offense count: 56
|
66
66
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
67
67
|
# AllowedMethods: refine
|
68
68
|
Metrics/BlockLength:
|
69
|
-
Max:
|
69
|
+
Max: 136
|
70
70
|
|
71
71
|
# Offense count: 5
|
72
72
|
# Configuration parameters: CountComments, CountAsOne.
|
73
73
|
Metrics/ClassLength:
|
74
74
|
Max: 200
|
75
75
|
|
76
|
-
# Offense count:
|
76
|
+
# Offense count: 29
|
77
77
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
78
78
|
Metrics/CyclomaticComplexity:
|
79
|
-
Max:
|
79
|
+
Max: 22
|
80
80
|
|
81
|
-
# Offense count:
|
81
|
+
# Offense count: 68
|
82
82
|
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
83
83
|
Metrics/MethodLength:
|
84
84
|
Max: 140
|
@@ -86,17 +86,17 @@ Metrics/MethodLength:
|
|
86
86
|
# Offense count: 10
|
87
87
|
# Configuration parameters: CountComments, CountAsOne.
|
88
88
|
Metrics/ModuleLength:
|
89
|
-
Max:
|
89
|
+
Max: 231
|
90
90
|
|
91
91
|
# Offense count: 1
|
92
92
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
93
93
|
Metrics/ParameterLists:
|
94
94
|
Max: 6
|
95
95
|
|
96
|
-
# Offense count:
|
96
|
+
# Offense count: 28
|
97
97
|
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
98
98
|
Metrics/PerceivedComplexity:
|
99
|
-
Max:
|
99
|
+
Max: 22
|
100
100
|
|
101
101
|
# Offense count: 1
|
102
102
|
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
@@ -122,7 +122,7 @@ Style/Documentation:
|
|
122
122
|
- 'spec/**/*'
|
123
123
|
- 'test/**/*'
|
124
124
|
- 'lib/ruby-progress.rb'
|
125
|
-
- 'lib/ruby-progress/
|
125
|
+
- 'lib/ruby-progress/cli/job_cli.rb'
|
126
126
|
|
127
127
|
# Offense count: 1
|
128
128
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -132,6 +132,13 @@ Style/EmptyElse:
|
|
132
132
|
Exclude:
|
133
133
|
- 'lib/ruby-progress/ripple.rb'
|
134
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
|
+
|
135
142
|
# Offense count: 1
|
136
143
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
137
144
|
# Configuration parameters: EnforcedStyle.
|
@@ -155,6 +162,12 @@ Style/InfiniteLoop:
|
|
155
162
|
Exclude:
|
156
163
|
- 'lib/ruby-progress/ripple.rb'
|
157
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
|
+
|
158
171
|
# Offense count: 1
|
159
172
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
160
173
|
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
@@ -180,7 +193,7 @@ Style/StringLiterals:
|
|
180
193
|
Exclude:
|
181
194
|
- 'test_worm_flags.rb'
|
182
195
|
|
183
|
-
# Offense count:
|
196
|
+
# Offense count: 50
|
184
197
|
# This cop supports safe autocorrection (--autocorrect).
|
185
198
|
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
186
199
|
# URISchemes: http, https
|
data/CHANGELOG.md
CHANGED
@@ -5,67 +5,47 @@ 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
|
-
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- Merge commit: 99d9c39 (squash-merge of feature/output-handling)
|
29
|
-
|
30
|
-
## Unreleased
|
31
|
-
|
32
|
-
### Fixed
|
33
|
-
|
34
|
-
- 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.
|
35
|
-
|
36
|
-
### Changed
|
37
|
-
|
38
|
-
- Prepared for next patch release.
|
39
|
-
|
40
|
-
## 1.3.3 - 2025-10-14
|
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)
|
41
34
|
|
42
35
|
### Fixed
|
43
36
|
|
44
|
-
-
|
45
|
-
|
46
|
-
|
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
|
47
42
|
|
48
|
-
|
43
|
+
### Removed
|
49
44
|
|
50
|
-
|
51
|
-
|
52
|
-
### Added
|
53
|
-
|
54
|
-
- `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.
|
55
|
-
|
56
|
-
### Changed
|
57
|
-
|
58
|
-
- 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.
|
59
|
-
- Demo: updated `demo_screencast.rb` to call the local `bin/prg` when stopping the demo daemon to avoid conflicts with system-installed versions.
|
60
|
-
|
61
|
-
# CHANGELOG
|
62
|
-
|
63
|
-
All notable changes to this project will be documented in this file.
|
64
|
-
|
65
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
66
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
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
|
67
47
|
|
68
|
-
##
|
48
|
+
## 1.3.4 - 2024-10-14
|
69
49
|
|
70
50
|
### Fixed
|
71
51
|
|
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,7 +8,13 @@ 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
|
13
19
|
gem 'tty-cursor', '~> 0.7'
|
14
20
|
gem 'tty-screen', '~> 0.8'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-progress (1.3.
|
4
|
+
ruby-progress (1.3.5)
|
5
5
|
tty-cursor (~> 0.7)
|
6
6
|
tty-screen (~> 0.8)
|
7
7
|
|
@@ -11,32 +11,32 @@ GEM
|
|
11
11
|
ast (2.4.3)
|
12
12
|
diff-lcs (1.6.2)
|
13
13
|
docile (1.4.1)
|
14
|
-
json (2.
|
14
|
+
json (2.15.1)
|
15
15
|
language_server-protocol (3.17.0.5)
|
16
16
|
lint_roller (1.1.0)
|
17
17
|
parallel (1.27.0)
|
18
|
-
parser (3.3.
|
18
|
+
parser (3.3.9.0)
|
19
19
|
ast (~> 2.4.1)
|
20
20
|
racc
|
21
|
-
prism (1.5.
|
21
|
+
prism (1.5.2)
|
22
22
|
racc (1.8.1)
|
23
23
|
rainbow (3.1.1)
|
24
24
|
rake (13.3.0)
|
25
|
-
regexp_parser (2.
|
26
|
-
rspec (3.13.
|
25
|
+
regexp_parser (2.11.3)
|
26
|
+
rspec (3.13.1)
|
27
27
|
rspec-core (~> 3.13.0)
|
28
28
|
rspec-expectations (~> 3.13.0)
|
29
29
|
rspec-mocks (~> 3.13.0)
|
30
|
-
rspec-core (3.13.
|
30
|
+
rspec-core (3.13.5)
|
31
31
|
rspec-support (~> 3.13.0)
|
32
32
|
rspec-expectations (3.13.5)
|
33
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
34
34
|
rspec-support (~> 3.13.0)
|
35
|
-
rspec-mocks (3.13.
|
35
|
+
rspec-mocks (3.13.5)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
37
|
rspec-support (~> 3.13.0)
|
38
38
|
rspec-support (3.13.6)
|
39
|
-
rubocop (1.
|
39
|
+
rubocop (1.81.1)
|
40
40
|
json (~> 2.3)
|
41
41
|
language_server-protocol (~> 3.17.0.2)
|
42
42
|
lint_roller (~> 1.1.0)
|
@@ -44,10 +44,10 @@ GEM
|
|
44
44
|
parser (>= 3.3.0.2)
|
45
45
|
rainbow (>= 2.2.2, < 4.0)
|
46
46
|
regexp_parser (>= 2.9.3, < 3.0)
|
47
|
-
rubocop-ast (>= 1.
|
47
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
49
|
unicode-display_width (>= 2.4.0, < 4.0)
|
50
|
-
rubocop-ast (1.
|
50
|
+
rubocop-ast (1.47.1)
|
51
51
|
parser (>= 3.3.7.2)
|
52
52
|
prism (~> 1.4)
|
53
53
|
ruby-progressbar (1.13.0)
|
@@ -55,26 +55,27 @@ GEM
|
|
55
55
|
docile (~> 1.1)
|
56
56
|
simplecov-html (~> 0.11)
|
57
57
|
simplecov_json_formatter (~> 0.1)
|
58
|
-
simplecov-html (0.13.
|
58
|
+
simplecov-html (0.13.2)
|
59
59
|
simplecov_json_formatter (0.1.4)
|
60
60
|
tty-cursor (0.7.1)
|
61
61
|
tty-screen (0.8.2)
|
62
|
-
unicode-display_width (3.
|
63
|
-
unicode-emoji (~> 4.
|
64
|
-
unicode-emoji (4.0
|
62
|
+
unicode-display_width (3.2.0)
|
63
|
+
unicode-emoji (~> 4.1)
|
64
|
+
unicode-emoji (4.1.0)
|
65
65
|
|
66
66
|
PLATFORMS
|
67
|
+
arm64-darwin-23
|
67
68
|
arm64-darwin-24
|
68
|
-
|
69
|
+
arm64-darwin-25
|
69
70
|
|
70
71
|
DEPENDENCIES
|
71
72
|
rake (~> 13.0)
|
72
73
|
rspec (~> 3.0)
|
73
|
-
rubocop (~> 1.
|
74
|
+
rubocop (~> 1.50)
|
74
75
|
ruby-progress!
|
75
76
|
simplecov (~> 0.21)
|
76
77
|
tty-cursor (~> 0.7)
|
77
78
|
tty-screen (~> 0.8)
|
78
79
|
|
79
80
|
BUNDLED WITH
|
80
|
-
2.
|
81
|
+
2.4.22
|
data/JOB_CLI_REFACTOR.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Job CLI Refactoring Summary
|
2
|
+
|
3
|
+
## Changes Made
|
4
|
+
|
5
|
+
Restructured `prg job` to use proper subcommands instead of being hardcoded to only send stop signals.
|
6
|
+
|
7
|
+
### Before
|
8
|
+
```bash
|
9
|
+
prg job send --daemon-name mytask --message "Done!"
|
10
|
+
```
|
11
|
+
|
12
|
+
### After
|
13
|
+
```bash
|
14
|
+
# Stop a daemon
|
15
|
+
prg job stop --daemon-name mytask --message "Done!"
|
16
|
+
|
17
|
+
# Check daemon status
|
18
|
+
prg job status --daemon-name mytask
|
19
|
+
|
20
|
+
# Advance a fill progress bar
|
21
|
+
prg job advance --daemon-name mybar --amount 10
|
22
|
+
```
|
23
|
+
|
24
|
+
## New Subcommands
|
25
|
+
|
26
|
+
1. **`prg job stop`** - Stop a running progress indicator
|
27
|
+
- Options: `--daemon-name`, `--pid-file`, `--message`, `--checkmark`, `--error`
|
28
|
+
- Replaces the old `prg job send` command
|
29
|
+
|
30
|
+
2. **`prg job status`** - Check if a daemon is running
|
31
|
+
- Options: `--daemon-name`, `--pid-file`
|
32
|
+
- Shows PID and running status
|
33
|
+
|
34
|
+
3. **`prg job advance`** - Advance a fill progress bar
|
35
|
+
- Options: `--daemon-name`, `--pid-file`, `--amount`, `--total`
|
36
|
+
- Sends control message to update progress
|
37
|
+
- Uses USR2 signal to notify daemon
|
38
|
+
|
39
|
+
## Implementation Details
|
40
|
+
|
41
|
+
- **Main entry point**: `JobCLI.run(argv)` - dispatches to subcommands
|
42
|
+
- **Backward compatibility**: `prg job send` still works but shows deprecation warning
|
43
|
+
- **Control messages**: Uses JSON files (`.pid.msg`) to pass data to daemons
|
44
|
+
- **Signal handling**: USR2 for control messages, USR1/INT/TERM/HUP for stop
|
45
|
+
- **Silent operation**: No confirmation messages for script-friendly usage -
|
46
|
+
only daemon output is shown
|
47
|
+
|
48
|
+
## Files Modified
|
49
|
+
|
50
|
+
- `lib/ruby-progress/cli/job_cli.rb` - Complete rewrite with subcommands
|
51
|
+
- `bin/prg` - Updated to call `JobCLI.run` instead of `JobCLI.send`
|
52
|
+
- `DAEMON_MODE.md` - Updated documentation with new command syntax
|
53
|
+
|
54
|
+
## Testing
|
55
|
+
|
56
|
+
All three subcommands tested and working:
|
57
|
+
- ✅ `prg job stop` - Gracefully stops daemons
|
58
|
+
- ✅ `prg job status` - Shows daemon status
|
59
|
+
- ✅ `prg job send` - Backward compatibility with deprecation warning
|
60
|
+
- ⏳ `prg job advance` - Ready for implementation (requires daemon-side handling)
|
61
|
+
|
62
|
+
## Next Steps
|
63
|
+
|
64
|
+
To fully implement `job advance`, the fill daemon needs to:
|
65
|
+
1. Listen for USR2 signal
|
66
|
+
2. Read control message file on USR2
|
67
|
+
3. Parse JSON and update progress accordingly
|