ruby-progress 1.2.0 → 1.3.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.
data/quick_demo.rb ADDED
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Short demo script for interactive/manual testing of ruby-progress features.
5
+ # Focuses on a compact set of examples used during development and quick checks.
6
+ ##
7
+ #
8
+ # A shorter, more focused demo script for quick testing and demonstrations.
9
+ # This version focuses on the most impressive features without long pauses.
10
+ # QuickDemo: small, focused demo runner used for development and CI smoke tests.
11
+ class QuickDemo
12
+ def initialize
13
+ @gem_path = File.expand_path('bin/prg', __dir__)
14
+ @lib_path = File.expand_path('lib', __dir__)
15
+ end
16
+
17
+ def run
18
+ puts "\nšŸš€ Ruby Progress Gem v1.2.2 - Quick Demo\n"
19
+ puts "=========================================\n\n"
20
+
21
+ # Showcase the most impressive features
22
+ showcase_ends_feature
23
+ showcase_custom_styles
24
+ showcase_direction_control
25
+ showcase_error_handling
26
+
27
+ puts "\n✨ Demo complete! Install with: gem install ruby-progress"
28
+ puts "šŸ“š GitHub: https://github.com/ttscoff/ruby-progress\n\n"
29
+ end
30
+
31
+ private
32
+
33
+ def showcase_ends_feature
34
+ puts 'šŸŽÆ Universal --ends Flag (NEW in v1.2.0)'
35
+ puts '-' * 40
36
+
37
+ puts 'Ripple with brackets:'
38
+ run_cmd("ripple 'Loading...' --ends '[]' --command 'sleep 3' --success 'Bracketed!' --checkmark")
39
+
40
+ puts "\nWorm with angles:"
41
+ run_cmd("worm --length 10 --ends '<<>>' --command 'sleep 3' --success 'Angled!' --checkmark")
42
+
43
+ puts "\nTwirl with emojis:"
44
+ run_cmd("twirl --ends 'ā™„ļøšŸ‘' --command 'sleep 2' --success 'Decorated!'")
45
+
46
+ puts "\n"
47
+ end
48
+
49
+ def showcase_custom_styles
50
+ puts 'šŸŽØ Custom Worm Styles (NEW in v1.2.0)'
51
+ puts '-' * 40
52
+
53
+ puts 'ASCII custom pattern:'
54
+ run_cmd("worm --length 10 --style custom=_-= --command 'sleep 3' --success 'Custom ASCII!'")
55
+
56
+ puts "\nEmoji custom pattern:"
57
+ run_cmd("worm --length 10 --style custom=🟦🟨🟄 --command 'sleep 3' --success 'Custom emoji!'")
58
+
59
+ puts "\n"
60
+ end
61
+
62
+ def showcase_direction_control
63
+ puts 'šŸƒ Direction Control (NEW in v1.2.0)'
64
+ puts '-' * 40
65
+
66
+ puts 'Forward-only worm:'
67
+ run_cmd("worm --length 10 --direction forward --command 'sleep 4' --success 'Always forward!'")
68
+
69
+ puts "\nCombined features:"
70
+ run_cmd("worm --length 10 --style custom=.*🟔 --direction forward --ends '怐怑' --command 'sleep 4' --success 'Ultimate combo!'")
71
+
72
+ puts "\n"
73
+ end
74
+
75
+ def showcase_error_handling
76
+ puts 'āŒ Error Handling'
77
+ puts '-' * 40
78
+
79
+ puts 'Graceful failure:'
80
+ run_cmd("ripple 'Processing...' --command 'sleep 2 && exit 1' --error 'Task failed!' --checkmark")
81
+
82
+ puts "\n"
83
+ end
84
+
85
+ def print_command(args)
86
+ # ANSI color codes
87
+ cyan = "\e[36m"
88
+ bright_red = "\e[91m"
89
+ bright_white = "\e[97m"
90
+ bright_green = "\e[92m"
91
+ reset = "\e[0m"
92
+
93
+ # Start with the base command
94
+ colored_cmd = "$ #{cyan}prg#{reset}"
95
+
96
+ # Use regex to colorize the command
97
+ # First capture the subcommand (ripple, worm, twirl)
98
+ colored_args = args.gsub(/^(ripple|worm|twirl)/, "#{bright_red}\\1#{reset}")
99
+
100
+ # Colorize flags (--flag-name) in bright white and their values in bright green
101
+ colored_args = colored_args.gsub(/(--[\w-]+)(\s+|=)('[^']*'|"[^"]*"|\S+)/) do |_match|
102
+ flag = ::Regexp.last_match(1)
103
+ separator = ::Regexp.last_match(2)
104
+ value = ::Regexp.last_match(3)
105
+ "#{bright_white}#{flag}#{reset}#{separator}#{bright_green}#{value}#{reset}"
106
+ end
107
+
108
+ # Colorize short flags (-f) in bright white and their values in bright green
109
+ colored_args = colored_args.gsub(/(-[a-zA-Z])(\s+)('[^']*'|"[^"]*"|\S+)/) do |_match|
110
+ flag = ::Regexp.last_match(1)
111
+ separator = ::Regexp.last_match(2)
112
+ value = ::Regexp.last_match(3)
113
+ "#{bright_white}#{flag}#{reset}#{separator}#{bright_green}#{value}#{reset}"
114
+ end
115
+
116
+ puts "#{colored_cmd} #{colored_args}"
117
+ end
118
+
119
+ def run_cmd(args)
120
+ full_cmd = "ruby -I #{@lib_path} #{@gem_path} #{args}"
121
+ print_command(args)
122
+ system(full_cmd)
123
+ puts
124
+ end
125
+ end
126
+
127
+ # Quick execution
128
+ if __FILE__ == $PROGRAM_NAME
129
+ begin
130
+ QuickDemo.new.run
131
+ rescue Interrupt
132
+ puts "\n\nDemo stopped. Thanks!"
133
+ end
134
+ end
data/readme_demo.rb ADDED
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # README Demo Script - Ruby Progress Gem
5
+ # =====================================
6
+ #
7
+ # ReadmeDemo: demos and examples intended for inclusion in the README
8
+ # and other documentation. Keeps examples compact and easy to run.
9
+ class ReadmeDemo
10
+ def initialize
11
+ @gem_path = File.expand_path('bin/prg', __dir__)
12
+ @lib_path = File.expand_path('lib', __dir__)
13
+ end
14
+
15
+ def run_all_demos
16
+ puts 'Ruby Progress Gem - README Examples'
17
+ puts '==================================='
18
+ puts
19
+
20
+ basic_examples
21
+ style_examples
22
+ new_features_examples
23
+ advanced_examples
24
+
25
+ puts "\nAll examples completed!"
26
+ end
27
+
28
+ def basic_examples
29
+ section('Basic Usage Examples')
30
+
31
+ demo('Basic ripple animation',
32
+ "ripple --command 'sleep 3' --success 'Download complete!'")
33
+
34
+ demo('Basic worm progress bar',
35
+ "worm --length 10 --command 'sleep 4' --success 'Processing finished!'")
36
+
37
+ demo('Basic spinner',
38
+ "twirl --command 'sleep 2' --success 'Task completed!'")
39
+ end
40
+
41
+ def style_examples
42
+ section('Style Variations')
43
+
44
+ demo('Ripple pulse style',
45
+ "ripple --style pulse --command 'sleep 3' --success 'Pulsing!'")
46
+
47
+ demo('Worm with emoji style',
48
+ "worm --length 10 --style emoji --command 'sleep 3' --success 'Colorful! 🌈'")
49
+
50
+ demo('Classic spinner',
51
+ "twirl --style classic --command 'sleep 2' --success 'Spinning!'")
52
+ end
53
+
54
+ def new_features_examples
55
+ section('New v1.2.0 Features')
56
+
57
+ demo('Universal --ends flag with brackets',
58
+ "ripple --ends '[]' --command 'sleep 3' --success 'Framed!'")
59
+
60
+ demo('Worm with custom style',
61
+ "worm --length 10 --style custom=ā–«ā–Ŗā–  --command 'sleep 3' --success 'Custom blocks!'")
62
+
63
+ demo('Forward-only worm direction',
64
+ "worm --length 10 --direction forward --command 'sleep 4' --success 'Always forward!'")
65
+
66
+ demo('Emoji decoration',
67
+ "twirl --ends 'šŸŽÆšŸŽŖ' --command 'sleep 2' --success 'Decorated!'")
68
+
69
+ demo('Ultimate combination',
70
+ "worm --length 10 --style custom=🟦🟨🟄 --direction forward --ends '怊怋' --command 'sleep 4' --success 'All features!'")
71
+ end
72
+
73
+ def advanced_examples
74
+ section('Advanced Features')
75
+
76
+ demo('Error handling',
77
+ "worm --length 10 --command 'sleep 2 && exit 1' --error 'Task failed!' --fail-icon")
78
+
79
+ demo('Silent completion',
80
+ "ripple --command 'sleep 2'")
81
+
82
+ demo('Custom success icon',
83
+ "twirl --command 'sleep 2' --success 'Backup done' --icon 'āœ“'")
84
+ end
85
+
86
+ private
87
+
88
+ def section(title)
89
+ puts "\n#{'-' * 50}"
90
+ puts " #{title}"
91
+ puts "#{'-' * 50}\n\n"
92
+ end
93
+
94
+ def demo(description, command)
95
+ puts "#{description}:"
96
+ puts "$ prg #{command}"
97
+ puts
98
+
99
+ full_command = "ruby -I #{@lib_path} #{@gem_path} #{command}"
100
+ system(full_command)
101
+
102
+ puts "\n"
103
+ sleep(1) # Brief pause between demos
104
+ end
105
+ end
106
+
107
+ # Command line interface
108
+ if __FILE__ == $PROGRAM_NAME
109
+ demo = ReadmeDemo.new
110
+
111
+ if ARGV.empty?
112
+ demo.run_all_demos
113
+ else
114
+ case ARGV[0]
115
+ when 'basic'
116
+ demo.basic_examples
117
+ when 'styles'
118
+ demo.style_examples
119
+ when 'new'
120
+ demo.new_features_examples
121
+ when 'advanced'
122
+ demo.advanced_examples
123
+ else
124
+ puts "Usage: #{$PROGRAM_NAME} [basic|styles|new|advanced]"
125
+ puts " #{$PROGRAM_NAME} # run all demos"
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/ruby-progress/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'ruby-progress'
7
+ spec.version = RubyProgress::VERSION
8
+ spec.authors = ['Brett Terpstra']
9
+ spec.email = ['me@brettterpstra.com']
10
+
11
+ spec.summary = 'Animated terminal progress indicators'
12
+ spec.description = 'Animated progress indicators for Ruby: Ripple (text ripple effects), Worm (Unicode wave animations), and Twirl (spinner indicators)'
13
+ spec.homepage = 'https://github.com/ttscoff/ruby-progress'
14
+ spec.license = 'MIT'
15
+ spec.required_ruby_version = '>= 2.5.0'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = 'bin'
28
+ spec.executables = %w[prg ripple worm twirl fill]
29
+ spec.require_paths = ['lib']
30
+
31
+ # Runtime dependencies
32
+ # None required - uses only standard library
33
+
34
+ # Development dependencies
35
+ spec.add_development_dependency 'rake', '~> 13.0'
36
+ spec.add_development_dependency 'rspec', '~> 3.0'
37
+ spec.add_development_dependency 'rubocop', '~> 1.21'
38
+ spec.add_development_dependency 'simplecov', '~> 0.21'
39
+ spec.metadata['rubygems_mfa_required'] = 'true'
40
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env fish
2
+ # Runs the test matrix using mise-managed Ruby installs and writes per-version logs.
3
+ # Safe for fish shell; intended to be run from project root.
4
+
5
+ set -l VERSIONS 2.7.8 3.0.6 3.1.4 3.2.0 3.3.0
6
+ set -l REPO_ROOT (pwd)
7
+
8
+ for v in $VERSIONS
9
+ set -l bin_dir $HOME/.local/share/mise/installs/ruby/$v/bin
10
+ if test -x "$bin_dir/ruby"
11
+ echo "\n=== Ruby $v ==="
12
+ echo "ruby: " (printf "%s" ("$bin_dir/ruby" -v))
13
+ echo "Installing bundler for Ruby $v (if needed)" >&2
14
+ # install bundler quietly; ignore errors from this step so we can try bundle install next
15
+ "$bin_dir/gem" install bundler --no-document >/dev/null 2>&1 || true
16
+ echo "Running bundle install for Ruby $v" >&2
17
+ # Use --quiet to reduce log noise, but keep failures visible
18
+ if test -x "$bin_dir/bundle"
19
+ "$bin_dir/bundle" install --quiet
20
+ else
21
+ # try using bundler directly
22
+ "$bin_dir/ruby" -S gem install bundler --no-document
23
+ "$bin_dir/ruby" -S bundle install --quiet
24
+ end
25
+
26
+ echo "Running rspec for Ruby $v (output -> rspec-$v.log)" >&2
27
+ # Capture exit status per-version; write logs
28
+ # run rspec and tee output to a per-version log
29
+ "$bin_dir/bundle" exec rspec --format documentation 2>&1 | tee rspec-$v.log
30
+ if test $status -ne 0
31
+ echo "rspec failed for Ruby $v (exit $status)" >&2
32
+ # stop the matrix if a version fails
33
+ exit $status
34
+ end
35
+ else
36
+ echo "Ruby $v not found at $bin_dir, skipping"
37
+ end
38
+ end
39
+
40
+ echo "Matrix complete. Logs:"
41
+ ls -1 rspec-*.log 2>/dev/null || echo "No logs found"
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  # Test script to explore terminal cursor behavior with daemon output interruption
3
5
 
4
6
  require_relative 'lib/ruby-progress'
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  # Test script to reproduce daemon orphaning issue
4
5
  puts 'Starting daemon...'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-progress
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -70,6 +70,7 @@ description: 'Animated progress indicators for Ruby: Ripple (text ripple effects
70
70
  email:
71
71
  - me@brettterpstra.com
72
72
  executables:
73
+ - fill
73
74
  - prg
74
75
  - ripple
75
76
  - twirl
@@ -83,28 +84,50 @@ files:
83
84
  - ".rubocop.yml"
84
85
  - ".rubocop_todo.yml"
85
86
  - CHANGELOG.md
87
+ - DEMO_SCRIPTS.md
86
88
  - Gemfile
87
89
  - Gemfile.lock
88
90
  - LICENSE
89
91
  - README.md
90
92
  - Rakefile
93
+ - bin/fill
91
94
  - bin/prg
92
95
  - bin/ripple
93
96
  - bin/twirl
94
97
  - bin/worm
95
98
  - blog-post.md
96
99
  - demo_gem.rb
100
+ - demo_screencast.rb
97
101
  - demo_worm_infinite.rb
98
102
  - examples/bash_daemon_demo.sh
99
103
  - examples/daemon_demo.rb
104
+ - examples/daemon_job_example.sh
100
105
  - examples/utils_demo.rb
101
106
  - experimental_terminal.rb
102
107
  - lib/ruby-progress.rb
108
+ - lib/ruby-progress/cli/fill_options.rb
109
+ - lib/ruby-progress/cli/job_cli.rb
110
+ - lib/ruby-progress/cli/ripple_cli.rb
111
+ - lib/ruby-progress/cli/ripple_options.rb
112
+ - lib/ruby-progress/cli/twirl_cli.rb
113
+ - lib/ruby-progress/cli/twirl_options.rb
114
+ - lib/ruby-progress/cli/twirl_runner.rb
115
+ - lib/ruby-progress/cli/twirl_spinner.rb
116
+ - lib/ruby-progress/cli/worm_cli.rb
117
+ - lib/ruby-progress/cli/worm_options.rb
118
+ - lib/ruby-progress/cli/worm_runner.rb
103
119
  - lib/ruby-progress/daemon.rb
120
+ - lib/ruby-progress/fill.rb
121
+ - lib/ruby-progress/fill_cli.rb
122
+ - lib/ruby-progress/output_capture.rb
104
123
  - lib/ruby-progress/ripple.rb
105
124
  - lib/ruby-progress/utils.rb
106
125
  - lib/ruby-progress/version.rb
107
126
  - lib/ruby-progress/worm.rb
127
+ - quick_demo.rb
128
+ - readme_demo.rb
129
+ - ruby-progress.gemspec
130
+ - scripts/run_matrix_mise.fish
108
131
  - test_daemon_interruption.rb
109
132
  - test_daemon_orphan.rb
110
133
  - test_worm_flags.rb