hyperlist 1.1.7 → 1.2.2

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/diagnose_safe.rb DELETED
@@ -1,198 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # HyperList Safe Diagnostic Script
3
- # This version ensures terminal remains in a sane state
4
-
5
- # First, ensure terminal is in sane state
6
- system("stty sane 2>/dev/null")
7
-
8
- # Ensure we're not in raw mode and output is flushed properly
9
- $stdout.sync = true
10
- $stderr.sync = true
11
-
12
- # Don't load rcurses until we explicitly test it
13
- puts "=" * 60
14
- puts "HyperList Safe Diagnostic Report"
15
- puts "=" * 60
16
-
17
- # Check Ruby version
18
- puts "\n1. Ruby Version:"
19
- puts " #{RUBY_VERSION} (#{RUBY_PLATFORM})"
20
- if RUBY_VERSION < "3.0.0"
21
- puts " WARNING: HyperList requires Ruby 3.0.0 or higher"
22
- elsif RUBY_VERSION >= "3.4.0"
23
- puts " WARNING: Ruby 3.4+ is a development version and may have compatibility issues"
24
- puts " RECOMMENDED: Use Ruby 3.3.x for stability"
25
- else
26
- puts " OK: Ruby version supported"
27
- end
28
-
29
- # Check gem versions WITHOUT loading them
30
- puts "\n2. Installed Gem Versions:"
31
- begin
32
- hyperlist_output = `gem list hyperlist --local 2>&1`
33
- rcurses_output = `gem list rcurses --local 2>&1`
34
-
35
- if hyperlist_output.include?("hyperlist")
36
- version = hyperlist_output.match(/hyperlist \(([\d.]+)/)[1] rescue "unknown"
37
- puts " hyperlist: #{version}"
38
- if version >= "1.1.3"
39
- puts " OK: HyperList version is current"
40
- else
41
- puts " UPDATE NEEDED: gem update hyperlist"
42
- end
43
- else
44
- puts " hyperlist: NOT INSTALLED"
45
- puts " Run: gem install hyperlist"
46
- end
47
-
48
- if rcurses_output.include?("rcurses")
49
- # Extract just the first/latest version
50
- version = rcurses_output.match(/rcurses \(([\d.]+)/)[1] rescue "unknown"
51
- puts " rcurses: #{version}"
52
- if version >= "5.1.4"
53
- puts " OK: rcurses version is current"
54
- else
55
- puts " UPDATE NEEDED: gem update rcurses"
56
- end
57
- else
58
- puts " rcurses: NOT INSTALLED"
59
- puts " Run: gem install rcurses"
60
- end
61
- rescue => e
62
- puts " Error checking gems: #{e.message}"
63
- end
64
-
65
- # Check terminal environment
66
- puts "\n3. Terminal Environment:"
67
- puts " TERM: #{ENV['TERM'] || 'not set'}"
68
- puts " LANG: #{ENV['LANG'] || 'not set'}"
69
- puts " TTY: #{$stdin.tty? ? 'Yes' : 'No'}"
70
- puts " Terminal columns: #{`tput cols`.strip rescue 'unknown'}"
71
- puts " Terminal rows: #{`tput lines`.strip rescue 'unknown'}"
72
-
73
- # Check for HyperList executable
74
- puts "\n4. HyperList Executable:"
75
- hyperlist_path = `which hyperlist 2>/dev/null`.strip
76
- if hyperlist_path.empty?
77
- puts " NOT FOUND in PATH"
78
-
79
- # Check common gem bin paths
80
- gem_paths = [
81
- "#{ENV['HOME']}/.local/share/gem/ruby/*/bin/hyperlist",
82
- "#{ENV['HOME']}/.gem/ruby/*/bin/hyperlist",
83
- "/usr/local/bin/hyperlist",
84
- "/usr/bin/hyperlist"
85
- ]
86
-
87
- found = false
88
- gem_paths.each do |pattern|
89
- Dir.glob(pattern).each do |path|
90
- if File.exist?(path)
91
- puts " Found at: #{path}"
92
- puts " Add to PATH: export PATH=\"#{File.dirname(path)}:$PATH\""
93
- found = true
94
- break
95
- end
96
- end
97
- break if found
98
- end
99
- else
100
- puts " Found at: #{hyperlist_path}"
101
- if File.executable?(hyperlist_path)
102
- puts " OK: File is executable"
103
- else
104
- puts " ERROR: File is not executable"
105
- puts " Fix: chmod +x #{hyperlist_path}"
106
- end
107
- end
108
-
109
- # Test basic dependencies WITHOUT loading rcurses
110
- puts "\n5. Core Ruby Dependencies:"
111
- deps = ['io/console', 'date', 'cgi', 'openssl', 'digest', 'base64']
112
- deps.each do |dep|
113
- begin
114
- require dep
115
- puts " OK: #{dep}"
116
- rescue LoadError => e
117
- puts " MISSING: #{dep} - #{e.message}"
118
- end
119
- end
120
-
121
- # Separate rcurses test with isolation
122
- puts "\n6. Testing rcurses (isolated):"
123
- puts " Running isolated test..."
124
-
125
- # Create a separate test script to isolate rcurses
126
- test_script = <<~RUBY
127
- begin
128
- require 'rcurses'
129
- puts "RCURSES_LOAD:OK"
130
-
131
- # Check if main classes exist without initializing
132
- if defined?(Rcurses::Pane)
133
- puts "RCURSES_PANE:OK"
134
- else
135
- puts "RCURSES_PANE:FAIL"
136
- end
137
- rescue LoadError => e
138
- puts "RCURSES_LOAD:FAIL:\#{e.message}"
139
- rescue => e
140
- puts "RCURSES_ERROR:\#{e.class}:\#{e.message}"
141
- end
142
- RUBY
143
-
144
- # Run test in subprocess to avoid terminal corruption
145
- result = `ruby -e "#{test_script}" 2>&1`
146
-
147
- if result.include?("RCURSES_LOAD:OK")
148
- puts " OK: rcurses loads successfully"
149
- else
150
- puts " ERROR: rcurses failed to load"
151
- error = result.match(/RCURSES_LOAD:FAIL:(.+)/)
152
- puts " Details: #{error[1]}" if error
153
- end
154
-
155
- if result.include?("RCURSES_PANE:OK")
156
- puts " OK: Rcurses::Pane class available"
157
- else
158
- puts " ERROR: Rcurses::Pane class not found"
159
- end
160
-
161
- if result.include?("RCURSES_ERROR")
162
- error = result.match(/RCURSES_ERROR:(.+):(.+)/)
163
- puts " ERROR: #{error[1]} - #{error[2]}" if error
164
- end
165
-
166
- # Test terminal sanity
167
- puts "\n7. Terminal State Check:"
168
- system("stty -a > /dev/null 2>&1")
169
- if $?.success?
170
- puts " OK: Terminal responds to stty"
171
- else
172
- puts " ERROR: Terminal not responding properly"
173
- end
174
-
175
- # Try to restore terminal just in case
176
- system("stty sane 2>/dev/null")
177
- system("tput reset 2>/dev/null")
178
-
179
- puts "\n" + "=" * 60
180
- puts "Diagnostic complete!"
181
- puts "=" * 60
182
-
183
- puts "\nRECOMMENDATIONS:"
184
- if RUBY_VERSION >= "3.4.0"
185
- puts "1. IMPORTANT: You're using Ruby #{RUBY_VERSION} (development version)"
186
- puts " Install Ruby 3.3.x for stability:"
187
- puts " - Arch Linux: sudo pacman -S ruby"
188
- puts " - Or use: rbenv install 3.3.4"
189
- end
190
-
191
- puts "\nTo test rcurses isolation:"
192
- puts " ruby -e \"require 'rcurses'; puts 'Loaded OK'\""
193
-
194
- puts "\nTo restore terminal if corrupted:"
195
- puts " stty sane"
196
- puts " reset"
197
-
198
- puts "\nPlease share this diagnostic output when reporting issues."
data/fix_terminal.sh DELETED
@@ -1,33 +0,0 @@
1
- #!/bin/bash
2
- # Terminal restoration script for when things go wrong
3
-
4
- echo "Restoring terminal to sane state..."
5
-
6
- # Reset terminal to sane defaults
7
- stty sane 2>/dev/null
8
-
9
- # Clear any raw mode settings
10
- stty echo 2>/dev/null
11
- stty icanon 2>/dev/null
12
- stty icrnl 2>/dev/null
13
-
14
- # Reset terminal completely
15
- tput reset 2>/dev/null
16
- reset 2>/dev/null
17
-
18
- # Clear screen
19
- clear
20
-
21
- # Show cursor
22
- tput cnorm 2>/dev/null
23
- echo -e "\033[?25h" # ANSI escape to show cursor
24
-
25
- echo "Terminal restored!"
26
- echo ""
27
- echo "If your terminal is still broken, try:"
28
- echo " 1. Close and reopen your terminal"
29
- echo " 2. Run: reset"
30
- echo " 3. Run: stty sane"
31
- echo ""
32
- echo "To check terminal state:"
33
- echo " stty -a"
@@ -1,57 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- # Wrapper for Ruby 3.4+ compatibility
5
- # This ensures proper initialization of rcurses
6
-
7
- # Handle help/version before loading libraries
8
- if ARGV[0] == '-h' || ARGV[0] == '--help' || ARGV[0] == '-v' || ARGV[0] == '--version'
9
- # Pass through to main hyperlist
10
- load File.join(File.dirname(__FILE__), 'hyperlist')
11
- exit 0
12
- end
13
-
14
- # Explicitly initialize rcurses before loading the main app
15
- require 'rcurses'
16
-
17
- begin
18
- # Initialize rcurses with proper error handling
19
- Rcurses.init!
20
-
21
- # Now load and run the main hyperlist app
22
- # We need to prevent the main file from running automatically
23
- $hyperlist_wrapper_mode = true
24
-
25
- # Load the hyperlist file
26
- load File.join(File.dirname(__FILE__), 'hyperlist')
27
-
28
- # Create and run the app
29
- app = HyperListApp.new(ARGV[0])
30
- app.run
31
-
32
- rescue Interrupt
33
- # Handle Ctrl+C gracefully
34
- Rcurses.done! if defined?(Rcurses.done!)
35
- puts "\nInterrupted"
36
- exit 0
37
- rescue => e
38
- # Ensure terminal is restored on error
39
- Rcurses.done! if defined?(Rcurses.done!)
40
-
41
- # Fallback terminal restoration
42
- print "\e[?25h" # Show cursor
43
- system("stty sane 2>/dev/null")
44
-
45
- puts "Error: #{e.message}"
46
- puts "Backtrace:" if ENV['DEBUG']
47
- e.backtrace.first(10).each { |line| puts " #{line}" } if ENV['DEBUG']
48
- exit 1
49
- ensure
50
- # Always try to restore terminal
51
- begin
52
- Rcurses.done! if defined?(Rcurses.done!)
53
- rescue
54
- print "\e[?25h"
55
- system("stty sane 2>/dev/null")
56
- end
57
- end
@@ -1,149 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Patch for rcurses to work with Ruby 3.4.5
3
- # This shows the minimal changes needed to fix the initialization hang
4
-
5
- module Rcurses
6
- class << self
7
- # Override init! with Ruby 3.4+ compatibility
8
- def init_with_ruby34_fix!
9
- return if @initialized
10
- return unless $stdin.tty?
11
-
12
- # Ruby 3.4.5 compatibility: Use Timeout to prevent hangs
13
- # and try different approaches
14
- begin
15
- if RUBY_VERSION >= "3.4.0"
16
- # For Ruby 3.4+, try using the block form first
17
- # which properly handles terminal state
18
- begin
19
- require 'timeout'
20
-
21
- # Try to set raw mode with timeout
22
- Timeout::timeout(0.5) do
23
- # In Ruby 3.4+, raw! might need explicit flush
24
- $stdout.flush
25
- $stderr.flush
26
-
27
- # Try setting raw mode
28
- $stdin.raw!
29
- end
30
-
31
- # Set echo separately with timeout
32
- Timeout::timeout(0.5) do
33
- $stdin.echo = false
34
- end
35
- rescue Timeout::Error
36
- # If raw! hangs, try alternative approach
37
- # Use stty command as fallback
38
- system("stty raw -echo 2>/dev/null")
39
- @using_stty = true
40
- end
41
- else
42
- # Original code for older Ruby versions
43
- $stdin.raw!
44
- $stdin.echo = false
45
- end
46
- rescue Errno::ENOTTY, Errno::ENODEV
47
- # Not a terminal, can't initialize
48
- return
49
- rescue => e
50
- # Log error but don't fail
51
- $stderr.puts "rcurses init warning: #{e.message}" if ENV['DEBUG']
52
- return
53
- end
54
-
55
- # ensure cleanup on normal exit
56
- at_exit do
57
- if $! && !$!.is_a?(SystemExit) && !$!.is_a?(Interrupt)
58
- @error_to_display = $!
59
- end
60
- cleanup_with_ruby34_fix!
61
- end
62
-
63
- # ensure cleanup on signals
64
- %w[INT TERM].each do |sig|
65
- trap(sig) { cleanup_with_ruby34_fix!; exit }
66
- end
67
-
68
- @initialized = true
69
- end
70
-
71
- def cleanup_with_ruby34_fix!
72
- return if @cleaned_up
73
-
74
- begin
75
- if @using_stty
76
- # If we used stty for initialization, use it for cleanup too
77
- system("stty sane 2>/dev/null")
78
- elsif RUBY_VERSION >= "3.4.0"
79
- # Ruby 3.4+ cleanup with timeout
80
- begin
81
- Timeout::timeout(0.5) do
82
- $stdin.cooked!
83
- $stdin.echo = true
84
- end
85
- rescue Timeout::Error
86
- # Fallback to stty
87
- system("stty sane 2>/dev/null")
88
- end
89
- else
90
- # Original cleanup
91
- $stdin.cooked!
92
- $stdin.echo = true
93
- end
94
- rescue => e
95
- # Last resort cleanup
96
- system("stty sane 2>/dev/null")
97
- end
98
-
99
- # Rest of cleanup remains the same
100
- if @error_to_display.nil?
101
- Rcurses.clear_screen
102
- else
103
- print "\e[999;1H"
104
- print "\e[K"
105
- end
106
-
107
- Cursor.show
108
- @cleaned_up = true
109
-
110
- if @error_to_display
111
- display_error(@error_to_display)
112
- end
113
- end
114
- end
115
- end
116
-
117
- # Test the patch
118
- if __FILE__ == $0
119
- puts "Testing rcurses Ruby 3.4.5 patch..."
120
- puts "Ruby version: #{RUBY_VERSION}"
121
-
122
- # Load rcurses
123
- require 'rcurses'
124
-
125
- # Apply the patch
126
- class << Rcurses
127
- alias_method :init_original!, :init!
128
- alias_method :init!, :init_with_ruby34_fix!
129
- alias_method :cleanup!, :cleanup_with_ruby34_fix!
130
- end
131
-
132
- # Test initialization
133
- begin
134
- puts "Calling Rcurses.init! with patch..."
135
- Rcurses.init!
136
- puts "✓ Initialization successful!"
137
-
138
- # Do a simple test
139
- print "\e[2J\e[H"
140
- print "Patch works! Press any key..."
141
- $stdin.getch if $stdin.respond_to?(:getch)
142
-
143
- rescue => e
144
- puts "✗ Error: #{e.message}"
145
- ensure
146
- Rcurses.cleanup!
147
- puts "✓ Cleanup successful!"
148
- end
149
- end
File without changes
File without changes