ruby-progress 1.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: df0ca84734879ec0824018482709764c6380d33e6c03036d442eb584d2bc079b
4
+ data.tar.gz: 284b601b3bfdb42512549f90af2a174226259dd305a707729988f807c13c59bf
5
+ SHA512:
6
+ metadata.gz: 946ec374e45b2048a4702b76108b5eec7c52ddbabcacf5744cfee7f131e1d730e414878afcdbf8296111e64a91419c3d7e20f38e4faa4c60426b8f014484a1f3
7
+ data.tar.gz: 6597651f4119954be581cbc10f1400832c1a3da2bc0bb5dfda446d5785c9f461ca19ed357012ffc60767a433dd0531b40e3c684d541403906b5007726742e597
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.1] - 2025-01-01
9
+
10
+ ### Added
11
+ - Packaged as proper Ruby gem with library structure
12
+ - Added RSpec test suite with comprehensive coverage
13
+ - Added Rake tasks for version management and packaging
14
+ - Added --checkmark and --stdout flags to Worm (ported from Ripple)
15
+ - Added infinite mode to Worm (runs indefinitely without command like Ripple)
16
+ - **Added unified `prg` binary with subcommands for both `ripple` and `worm`**
17
+ - **Enhanced command-line interface with consistent flag support across both tools**
18
+ - **Added `RubyProgress::Utils` module with universal terminal control utilities**
19
+ - **Centralized cursor control, line clearing, and completion message functionality**
20
+
21
+ ### Changed
22
+ - Moved classes into RubyProgress module
23
+ - Separated logic into lib/ruby-progress/ structure
24
+ - Created proper bin/ executables for ripple and worm
25
+ - Updated README with gem installation and usage instructions
26
+
27
+ ### Fixed
28
+ - Fixed duplicate error messages in Worm error handling
29
+ - Improved signal handling and cursor management
30
+
31
+ ## [1.0.0] - 2025-10-09
32
+
33
+ ### Added
34
+ - Initial release with two progress indicators:
35
+ - Ripple: Text ripple animation with 30+ spinner styles, rainbow effects, and command execution
36
+ - Worm: Unicode wave animation with multiple styles and configurable options
37
+ - Command-line interfaces for both tools
38
+ - Support for custom speeds, messages, and styling options
39
+ - Integration with system commands and process monitoring
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in ruby-progress.gemspec
6
+ gemspec
7
+
8
+ group :development, :test do
9
+ gem 'rake', '~> 13.0'
10
+ gem 'rspec', '~> 3.0'
11
+ gem 'rubocop', '~> 1.21'
12
+ gem 'simplecov', '~> 0.21', require: false
13
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-progress (1.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.3)
10
+ diff-lcs (1.6.2)
11
+ docile (1.4.1)
12
+ json (2.12.2)
13
+ language_server-protocol (3.17.0.5)
14
+ lint_roller (1.1.0)
15
+ parallel (1.27.0)
16
+ parser (3.3.8.0)
17
+ ast (~> 2.4.1)
18
+ racc
19
+ prism (1.5.1)
20
+ racc (1.8.1)
21
+ rainbow (3.1.1)
22
+ rake (13.3.0)
23
+ regexp_parser (2.10.0)
24
+ rspec (3.13.0)
25
+ rspec-core (~> 3.13.0)
26
+ rspec-expectations (~> 3.13.0)
27
+ rspec-mocks (~> 3.13.0)
28
+ rspec-core (3.13.3)
29
+ rspec-support (~> 3.13.0)
30
+ rspec-expectations (3.13.5)
31
+ diff-lcs (>= 1.2.0, < 2.0)
32
+ rspec-support (~> 3.13.0)
33
+ rspec-mocks (3.13.4)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.13.0)
36
+ rspec-support (3.13.6)
37
+ rubocop (1.75.7)
38
+ json (~> 2.3)
39
+ language_server-protocol (~> 3.17.0.2)
40
+ lint_roller (~> 1.1.0)
41
+ parallel (~> 1.10)
42
+ parser (>= 3.3.0.2)
43
+ rainbow (>= 2.2.2, < 4.0)
44
+ regexp_parser (>= 2.9.3, < 3.0)
45
+ rubocop-ast (>= 1.44.0, < 2.0)
46
+ ruby-progressbar (~> 1.7)
47
+ unicode-display_width (>= 2.4.0, < 4.0)
48
+ rubocop-ast (1.44.1)
49
+ parser (>= 3.3.7.2)
50
+ prism (~> 1.4)
51
+ ruby-progressbar (1.13.0)
52
+ simplecov (0.22.0)
53
+ docile (~> 1.1)
54
+ simplecov-html (~> 0.11)
55
+ simplecov_json_formatter (~> 0.1)
56
+ simplecov-html (0.13.1)
57
+ simplecov_json_formatter (0.1.4)
58
+ unicode-display_width (3.1.4)
59
+ unicode-emoji (~> 4.0, >= 4.0.4)
60
+ unicode-emoji (4.0.4)
61
+
62
+ PLATFORMS
63
+ arm64-darwin-24
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ rake (~> 13.0)
68
+ rspec (~> 3.0)
69
+ rubocop (~> 1.21)
70
+ ruby-progress!
71
+ simplecov (~> 0.21)
72
+
73
+ BUNDLED WITH
74
+ 2.6.8
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Brett Terpstra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,353 @@
1
+ # Ruby Progress Indicators
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/ruby-progress.svg)](https://badge.fury.io/rb/ruby-progress)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![RSpec Tests](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml/badge.svg)](https://github.com/ttscoff/ruby-progress/actions/workflows/rspec.yml)
6
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%202.5.0-ruby.svg)](https://www.ruby-lang.org/)
7
+ [![Coverage Status](https://img.shields.io/badge/coverage-55%25-yellow.svg)](#)
8
+
9
+ This repository contains two different Ruby progress indicator projects: **Ripple** and **Worm**. Both provide animated terminal progress indicators with different visual styles and features.
10
+
11
+ ## Unified Interface
12
+
13
+ The gem provides a unified `prg` command that supports both progress indicators through subcommands:
14
+
15
+ ```bash
16
+ # Install the gem
17
+ gem install ruby-progress
18
+
19
+ # Use worm-style animation
20
+ prg worm --message "Processing data" --style blocks --checkmark
21
+
22
+ # Use ripple-style animation
23
+ prg ripple "Loading..." --rainbow --speed fast
24
+
25
+ # With command execution
26
+ prg worm --command "sleep 5" --success "Completed!" --error "Failed!" --checkmark
27
+ prg ripple "Building..." --command "make build" --success "Build complete!" --stdout
28
+ ```
29
+
30
+ ### Global Options
31
+ - `prg --help` - Show main help
32
+ - `prg --version` - Show version info
33
+ - `prg <subcommand> --help` - Show specific subcommand help
34
+
35
+ ### Common Options (available for both subcommands)
36
+ - `--speed SPEED` - Animation speed (fast/medium/slow or f/m/s)
37
+ - `--message MESSAGE` - Message to display
38
+ - `--command COMMAND` - Command to execute during animation
39
+ - `--success MESSAGE` - Success message after completion
40
+ - `--error MESSAGE` - Error message on failure
41
+ - `--checkmark` - Show checkmarks (✅ success, 🛑 failure)
42
+ - `--stdout` - Output command results to STDOUT
43
+
44
+ ## Table of Contents
45
+
46
+ - [Ruby Progress Indicators](#ruby-progress-indicators)
47
+ - [Unified Interface](#unified-interface)
48
+ - [Global Options](#global-options)
49
+ - [Common Options (available for both subcommands)](#common-options-available-for-both-subcommands)
50
+ - [Ripple](#ripple)
51
+ - [Ripple Features](#ripple-features)
52
+ - [Ripple Usage](#ripple-usage)
53
+ - [Command Line](#command-line)
54
+ - [Ripple Command Line Options](#ripple-command-line-options)
55
+ - [Ripple Library Usage](#ripple-library-usage)
56
+ - [Available Spinners](#available-spinners)
57
+ - [Worm](#worm)
58
+ - [Worm Features](#worm-features)
59
+ - [Worm Usage](#worm-usage)
60
+ - [Command Line](#command-line-1)
61
+ - [Worm Command Line Options](#worm-command-line-options)
62
+ - [Worm Library Usage](#worm-library-usage)
63
+ - [Animation Styles](#animation-styles)
64
+ - [Circles](#circles)
65
+ - [Blocks](#blocks)
66
+ - [Geometric](#geometric)
67
+ - [Requirements](#requirements)
68
+ - [Installation](#installation)
69
+ - [Contributing](#contributing)
70
+ - [License](#license)
71
+
72
+ ---
73
+
74
+ ## Ripple
75
+
76
+ Ripple is a sophisticated text animation library that creates ripple effects across text strings in the terminal. It supports various animation modes including bidirectional movement, rainbow colors, spinners, and case transformations.
77
+
78
+ ### Ripple Features
79
+
80
+ - **Text ripple animations** with customizable speed and direction
81
+ - **Rainbow color effects** that cycle through colors
82
+ - **30+ built-in spinner styles** (dots, arrows, blocks, etc.)
83
+ - **Multiple animation formats**: forward-only, bidirectional
84
+ - **Command execution** with animated progress display
85
+ - **Custom success/failure messages** with optional checkmarks
86
+ - **Case transformation modes** (uppercase/lowercase rippling)
87
+ - **Inverse highlighting** for different visual effects
88
+
89
+ ### Ripple Usage
90
+
91
+ #### Command Line
92
+
93
+ ```bash
94
+ # Basic text animation
95
+ ./ripple "Loading..."
96
+
97
+ # With options
98
+ ./ripple "Processing Data" --speed fast --rainbow --direction bidirectional
99
+
100
+ # Run a command with progress animation
101
+ ./ripple "Installing packages" --command "sleep 5" --success "Installation complete!" --checkmark
102
+
103
+ # Use a spinner instead of text ripple
104
+ ./ripple "Working" --spinner dots --spinner-pos before
105
+ ```
106
+
107
+ #### Ripple Command Line Options
108
+
109
+ | Option | Description |
110
+ | ----------------------- | ------------------------------------------------------------- |
111
+ | `-s, --speed SPEED` | Animation speed (1-10, fast/medium/slow, or f/m/s) |
112
+ | `-l, --length LENGTH` | Number of dots to display |
113
+ | `-m, --message MESSAGE` | Message to display before animation |
114
+ | `--style STYLE` | Animation style (blocks/geometric/circles or b/g/c) |
115
+ | `-c, --command COMMAND` | Command to run (optional - runs indefinitely without command) |
116
+ | `--success TEXT` | Text to display on successful completion |
117
+ | `--error TEXT` | Text to display on error |
118
+ | `--checkmark` | Show checkmarks (✅ for success, 🛑 for failure) |
119
+ | `--stdout` | Output captured command result to STDOUT |
120
+
121
+ ### Ripple Library Usage
122
+
123
+ You can also use Ripple as a Ruby library:
124
+
125
+ ```ruby
126
+ require 'ruby-progress'
127
+
128
+ # Simple progress block
129
+ result = RubyProgress::Ripple.progress("Processing...") do
130
+ sleep 5 # Your actual work here
131
+ end
132
+
133
+ # With options
134
+ rippler = RubyProgress::Ripple.new("Loading Data", {
135
+ speed: :fast,
136
+ format: :bidirectional,
137
+ rainbow: true,
138
+ spinner: :dots
139
+ })
140
+
141
+ RubyProgress::Ripple.hide_cursor
142
+ while some_condition
143
+ rippler.advance
144
+ end
145
+ RubyProgress::Ripple.show_cursor
146
+ ```
147
+
148
+ ### Available Spinners
149
+
150
+ Ripple includes 30+ different spinner styles:
151
+
152
+ - **Classic**: `|`, `/`, `—`, `\`
153
+ - **Dots**: Various braille dot patterns (dots, dots_2, dots_3, etc.)
154
+ - **Arrows**: Arrow patterns and pulsing arrows
155
+ - **Blocks**: Block characters in different patterns
156
+ - **Geometric**: Circles, triangles, arcs
157
+ - **Progress bars**: Bounce, push, pulse effects
158
+ - **And many more!**
159
+
160
+ Use `./ripple --list-spinners` to see all available options.
161
+
162
+ ---
163
+
164
+ ## Worm
165
+
166
+ Worm is a clean, Unicode-based progress indicator that creates a ripple effect using combining characters. It's designed for running commands with visual progress feedback.
167
+
168
+ ### Worm Features
169
+
170
+ - **Ripple wave animation** using Unicode characters
171
+ - **Multiple visual styles** (circles, blocks, geometric)
172
+ - **Configurable speed** (1-10 scale or named speeds)
173
+ - **Customizable length** and messages
174
+ - **Command execution** with progress indication
175
+ - **Success/error message customization**
176
+ - **Proper signal handling** and cursor management
177
+
178
+ ### Worm Usage
179
+
180
+ #### Command Line
181
+
182
+ ```bash
183
+ # Run indefinitely without a command (like ripple)
184
+ ./worm.rb --message "Loading..." --speed fast --style circles
185
+
186
+ # Run a command with progress animation
187
+ ./worm.rb --command "sleep 5" --message "Installing" --success "Done!"
188
+
189
+ # Customize the animation
190
+ ./worm.rb --command "make build" --speed fast --length 5 --style blocks
191
+
192
+ # With custom error handling
193
+ ./worm.rb --command "risky_operation" --error "Operation failed" --style geometric
194
+
195
+ # With checkmarks for visual feedback
196
+ ./worm.rb --command "npm install" --success "Installation complete!" --checkmark
197
+
198
+ # Capture and display command output
199
+ ./worm.rb --command "git status" --message "Checking status" --stdout
200
+
201
+ # Combine checkmarks and stdout output
202
+ ./worm.rb --command "echo 'Build output'" --success "Build complete!" --checkmark --stdout
203
+ ```
204
+
205
+ #### Worm Command Line Options
206
+
207
+ | Option | Description |
208
+ | ----------------------- | --------------------------------------------------- |
209
+ | `-s, --speed SPEED` | Animation speed (1-10, fast/medium/slow, or f/m/s) |
210
+ | `-l, --length LENGTH` | Number of dots to display |
211
+ | `-m, --message MESSAGE` | Message to display before animation |
212
+ | `--style STYLE` | Animation style (blocks/geometric/circles or b/g/c) |
213
+ | `-c, --command COMMAND` | Command to run (required) |
214
+ | `--success TEXT` | Text to display on successful completion |
215
+ | `--error TEXT` | Text to display on error |
216
+
217
+ ### Worm Library Usage
218
+
219
+ ```ruby
220
+ require 'ruby-progress'
221
+
222
+ # Create and run animation with a block
223
+ worm = RubyProgress::Worm.new(
224
+ length: 4,
225
+ message: "Processing",
226
+ speed: 'fast',
227
+ style: 'circles'
228
+ )
229
+
230
+ result = worm.animate(
231
+ success: "Complete!",
232
+ error: "Failed!"
233
+ ) do
234
+ # Your work here
235
+ some_long_running_task
236
+ end
237
+
238
+ # Or run with a command
239
+ worm = RubyProgress::Worm.new(command: "bundle install")
240
+ worm.run_with_command
241
+ ```
242
+
243
+ ### Animation Styles
244
+
245
+ Worm supports three built-in animation styles:
246
+
247
+ #### Circles
248
+ - Baseline: `·` (middle dot)
249
+ - Midline: `●` (black circle)
250
+ - Peak: `⬤` (large circle)
251
+
252
+ #### Blocks
253
+ - Baseline: `▁` (lower eighth block)
254
+ - Midline: `▄` (lower half block)
255
+ - Peak: `█` (full block)
256
+
257
+ #### Geometric
258
+ - Baseline: `▪` (small black square)
259
+ - Midline: `▫` (small white square)
260
+ - Peak: `■` (large black square)
261
+
262
+ ---
263
+
264
+ ## Requirements
265
+
266
+ Both projects require:
267
+ - Ruby 2.5 or higher
268
+ - Terminal with Unicode support (for Worm)
269
+ - ANSI color support (for Ripple rainbow effects)
270
+
271
+ ## Installation
272
+
273
+ ### As a Gem (Recommended)
274
+
275
+ ```bash
276
+ gem install ruby-progress
277
+ ```
278
+
279
+ ### From Source
280
+
281
+ 1. Clone this repository
282
+ 2. Build and install:
283
+ ```bash
284
+ bundle install
285
+ bundle exec rake build
286
+ gem install pkg/ruby-progress-*.gem
287
+ ```
288
+
289
+ ### Development
290
+
291
+ 1. Clone the repository
292
+ 2. Install dependencies:
293
+ ```bash
294
+ bundle install
295
+ ```
296
+ 3. Run tests:
297
+ ```bash
298
+ bundle exec rspec
299
+ ```
300
+
301
+ ## Universal Utilities
302
+
303
+ The gem provides universal utilities in the `RubyProgress::Utils` module for common terminal operations:
304
+
305
+ ### Terminal Control
306
+
307
+ ```ruby
308
+ require 'ruby-progress'
309
+
310
+ # Cursor control
311
+ RubyProgress::Utils.hide_cursor # Hide terminal cursor
312
+ RubyProgress::Utils.show_cursor # Show terminal cursor
313
+ RubyProgress::Utils.clear_line # Clear current line
314
+ ```
315
+
316
+ ### Completion Messages
317
+
318
+ ```ruby
319
+ # Basic completion message
320
+ RubyProgress::Utils.display_completion("Task completed!")
321
+
322
+ # With success/failure indication and checkmarks
323
+ RubyProgress::Utils.display_completion(
324
+ "Build successful!",
325
+ success: true,
326
+ show_checkmark: true
327
+ )
328
+
329
+ RubyProgress::Utils.display_completion(
330
+ "Build failed!",
331
+ success: false,
332
+ show_checkmark: true,
333
+ output_stream: :stdout # :stdout, :stderr, or :warn (default)
334
+ )
335
+
336
+ # Clear line and display completion (useful for replacing progress indicators)
337
+ RubyProgress::Utils.complete_with_clear(
338
+ "Processing complete!",
339
+ success: true,
340
+ show_checkmark: true,
341
+ output_stream: :stdout
342
+ )
343
+ ```
344
+
345
+ These utilities are used internally by both Ripple and Worm classes and are available for use in your own applications.
346
+
347
+ ## Contributing
348
+
349
+ Feel free to submit issues and pull requests to improve either project!
350
+
351
+ ## License
352
+
353
+ Both projects are provided as-is for educational and practical use.
data/Rakefile ADDED
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new
9
+
10
+ task default: %i[spec rubocop]
11
+
12
+ # Version management tasks
13
+ desc 'Show current version'
14
+ task :version do
15
+ require_relative 'lib/ruby-progress/version'
16
+ puts RubyProgress::VERSION
17
+ end
18
+
19
+ desc 'Bump patch version'
20
+ task :bump_patch do
21
+ bump_version(:patch)
22
+ end
23
+
24
+ desc 'Bump minor version'
25
+ task :bump_minor do
26
+ bump_version(:minor)
27
+ end
28
+
29
+ desc 'Bump major version'
30
+ task :bump_major do
31
+ bump_version(:major)
32
+ end
33
+
34
+ def bump_version(type)
35
+ require_relative 'lib/ruby-progress/version'
36
+ version_parts = RubyProgress::VERSION.split('.').map(&:to_i)
37
+
38
+ case type
39
+ when :patch
40
+ version_parts[2] += 1
41
+ when :minor
42
+ version_parts[1] += 1
43
+ version_parts[2] = 0
44
+ when :major
45
+ version_parts[0] += 1
46
+ version_parts[1] = 0
47
+ version_parts[2] = 0
48
+ end
49
+
50
+ new_version = version_parts.join('.')
51
+
52
+ # Update version file
53
+ version_file = 'lib/ruby-progress/version.rb'
54
+ content = File.read(version_file)
55
+ content.gsub!(/VERSION = '[^']*'/, "VERSION = '#{new_version}'")
56
+ File.write(version_file, content)
57
+
58
+ puts "Version bumped from #{RubyProgress::VERSION} to #{new_version}"
59
+ end
60
+
61
+ # Package management
62
+ desc 'Clean up generated files'
63
+ task :clobber do
64
+ require 'fileutils'
65
+ FileUtils.rm_rf('pkg')
66
+ FileUtils.rm_rf('coverage')
67
+ puts 'Cleaned up generated files'
68
+ end
69
+
70
+ desc 'Build and install gem locally'
71
+ task install_local: :build do
72
+ require_relative 'lib/ruby-progress/version'
73
+ gem_file = "pkg/ruby-progress-#{RubyProgress::VERSION}.gem"
74
+ system("gem install #{gem_file}")
75
+ end
76
+
77
+ desc 'Test installed binaries'
78
+ task :test_binaries do
79
+ puts 'Testing ripple binary...'
80
+ system('ripple --version') || abort('ripple binary test failed')
81
+ puts 'Testing worm binary...'
82
+ system('worm --version') || abort('worm binary test failed')
83
+ puts 'Binary tests passed!'
84
+ end