pretty_irb 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/00-MANIFEST.md +0 -0
- data/ADVANCED_FEATURES.md +0 -0
- data/AI_HELP.md +0 -0
- data/AI_QUICK_START.md +0 -0
- data/CHANGELOG.md +92 -0
- data/COMPLETE.md +0 -0
- data/EXAMPLES.md +0 -0
- data/FEATURE_SHOWCASE.md +0 -0
- data/FILE_STRUCTURE.md +0 -0
- data/Gemfile +0 -0
- data/IMPLEMENTATION_COMPLETE.md +0 -0
- data/INDEX.md +0 -0
- data/INSTALL.md +0 -0
- data/LICENSE.txt +0 -0
- data/PROJECT_OVERVIEW.ps1 +184 -0
- data/PUBLISH_TO_RUBYGEMS.md +1 -0
- data/QUICKSTART.md +0 -0
- data/QUICK_REFERENCE.md +0 -0
- data/README.md +151 -61
- data/Rakefile +0 -0
- data/SETUP.md +0 -0
- data/START_HERE.md +0 -0
- data/SUMMARY.md +0 -0
- data/WELCOME.md +0 -0
- data/WHAT_IS_NEW.md +0 -0
- data/bin/console +8 -0
- data/exe/irb1 +0 -0
- data/exe/pretty_irb +0 -0
- data/lib/pretty_irb/ai_helper.rb +0 -0
- data/lib/pretty_irb/auto_corrector.rb +0 -0
- data/lib/pretty_irb/benchmarker.rb +0 -0
- data/lib/pretty_irb/cheat_sheet.rb +0 -0
- data/lib/pretty_irb/formatter.rb +0 -0
- data/lib/pretty_irb/history_manager.rb +0 -0
- data/lib/pretty_irb/shell.rb +0 -0
- data/lib/pretty_irb/snippet_manager.rb +0 -0
- data/lib/pretty_irb/variable_inspector.rb +3 -1
- data/lib/pretty_irb/version.rb +0 -0
- data/lib/pretty_irb.rb +0 -0
- data/pretty_irb.gemspec +45 -0
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30ecfb0481118f36e1674ff5dd9174fbd1e678b50743a6ea03cab465dd2c800e
|
|
4
|
+
data.tar.gz: a5fd1711ecdd51ee203546ea3a12f96b5a2ec268e4711c85f1ea0045e55311e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2d45064a505563e76cc975821c9caf2745885306a50e450e6dafebce7c9ec73270a37201151436db83caf1fe67502bcb8763e216910828b48fd2da6a9095e965
|
|
7
|
+
data.tar.gz: 64623e8b5a19298cdb41808c38be3b9f241bd9133b5b0b0354851c7f100a98e5db56ddca2e501ff7ef61f59e637e5f270a3d7045cbe7b95da2bc4eba18fe50a3
|
data/.gitignore
ADDED
data/00-MANIFEST.md
CHANGED
|
File without changes
|
data/ADVANCED_FEATURES.md
CHANGED
|
File without changes
|
data/AI_HELP.md
CHANGED
|
File without changes
|
data/AI_QUICK_START.md
CHANGED
|
File without changes
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
## [0.1.0] - 2025-11-27
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Pretty Syntax Highlighting** - Beautiful colorized output using Rouge gem
|
|
12
|
+
- **Auto-Correct Suggestions** - Smart suggestions for common Ruby errors using `did_you_mean`
|
|
13
|
+
- **Pretty Formatting** - Type-aware colored output for strings, numbers, arrays, hashes, and more
|
|
14
|
+
- **AI Helper** - Interactive learning features:
|
|
15
|
+
- `?explain(method)` - Get detailed explanations of Ruby methods
|
|
16
|
+
- `?example(topic)` - View code examples for topics
|
|
17
|
+
- `?debug(code)` - Analyze code for issues and improvements
|
|
18
|
+
- `?practices(topic)` - Learn Ruby best practices
|
|
19
|
+
- `?ref(keyword)` - Quick reference lookup
|
|
20
|
+
- **History Manager** - Command history features:
|
|
21
|
+
- `history` - View all commands
|
|
22
|
+
- `history search KEYWORD` - Search previous commands
|
|
23
|
+
- `history last N` - Show last N commands
|
|
24
|
+
- `history export FILE` - Export history to file
|
|
25
|
+
- `history clear` - Clear history
|
|
26
|
+
- **Snippet Manager** - Save and reuse code patterns:
|
|
27
|
+
- `snippet save NAME CODE` - Save code snippets
|
|
28
|
+
- `snippet load NAME` - Execute saved snippets
|
|
29
|
+
- `snippet list` - View all snippets
|
|
30
|
+
- `snippet show NAME` - View snippet details
|
|
31
|
+
- `snippet delete NAME` - Remove snippet
|
|
32
|
+
- `snippet search KEYWORD` - Search snippets
|
|
33
|
+
- **Variable Inspector** - Introspect your runtime state:
|
|
34
|
+
- `vars` - List all variables
|
|
35
|
+
- `vars VARNAME` - Inspect specific variable
|
|
36
|
+
- `vars type:TYPE` - Find variables by type
|
|
37
|
+
- `vars search:KEYWORD` - Search variables
|
|
38
|
+
- `vars memory` - Show memory usage
|
|
39
|
+
- **Benchmarker** - Performance testing and comparison:
|
|
40
|
+
- `bench CODE` - Benchmark code execution
|
|
41
|
+
- `bench compare CODE1 vs CODE2` - Compare two implementations
|
|
42
|
+
- `bench memory CODE` - Profile memory usage
|
|
43
|
+
- **Ruby Cheat Sheet** - Quick reference without leaving REPL:
|
|
44
|
+
- `cheat` - General cheat sheet
|
|
45
|
+
- `cheat array` - Array methods and operations
|
|
46
|
+
- `cheat hash` - Hash methods and operations
|
|
47
|
+
- `cheat string` - String methods and operations
|
|
48
|
+
- `cheat enumerable` - Enumerable and iteration methods
|
|
49
|
+
- `cheat file` - File I/O operations
|
|
50
|
+
- `cheat regex` - Regular expression syntax and methods
|
|
51
|
+
- `cheat date` - Date and time operations
|
|
52
|
+
- **Enhanced Error Messages** - Color-coded errors with helpful hints
|
|
53
|
+
- **Multiline Input Support** - Handle code blocks, conditionals, and heredocs:
|
|
54
|
+
- Automatic detection of incomplete code
|
|
55
|
+
- Continuation prompts for multiline blocks
|
|
56
|
+
- Support for `do...end` blocks and class/method definitions
|
|
57
|
+
- **`irb1` Command** - Convenient shorthand to launch Pretty IRB
|
|
58
|
+
- **`pretty_irb` Command** - Primary launcher for the shell
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
- Multiline input handling for incomplete code blocks and heredocs
|
|
62
|
+
- Dependency conflicts with `did_you_mean` gem version mismatches
|
|
63
|
+
- Gem file inclusion in built packages (fallback glob when git unavailable)
|
|
64
|
+
- Safer syntax highlighting without relying on internal Rouge token constants
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
- Relaxed `did_you_mean` dependency constraint to `>= 1.5, < 3.0` for better Ruby version compatibility
|
|
68
|
+
- Enhanced readline integration using Reline for better line editing experience
|
|
69
|
+
- Improved shell startup stability across Windows, macOS, and Linux
|
|
70
|
+
|
|
71
|
+
### Technical Highlights
|
|
72
|
+
- Modular architecture with separate concerns:
|
|
73
|
+
- `Shell` - REPL loop and command routing
|
|
74
|
+
- `Formatter` - Type-aware output formatting
|
|
75
|
+
- `AutoCorrector` - Error suggestion and correction
|
|
76
|
+
- `AIHelper` - Interactive learning content
|
|
77
|
+
- `HistoryManager` - Persistent command history
|
|
78
|
+
- `SnippetManager` - Code snippet persistence
|
|
79
|
+
- `VariableInspector` - Runtime introspection
|
|
80
|
+
- `Benchmarker` - Performance measurement
|
|
81
|
+
- `CheatSheet` - Reference content
|
|
82
|
+
- Cross-platform support (Windows, macOS, Linux with WSL)
|
|
83
|
+
- Ruby 2.7.0+ compatibility
|
|
84
|
+
|
|
85
|
+
## Future Roadmap
|
|
86
|
+
|
|
87
|
+
- Code formatting/beautification features
|
|
88
|
+
- Additional AI learning modules
|
|
89
|
+
- Performance profiling improvements
|
|
90
|
+
- Custom theme support
|
|
91
|
+
- Plugin system for extending functionality
|
|
92
|
+
|
data/COMPLETE.md
CHANGED
|
File without changes
|
data/EXAMPLES.md
CHANGED
|
File without changes
|
data/FEATURE_SHOWCASE.md
CHANGED
|
File without changes
|
data/FILE_STRUCTURE.md
CHANGED
|
File without changes
|
data/Gemfile
CHANGED
|
File without changes
|
data/IMPLEMENTATION_COMPLETE.md
CHANGED
|
File without changes
|
data/INDEX.md
CHANGED
|
File without changes
|
data/INSTALL.md
CHANGED
|
File without changes
|
data/LICENSE.txt
CHANGED
|
File without changes
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/usr/bin/env powershell
|
|
2
|
+
|
|
3
|
+
# Pretty IRB Project Structure and Overview
|
|
4
|
+
|
|
5
|
+
Write-Host "╔═══════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
|
|
6
|
+
Write-Host "║ Pretty IRB - Enhanced Interactive Ruby Shell ║" -ForegroundColor Cyan
|
|
7
|
+
Write-Host "║ ║" -ForegroundColor Cyan
|
|
8
|
+
Write-Host "║ A beautiful, feature-rich IRB alternative with: ║" -ForegroundColor Cyan
|
|
9
|
+
Write-Host "║ ✨ Pretty Fonts & Colors ║" -ForegroundColor Cyan
|
|
10
|
+
Write-Host "║ 🔧 Auto-Correct with Smart Suggestions ║" -ForegroundColor Cyan
|
|
11
|
+
Write-Host "║ ⚡ Enhanced Readline & History ║" -ForegroundColor Cyan
|
|
12
|
+
Write-Host "║ 💡 Helpful Error Messages ║" -ForegroundColor Cyan
|
|
13
|
+
Write-Host "╚═══════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
|
|
14
|
+
|
|
15
|
+
Write-Host "`n📁 Project Structure:" -ForegroundColor Green
|
|
16
|
+
Write-Host @"
|
|
17
|
+
|
|
18
|
+
pretty_irb/
|
|
19
|
+
├── 📄 .gitignore - Git ignore file
|
|
20
|
+
├── 📄 .ruby-version - Ruby version (2.7.0+)
|
|
21
|
+
├── 📄 Gemfile - Bundle dependencies
|
|
22
|
+
├── 📄 Rakefile - Build tasks (test, build)
|
|
23
|
+
├── 📄 LICENSE.txt - MIT License
|
|
24
|
+
├── 📄 README.md - Main documentation
|
|
25
|
+
├── 📄 QUICKSTART.md - Quick start guide
|
|
26
|
+
├── 📄 SETUP.md - Detailed setup guide
|
|
27
|
+
├── 📄 EXAMPLES.md - Usage examples
|
|
28
|
+
├── 📄 pretty_irb.gemspec - Gem specification
|
|
29
|
+
│
|
|
30
|
+
├── 📁 bin/
|
|
31
|
+
│ └── console - Development console entry point
|
|
32
|
+
│
|
|
33
|
+
├── 📁 exe/
|
|
34
|
+
│ └── pretty_irb - Gem executable
|
|
35
|
+
│
|
|
36
|
+
├── 📁 lib/
|
|
37
|
+
│ ├── pretty_irb.rb - Main gem file & requires
|
|
38
|
+
│ └── pretty_irb/
|
|
39
|
+
│ ├── version.rb - Version info (0.1.0)
|
|
40
|
+
│ ├── formatter.rb - Output formatting & syntax highlighting
|
|
41
|
+
│ ├── auto_corrector.rb - Auto-correct & suggestions
|
|
42
|
+
│ └── shell.rb - Main REPL shell implementation
|
|
43
|
+
│
|
|
44
|
+
└── 📁 spec/
|
|
45
|
+
├── spec_helper.rb - RSpec configuration
|
|
46
|
+
├── pretty_irb_spec.rb - Main gem tests
|
|
47
|
+
├── formatter_spec.rb - Formatter tests
|
|
48
|
+
└── auto_corrector_spec.rb - Auto-corrector tests
|
|
49
|
+
|
|
50
|
+
"@ -ForegroundColor Yellow
|
|
51
|
+
|
|
52
|
+
Write-Host "🔧 Key Files Description:" -ForegroundColor Green
|
|
53
|
+
Write-Host @"
|
|
54
|
+
|
|
55
|
+
1. pretty_irb.rb
|
|
56
|
+
- Main gem entry point
|
|
57
|
+
- Requires all dependencies and modules
|
|
58
|
+
- Provides PrettyIRB.start method
|
|
59
|
+
|
|
60
|
+
2. formatter.rb
|
|
61
|
+
- Syntax highlighting with Rouge
|
|
62
|
+
- Colorized output for different data types
|
|
63
|
+
- Pretty error messages with colors
|
|
64
|
+
|
|
65
|
+
3. auto_corrector.rb
|
|
66
|
+
- Auto-fixes common method name typos
|
|
67
|
+
- Provides smart suggestions using did_you_mean
|
|
68
|
+
- Handles NameError, NoMethodError, SyntaxError
|
|
69
|
+
|
|
70
|
+
4. shell.rb
|
|
71
|
+
- Main REPL loop
|
|
72
|
+
- Command processing
|
|
73
|
+
- Input/output handling
|
|
74
|
+
- Enhanced prompts with colors
|
|
75
|
+
|
|
76
|
+
"@ -ForegroundColor Yellow
|
|
77
|
+
|
|
78
|
+
Write-Host "📦 Dependencies:" -ForegroundColor Green
|
|
79
|
+
Write-Host @"
|
|
80
|
+
|
|
81
|
+
Core:
|
|
82
|
+
- irb >= 1.0 - Ruby's Interactive Shell
|
|
83
|
+
- reline ~> 0.3 - Enhanced readline
|
|
84
|
+
|
|
85
|
+
Formatting:
|
|
86
|
+
- rouge ~> 3.26 - Syntax highlighting
|
|
87
|
+
- colorize ~> 0.8 - Color output
|
|
88
|
+
|
|
89
|
+
Features:
|
|
90
|
+
- did_you_mean ~> 1.5 - Error suggestions
|
|
91
|
+
|
|
92
|
+
Development:
|
|
93
|
+
- rspec ~> 3.0 - Testing framework
|
|
94
|
+
- rake ~> 13.0 - Build tool
|
|
95
|
+
- bundler ~> 2.0 - Dependency management
|
|
96
|
+
|
|
97
|
+
"@ -ForegroundColor Yellow
|
|
98
|
+
|
|
99
|
+
Write-Host "✨ Features:" -ForegroundColor Green
|
|
100
|
+
Write-Host @"
|
|
101
|
+
|
|
102
|
+
1. SYNTAX HIGHLIGHTING
|
|
103
|
+
- Ruby code automatically highlighted with colors
|
|
104
|
+
- Keywords, classes, methods, strings all color-coded
|
|
105
|
+
- Based on Rouge gem
|
|
106
|
+
|
|
107
|
+
2. AUTO-CORRECT
|
|
108
|
+
- Fixes common method typos (.lenght → .length)
|
|
109
|
+
- Suggests corrections for undefined variables/methods
|
|
110
|
+
- Helpful error messages with hints
|
|
111
|
+
|
|
112
|
+
3. PRETTY OUTPUT
|
|
113
|
+
- Strings: Light Blue
|
|
114
|
+
- Numbers: Light Green
|
|
115
|
+
- Booleans: Light Cyan
|
|
116
|
+
- Nil: Light Gray
|
|
117
|
+
- Arrays/Hashes: Formatted and colored
|
|
118
|
+
|
|
119
|
+
4. ENHANCED REPL
|
|
120
|
+
- Custom colored prompts
|
|
121
|
+
- Command history
|
|
122
|
+
- Better line editing
|
|
123
|
+
- Tab completion support
|
|
124
|
+
|
|
125
|
+
"@ -ForegroundColor Yellow
|
|
126
|
+
|
|
127
|
+
Write-Host "🚀 Quick Start:" -ForegroundColor Green
|
|
128
|
+
Write-Host @"
|
|
129
|
+
|
|
130
|
+
1. Install dependencies:
|
|
131
|
+
bundle install
|
|
132
|
+
|
|
133
|
+
2. Run the shell:
|
|
134
|
+
ruby bin/console
|
|
135
|
+
|
|
136
|
+
3. Start coding:
|
|
137
|
+
pretty_irb >> 1 + 2
|
|
138
|
+
=> 3
|
|
139
|
+
|
|
140
|
+
pretty_irb >> 'hello'.upcase
|
|
141
|
+
=> 'HELLO'
|
|
142
|
+
|
|
143
|
+
"@ -ForegroundColor Yellow
|
|
144
|
+
|
|
145
|
+
Write-Host "🧪 Testing:" -ForegroundColor Green
|
|
146
|
+
Write-Host @"
|
|
147
|
+
|
|
148
|
+
Run all tests:
|
|
149
|
+
bundle exec rspec
|
|
150
|
+
|
|
151
|
+
Run specific test:
|
|
152
|
+
bundle exec rspec spec/formatter_spec.rb
|
|
153
|
+
|
|
154
|
+
"@ -ForegroundColor Yellow
|
|
155
|
+
|
|
156
|
+
Write-Host "📝 Future Enhancements:" -ForegroundColor Green
|
|
157
|
+
Write-Host @"
|
|
158
|
+
|
|
159
|
+
- More auto-corrections (Rails methods, string methods)
|
|
160
|
+
- Multiple theme support (dark mode, light mode)
|
|
161
|
+
- Code snippet manager
|
|
162
|
+
- Plugin system
|
|
163
|
+
- Performance optimizations
|
|
164
|
+
- Integration with Rails console
|
|
165
|
+
|
|
166
|
+
"@ -ForegroundColor Yellow
|
|
167
|
+
|
|
168
|
+
Write-Host "✅ Project Status:" -ForegroundColor Green
|
|
169
|
+
Write-Host @"
|
|
170
|
+
|
|
171
|
+
✓ Basic REPL shell
|
|
172
|
+
✓ Syntax highlighting
|
|
173
|
+
✓ Auto-correct functionality
|
|
174
|
+
✓ Pretty output formatting
|
|
175
|
+
✓ Error suggestions
|
|
176
|
+
✓ Command history
|
|
177
|
+
✓ Test suite
|
|
178
|
+
✓ Complete documentation
|
|
179
|
+
✓ Gem structure ready for publishing
|
|
180
|
+
|
|
181
|
+
"@ -ForegroundColor Yellow
|
|
182
|
+
|
|
183
|
+
Write-Host "🎉 Ready to use! Start with:" -ForegroundColor Cyan
|
|
184
|
+
Write-Host " bundle install && ruby bin/console" -ForegroundColor Cyan
|
data/PUBLISH_TO_RUBYGEMS.md
CHANGED
|
@@ -10,6 +10,7 @@ Before publishing, ensure:
|
|
|
10
10
|
|
|
11
11
|
- [ ] Version number updated in `lib/pretty_irb/version.rb`
|
|
12
12
|
- [ ] All tests passing: `bundle exec rspec`
|
|
13
|
+
- [ ] No syntax errors: `bundle exec rubocop` (optional)
|
|
13
14
|
- [ ] README.md is complete and accurate
|
|
14
15
|
- [ ] CHANGELOG.md created (recommended)
|
|
15
16
|
- [ ] LICENSE.txt file present
|
data/QUICKSTART.md
CHANGED
|
File without changes
|
data/QUICK_REFERENCE.md
CHANGED
|
File without changes
|
data/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Pretty IRB - Enhanced Interactive Ruby Shell
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/rb/pretty_irb)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.ruby-lang.org/)
|
|
6
|
+
|
|
3
7
|
A beautiful, feature-rich IRB alternative with:
|
|
4
8
|
|
|
5
9
|
✨ **Pretty Fonts & Colors** - Beautiful syntax highlighting with colorized output
|
|
@@ -13,6 +17,17 @@ A beautiful, feature-rich IRB alternative with:
|
|
|
13
17
|
⚡ **Enhanced Readline** - Better line editing with history support
|
|
14
18
|
💡 **Helpful Hints** - Smart error messages with correction suggestions
|
|
15
19
|
|
|
20
|
+
## Table of Contents
|
|
21
|
+
|
|
22
|
+
- [Features](#features)
|
|
23
|
+
- [Installation](#installation)
|
|
24
|
+
- [Quick Start](#quick-start)
|
|
25
|
+
- [Commands](#commands)
|
|
26
|
+
- [Documentation](#documentation)
|
|
27
|
+
- [Development](#development)
|
|
28
|
+
- [Contributing](#contributing)
|
|
29
|
+
- [License](#license)
|
|
30
|
+
|
|
16
31
|
## Installation
|
|
17
32
|
|
|
18
33
|
Add this line to your Gemfile:
|
|
@@ -27,71 +42,43 @@ Or install it yourself:
|
|
|
27
42
|
gem install pretty_irb
|
|
28
43
|
```
|
|
29
44
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
Start the Pretty IRB shell:
|
|
45
|
+
## Quick Start
|
|
33
46
|
|
|
47
|
+
**Launch Pretty IRB:**
|
|
34
48
|
```bash
|
|
49
|
+
irb1
|
|
50
|
+
# or
|
|
35
51
|
pretty_irb
|
|
36
52
|
```
|
|
37
53
|
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
**Try some commands:**
|
|
40
55
|
```ruby
|
|
41
|
-
|
|
42
|
-
=> 3
|
|
56
|
+
# Basic evaluation
|
|
57
|
+
1 + 2 # => 3
|
|
43
58
|
|
|
44
|
-
|
|
45
|
-
=> "HELLO
|
|
59
|
+
# String methods
|
|
60
|
+
"hello".upcase # => "HELLO"
|
|
46
61
|
|
|
47
|
-
|
|
48
|
-
=> [2, 4, 6]
|
|
49
|
-
```
|
|
62
|
+
# Array operations
|
|
63
|
+
[1, 2, 3].map { |x| x * 2 } # => [2, 4, 6]
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
# Get help
|
|
66
|
+
help # Show all commands
|
|
52
67
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
- `clear` - Clear the screen
|
|
68
|
+
# Learn Ruby
|
|
69
|
+
?explain(map) # Explain the map method
|
|
70
|
+
?example(class) # See class examples
|
|
57
71
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- `history last N` - Show last N commands
|
|
62
|
-
- `history export FILE` - Export to file
|
|
63
|
-
- `history clear` - Clear history
|
|
72
|
+
# Save and reuse code
|
|
73
|
+
snippet save double "[1,2,3].map { |x| x * 2 }"
|
|
74
|
+
snippet load double
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- `snippet save NAME CODE` - Save code
|
|
68
|
-
- `snippet load NAME` - Load and execute
|
|
69
|
-
- `snippet show NAME` - View snippet details
|
|
70
|
-
- `snippet delete NAME` - Delete snippet
|
|
71
|
-
- `snippet search KEYWORD` - Search snippets
|
|
76
|
+
# Search your history
|
|
77
|
+
history search "map"
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- `vars type:TYPE` - Find by type
|
|
77
|
-
- `vars search:KEYWORD` - Search variables
|
|
78
|
-
- `vars memory` - Memory usage
|
|
79
|
-
|
|
80
|
-
#### Benchmarker
|
|
81
|
-
- `bench CODE` - Benchmark code
|
|
82
|
-
- `bench compare CODE1 vs CODE2` - Compare
|
|
83
|
-
- `bench memory CODE` - Profile memory
|
|
84
|
-
|
|
85
|
-
#### Cheat Sheet
|
|
86
|
-
- `cheat` - Show general cheat sheet
|
|
87
|
-
- `cheat TOPIC` - Topic cheat sheet (array, hash, string, enumerable, file, regex, date)
|
|
88
|
-
|
|
89
|
-
#### AI Helper
|
|
90
|
-
- `?explain(method)` - Explain a method
|
|
91
|
-
- `?example(topic)` - Get code examples
|
|
92
|
-
- `?debug(code)` - Analyze code
|
|
93
|
-
- `?practices(topic)` - Learn best practices
|
|
94
|
-
- `?ref(keyword)` - Quick reference
|
|
79
|
+
# Inspect variables
|
|
80
|
+
vars
|
|
81
|
+
```
|
|
95
82
|
|
|
96
83
|
## Features
|
|
97
84
|
|
|
@@ -222,30 +209,133 @@ NameError: undefined local variable or method `foo'
|
|
|
222
209
|
💡 Did you mean?: for
|
|
223
210
|
```
|
|
224
211
|
|
|
212
|
+
## Commands
|
|
213
|
+
|
|
214
|
+
### Basic Commands
|
|
215
|
+
- `exit` or `quit` - Exit the shell
|
|
216
|
+
- `help` - Show available commands
|
|
217
|
+
- `clear` - Clear the screen
|
|
218
|
+
|
|
219
|
+
### History Management
|
|
220
|
+
- `history` - Show all command history
|
|
221
|
+
- `history search KEYWORD` - Search history
|
|
222
|
+
- `history last N` - Show last N commands
|
|
223
|
+
- `history export FILE` - Export to file
|
|
224
|
+
- `history clear` - Clear history
|
|
225
|
+
|
|
226
|
+
### Snippet Manager
|
|
227
|
+
- `snippet list` - List saved snippets
|
|
228
|
+
- `snippet save NAME CODE` - Save code
|
|
229
|
+
- `snippet load NAME` - Load and execute
|
|
230
|
+
- `snippet show NAME` - View snippet details
|
|
231
|
+
- `snippet delete NAME` - Delete snippet
|
|
232
|
+
- `snippet search KEYWORD` - Search snippets
|
|
233
|
+
|
|
234
|
+
### Variable Inspector
|
|
235
|
+
- `vars` - List all variables
|
|
236
|
+
- `vars VARNAME` - Inspect variable
|
|
237
|
+
- `vars type:TYPE` - Find by type
|
|
238
|
+
- `vars search:KEYWORD` - Search variables
|
|
239
|
+
- `vars memory` - Memory usage
|
|
240
|
+
|
|
241
|
+
### Benchmarker
|
|
242
|
+
- `bench CODE` - Benchmark code
|
|
243
|
+
- `bench compare CODE1 vs CODE2` - Compare
|
|
244
|
+
- `bench memory CODE` - Profile memory
|
|
245
|
+
|
|
246
|
+
### Cheat Sheet
|
|
247
|
+
- `cheat` - Show general cheat sheet
|
|
248
|
+
- `cheat TOPIC` - Topic cheat sheet (array, hash, string, enumerable, file, regex, date)
|
|
249
|
+
|
|
250
|
+
### AI Helper
|
|
251
|
+
- `?explain(method)` - Explain a method
|
|
252
|
+
- `?example(topic)` - Get code examples
|
|
253
|
+
- `?debug(code)` - Analyze code
|
|
254
|
+
- `?practices(topic)` - Learn best practices
|
|
255
|
+
- `?ref(keyword)` - Quick reference
|
|
256
|
+
|
|
225
257
|
## Documentation
|
|
226
258
|
|
|
227
259
|
- [AI_HELP.md](AI_HELP.md) - AI Helper features and examples
|
|
228
260
|
- [ADVANCED_FEATURES.md](ADVANCED_FEATURES.md) - Advanced features guide with workflows
|
|
261
|
+
- [QUICK_REFERENCE.md](QUICK_REFERENCE.md) - Command quick reference
|
|
262
|
+
- [CHANGELOG.md](CHANGELOG.md) - Version history and changes
|
|
229
263
|
|
|
230
264
|
## Development
|
|
231
265
|
|
|
232
|
-
|
|
266
|
+
**Setup:**
|
|
267
|
+
```bash
|
|
268
|
+
# Clone the repo
|
|
269
|
+
git clone https://github.com/j14as/pretty_irb.git
|
|
270
|
+
cd pretty_irb
|
|
271
|
+
|
|
272
|
+
# Install dependencies
|
|
273
|
+
bundle install
|
|
274
|
+
```
|
|
233
275
|
|
|
234
|
-
|
|
276
|
+
**Run tests:**
|
|
277
|
+
```bash
|
|
278
|
+
rake spec
|
|
279
|
+
```
|
|
235
280
|
|
|
236
|
-
|
|
281
|
+
**Try it locally:**
|
|
282
|
+
```bash
|
|
283
|
+
bin/console
|
|
284
|
+
# or
|
|
285
|
+
ruby -I lib exe/pretty_irb
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Build the gem:**
|
|
289
|
+
```bash
|
|
290
|
+
gem build pretty_irb.gemspec
|
|
291
|
+
```
|
|
237
292
|
|
|
238
293
|
## Contributing
|
|
239
294
|
|
|
240
|
-
|
|
295
|
+
We welcome bug reports, feature requests, and pull requests!
|
|
296
|
+
|
|
297
|
+
### How to contribute:
|
|
298
|
+
1. Fork the repository
|
|
299
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
300
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
301
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
302
|
+
5. Open a Pull Request
|
|
303
|
+
|
|
304
|
+
### Code standards:
|
|
305
|
+
- Follow Ruby style guide (use rubocop)
|
|
306
|
+
- Add tests for new features
|
|
307
|
+
- Update documentation as needed
|
|
308
|
+
- Keep commits atomic and well-described
|
|
309
|
+
|
|
310
|
+
### Reporting bugs:
|
|
311
|
+
- Use the [GitHub Issues](https://github.com/j14as/pretty_irb/issues)
|
|
312
|
+
- Include Ruby version and OS details
|
|
313
|
+
- Provide minimal reproduction steps
|
|
241
314
|
|
|
242
315
|
## License
|
|
243
316
|
|
|
244
|
-
The gem is available as open source under the terms of the MIT License.
|
|
317
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|
|
245
318
|
|
|
246
|
-
##
|
|
319
|
+
## Acknowledgments
|
|
247
320
|
|
|
248
321
|
This gem is inspired by:
|
|
249
|
-
- Ruby's IRB
|
|
250
|
-
- Python's IPython
|
|
251
|
-
- Node.js
|
|
322
|
+
- **Ruby's IRB** - Interactive Ruby Shell
|
|
323
|
+
- **Python's IPython** - Advanced interactive computing
|
|
324
|
+
- **Node.js REPL** - Autocomplete and code introspection
|
|
325
|
+
- **Pry** - Advanced Ruby debugging and exploration
|
|
326
|
+
|
|
327
|
+
Special thanks to:
|
|
328
|
+
- [Rouge](https://github.com/rouge-ruby/rouge) - Syntax highlighting
|
|
329
|
+
- [Reline](https://github.com/ruby/reline) - Enhanced readline
|
|
330
|
+
- [did_you_mean](https://github.com/ruby/did_you_mean) - Smart error suggestions
|
|
331
|
+
- [Colorize](https://github.com/fazibear/colorize) - Terminal colors
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
**Made with ❤️ by [Jayesh](https://github.com/j14as)**
|
|
336
|
+
|
|
337
|
+
If you find Pretty IRB helpful, please consider:
|
|
338
|
+
- ⭐ Starring the repository
|
|
339
|
+
- 🐛 Reporting issues
|
|
340
|
+
- 💡 Suggesting features
|
|
341
|
+
- 📝 Improving documentation
|
data/Rakefile
CHANGED
|
File without changes
|
data/SETUP.md
CHANGED
|
File without changes
|
data/START_HERE.md
CHANGED
|
File without changes
|
data/SUMMARY.md
CHANGED
|
File without changes
|
data/WELCOME.md
CHANGED
|
File without changes
|
data/WHAT_IS_NEW.md
CHANGED
|
File without changes
|
data/bin/console
ADDED
data/exe/irb1
CHANGED
|
File without changes
|
data/exe/pretty_irb
CHANGED
|
File without changes
|
data/lib/pretty_irb/ai_helper.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/pretty_irb/formatter.rb
CHANGED
|
File without changes
|
|
File without changes
|
data/lib/pretty_irb/shell.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -94,7 +94,9 @@ module PrettyIRB
|
|
|
94
94
|
type = value.class.name
|
|
95
95
|
size = estimate_size(value)
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
value_str = value.inspect
|
|
98
|
+
value_str = value_str.length > 60 ? value_str[0..56] + '...' : value_str
|
|
99
|
+
" #{name}: #{type} (#{size} bytes)\n = #{value_str}\n\n"
|
|
98
100
|
end
|
|
99
101
|
|
|
100
102
|
def detailed_info(name, value)
|
data/lib/pretty_irb/version.rb
CHANGED
|
File without changes
|
data/lib/pretty_irb.rb
CHANGED
|
File without changes
|
data/pretty_irb.gemspec
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = "pretty_irb"
|
|
3
|
+
spec.version = "0.1.2"
|
|
4
|
+
spec.authors = ["Jayesh"]
|
|
5
|
+
spec.email = ["jayesh@example.com"]
|
|
6
|
+
spec.summary = "A pretty IRB replacement with auto-correct and beautiful fonts"
|
|
7
|
+
spec.description = "An enhanced interactive Ruby shell with pretty formatting, syntax highlighting, and auto-correct functionality"
|
|
8
|
+
spec.homepage = "https://github.com/j14as/pretty_irb"
|
|
9
|
+
spec.license = "MIT"
|
|
10
|
+
|
|
11
|
+
# Prefer files from git, but fall back to a conservative glob when git isn't available
|
|
12
|
+
git_files = nil
|
|
13
|
+
begin
|
|
14
|
+
git_files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
15
|
+
rescue
|
|
16
|
+
git_files = nil
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
spec.files = if git_files && !git_files.empty?
|
|
20
|
+
git_files
|
|
21
|
+
else
|
|
22
|
+
Dir.chdir(File.expand_path(__dir__)) do
|
|
23
|
+
Dir["lib/**/*"] + Dir["exe/*"] + Dir["*.md"] + ["LICENSE.txt", "Gemfile", "Rakefile"]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = ["pretty_irb", "irb1"]
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
|
|
30
|
+
spec.required_ruby_version = ">= 2.7.0"
|
|
31
|
+
|
|
32
|
+
# Dependencies
|
|
33
|
+
spec.add_dependency "irb", ">= 1.0"
|
|
34
|
+
spec.add_dependency "rouge", "~> 3.26" # Syntax highlighting
|
|
35
|
+
spec.add_dependency "colorize", "~> 0.8" # Colored output
|
|
36
|
+
# did_you_mean ships with recent Rubies (e.g. Ruby 3.4 provides did_you_mean 2.x).
|
|
37
|
+
# Allow any version >= 1.5 but < 3.0 to avoid conflicts with older constraints.
|
|
38
|
+
spec.add_dependency "did_you_mean", ">= 1.5", "< 3.0" # Auto-correct suggestions
|
|
39
|
+
spec.add_dependency "reline", "~> 0.3" # Enhanced readline
|
|
40
|
+
|
|
41
|
+
# Development dependencies
|
|
42
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
43
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
44
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
45
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pretty_irb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jayesh
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: irb
|
|
@@ -133,15 +132,17 @@ description: An enhanced interactive Ruby shell with pretty formatting, syntax h
|
|
|
133
132
|
email:
|
|
134
133
|
- jayesh@example.com
|
|
135
134
|
executables:
|
|
136
|
-
- pretty_irb
|
|
137
135
|
- irb1
|
|
136
|
+
- pretty_irb
|
|
138
137
|
extensions: []
|
|
139
138
|
extra_rdoc_files: []
|
|
140
139
|
files:
|
|
140
|
+
- ".gitignore"
|
|
141
141
|
- 00-MANIFEST.md
|
|
142
142
|
- ADVANCED_FEATURES.md
|
|
143
143
|
- AI_HELP.md
|
|
144
144
|
- AI_QUICK_START.md
|
|
145
|
+
- CHANGELOG.md
|
|
145
146
|
- COMPLETE.md
|
|
146
147
|
- EXAMPLES.md
|
|
147
148
|
- FEATURE_SHOWCASE.md
|
|
@@ -151,6 +152,7 @@ files:
|
|
|
151
152
|
- INDEX.md
|
|
152
153
|
- INSTALL.md
|
|
153
154
|
- LICENSE.txt
|
|
155
|
+
- PROJECT_OVERVIEW.ps1
|
|
154
156
|
- PUBLISH_TO_RUBYGEMS.md
|
|
155
157
|
- QUICKSTART.md
|
|
156
158
|
- QUICK_REFERENCE.md
|
|
@@ -161,6 +163,7 @@ files:
|
|
|
161
163
|
- SUMMARY.md
|
|
162
164
|
- WELCOME.md
|
|
163
165
|
- WHAT_IS_NEW.md
|
|
166
|
+
- bin/console
|
|
164
167
|
- exe/irb1
|
|
165
168
|
- exe/pretty_irb
|
|
166
169
|
- lib/pretty_irb.rb
|
|
@@ -174,11 +177,11 @@ files:
|
|
|
174
177
|
- lib/pretty_irb/snippet_manager.rb
|
|
175
178
|
- lib/pretty_irb/variable_inspector.rb
|
|
176
179
|
- lib/pretty_irb/version.rb
|
|
177
|
-
|
|
180
|
+
- pretty_irb.gemspec
|
|
181
|
+
homepage: https://github.com/j14as/pretty_irb
|
|
178
182
|
licenses:
|
|
179
183
|
- MIT
|
|
180
184
|
metadata: {}
|
|
181
|
-
post_install_message:
|
|
182
185
|
rdoc_options: []
|
|
183
186
|
require_paths:
|
|
184
187
|
- lib
|
|
@@ -193,8 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
193
196
|
- !ruby/object:Gem::Version
|
|
194
197
|
version: '0'
|
|
195
198
|
requirements: []
|
|
196
|
-
rubygems_version: 3.
|
|
197
|
-
signing_key:
|
|
199
|
+
rubygems_version: 3.6.9
|
|
198
200
|
specification_version: 4
|
|
199
201
|
summary: A pretty IRB replacement with auto-correct and beautiful fonts
|
|
200
202
|
test_files: []
|