pretty_irb 0.1.0
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 +7 -0
- data/00-MANIFEST.md +356 -0
- data/ADVANCED_FEATURES.md +440 -0
- data/AI_HELP.md +408 -0
- data/AI_QUICK_START.md +247 -0
- data/COMPLETE.md +421 -0
- data/EXAMPLES.md +206 -0
- data/FEATURE_SHOWCASE.md +441 -0
- data/FILE_STRUCTURE.md +231 -0
- data/Gemfile +3 -0
- data/IMPLEMENTATION_COMPLETE.md +309 -0
- data/INDEX.md +708 -0
- data/INSTALL.md +250 -0
- data/LICENSE.txt +21 -0
- data/PUBLISH_TO_RUBYGEMS.md +466 -0
- data/QUICKSTART.md +70 -0
- data/QUICK_REFERENCE.md +253 -0
- data/README.md +251 -0
- data/Rakefile +6 -0
- data/SETUP.md +209 -0
- data/START_HERE.md +462 -0
- data/SUMMARY.md +372 -0
- data/WELCOME.md +300 -0
- data/WHAT_IS_NEW.md +324 -0
- data/exe/irb1 +6 -0
- data/exe/pretty_irb +6 -0
- data/lib/pretty_irb/ai_helper.rb +842 -0
- data/lib/pretty_irb/auto_corrector.rb +76 -0
- data/lib/pretty_irb/benchmarker.rb +94 -0
- data/lib/pretty_irb/cheat_sheet.rb +476 -0
- data/lib/pretty_irb/formatter.rb +66 -0
- data/lib/pretty_irb/history_manager.rb +97 -0
- data/lib/pretty_irb/shell.rb +387 -0
- data/lib/pretty_irb/snippet_manager.rb +119 -0
- data/lib/pretty_irb/variable_inspector.rb +146 -0
- data/lib/pretty_irb/version.rb +3 -0
- data/lib/pretty_irb.rb +26 -0
- metadata +200 -0
data/FEATURE_SHOWCASE.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
# 🎨 Pretty IRB - Complete Feature Showcase
|
|
2
|
+
|
|
3
|
+
## What's Included
|
|
4
|
+
|
|
5
|
+
Pretty IRB is a **powerful, feature-rich Ruby REPL** that transforms your interactive Ruby experience with 10+ advanced features.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📦 Features Overview
|
|
10
|
+
|
|
11
|
+
### 1️⃣ **Beautiful Output Formatting**
|
|
12
|
+
Automatically colorize and format all Ruby objects for beautiful display:
|
|
13
|
+
- **Strings** → Blue
|
|
14
|
+
- **Numbers** → Green
|
|
15
|
+
- **Booleans** → Cyan
|
|
16
|
+
- **Nil** → Gray
|
|
17
|
+
- **Arrays/Hashes** → Formatted with indentation
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
pretty_irb >> {name: "Ruby", version: 3.0}
|
|
21
|
+
=> {:name=>"Ruby", :version=>3.0}
|
|
22
|
+
# Displays in colorized format
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2️⃣ **Auto-Correct & Smart Suggestions**
|
|
26
|
+
Never lose time to typos - Pretty IRB automatically corrects common mistakes:
|
|
27
|
+
- `.lenght` → `.length` ✅
|
|
28
|
+
- `.sizze` → `.size` ✅
|
|
29
|
+
- Missing method suggestions
|
|
30
|
+
- Variable name recommendations
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
pretty_irb >> "hello".lenght
|
|
34
|
+
# Auto-corrected to: "hello".length
|
|
35
|
+
=> 5
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 3️⃣ **AI Learning Helper** 🤖
|
|
39
|
+
Learn Ruby without leaving your REPL:
|
|
40
|
+
|
|
41
|
+
```ruby
|
|
42
|
+
?explain(map) # Understand any method
|
|
43
|
+
?example(array) # See code examples
|
|
44
|
+
?debug(code) # Analyze for issues
|
|
45
|
+
?practices(naming) # Learn conventions
|
|
46
|
+
?ref(operators) # Quick syntax lookup
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 4️⃣ **History Manager** 📜
|
|
50
|
+
Track, search, and replay all commands:
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
history # View all
|
|
54
|
+
history search map # Find commands
|
|
55
|
+
history last 10 # Recent 10
|
|
56
|
+
history export work.rb # Save session
|
|
57
|
+
history clear # Start fresh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Features:**
|
|
61
|
+
- Full command history with timestamps
|
|
62
|
+
- Powerful search capabilities
|
|
63
|
+
- Export sessions for reference/sharing
|
|
64
|
+
- Clear history when needed
|
|
65
|
+
|
|
66
|
+
### 5️⃣ **Snippet Manager** 💾
|
|
67
|
+
Save and reuse code patterns instantly:
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
snippet save double_arr "[1,2,3].map { |x| x*2 }"
|
|
71
|
+
snippet load double_arr
|
|
72
|
+
snippet list # View all
|
|
73
|
+
snippet show double_arr # Show details
|
|
74
|
+
snippet delete double_arr
|
|
75
|
+
snippet search array # Find snippets
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Features:**
|
|
79
|
+
- JSON-based persistent storage
|
|
80
|
+
- Auto-tagging (class, method, array, hash, etc.)
|
|
81
|
+
- Searchable by name, content, or tags
|
|
82
|
+
- Description support
|
|
83
|
+
- Stored in `~/.pretty_irb_snippets/`
|
|
84
|
+
|
|
85
|
+
### 6️⃣ **Variable Inspector** 🔍
|
|
86
|
+
Understand your current REPL state:
|
|
87
|
+
|
|
88
|
+
```ruby
|
|
89
|
+
vars # List all variables
|
|
90
|
+
vars myvar # Inspect specific
|
|
91
|
+
vars type:String # Find by type
|
|
92
|
+
vars search:pattern # Search names
|
|
93
|
+
vars memory # Memory breakdown
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Features:**
|
|
97
|
+
- Detailed variable info (type, size, value)
|
|
98
|
+
- Type-based filtering
|
|
99
|
+
- Memory usage estimation
|
|
100
|
+
- Shows encoding for strings
|
|
101
|
+
- Special handling for collections
|
|
102
|
+
|
|
103
|
+
### 7️⃣ **Benchmarker** ⚡
|
|
104
|
+
Measure performance right in your REPL:
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
bench "[1,2,3]*1000"
|
|
108
|
+
bench compare "[1,2,3].map" vs "[1,2,3].each"
|
|
109
|
+
bench memory "[1]*10000"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Features:**
|
|
113
|
+
- Configurable iterations
|
|
114
|
+
- Real-time millisecond measurements
|
|
115
|
+
- Per-iteration metrics
|
|
116
|
+
- Operations per second rate
|
|
117
|
+
- Comparison mode with winner calculation
|
|
118
|
+
- Memory profiling with GC stats
|
|
119
|
+
|
|
120
|
+
### 8️⃣ **Ruby Cheat Sheet** 📖
|
|
121
|
+
Quick reference without leaving REPL:
|
|
122
|
+
|
|
123
|
+
```ruby
|
|
124
|
+
cheat # General overview
|
|
125
|
+
cheat array # Array methods
|
|
126
|
+
cheat hash # Hash methods
|
|
127
|
+
cheat string # String methods
|
|
128
|
+
cheat enumerable # Enumerable methods
|
|
129
|
+
cheat file # File I/O
|
|
130
|
+
cheat regex # Regular expressions
|
|
131
|
+
cheat date # Date & Time
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Covers:**
|
|
135
|
+
- Method syntax & usage
|
|
136
|
+
- Common patterns
|
|
137
|
+
- Best practices
|
|
138
|
+
- Examples & variations
|
|
139
|
+
|
|
140
|
+
### 9️⃣ **Enhanced Error Messages**
|
|
141
|
+
Smart error handling with corrections:
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
NameError: undefined local variable or method `foo'
|
|
145
|
+
💡 Suggestions: 'For', 'for', 'foo'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 🔟 **Enhanced Readline**
|
|
149
|
+
Better line editing:
|
|
150
|
+
- History navigation
|
|
151
|
+
- Line editing capabilities
|
|
152
|
+
- Multi-line support
|
|
153
|
+
- Auto-completion ready
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🎯 Real-World Workflows
|
|
158
|
+
|
|
159
|
+
### Workflow 1: Performance Optimization
|
|
160
|
+
|
|
161
|
+
```ruby
|
|
162
|
+
# 1. Load your function
|
|
163
|
+
snippet save expensive_func "result = heavy_computation"
|
|
164
|
+
|
|
165
|
+
# 2. Benchmark current version
|
|
166
|
+
bench expensive_func
|
|
167
|
+
|
|
168
|
+
# 3. Try optimized version
|
|
169
|
+
# ... write optimized code ...
|
|
170
|
+
|
|
171
|
+
# 4. Compare
|
|
172
|
+
bench compare "heavy_computation" vs "optimized_computation"
|
|
173
|
+
|
|
174
|
+
# 5. Check memory impact
|
|
175
|
+
bench memory "optimized_computation"
|
|
176
|
+
|
|
177
|
+
# 6. Save optimized version
|
|
178
|
+
snippet save optimized_func "result = optimized_computation"
|
|
179
|
+
|
|
180
|
+
# 7. Export everything
|
|
181
|
+
history export optimization_session.rb
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Workflow 2: Learning Ruby
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
# 1. View reference
|
|
188
|
+
cheat array
|
|
189
|
+
|
|
190
|
+
# 2. Try methods from cheatsheet
|
|
191
|
+
[1, 2, 3].select { |x| x > 1 }
|
|
192
|
+
|
|
193
|
+
# 3. Get detailed explanation
|
|
194
|
+
?explain(select)
|
|
195
|
+
|
|
196
|
+
# 4. See real examples
|
|
197
|
+
?example(enumerable)
|
|
198
|
+
|
|
199
|
+
# 5. Learn best practices
|
|
200
|
+
?practices(readability)
|
|
201
|
+
|
|
202
|
+
# 6. Save patterns you like
|
|
203
|
+
snippet save select_example "[1,2,3].select { |x| x > 1 }"
|
|
204
|
+
|
|
205
|
+
# 7. Build your knowledge base
|
|
206
|
+
history export learning_session.rb
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Workflow 3: Debugging Session
|
|
210
|
+
|
|
211
|
+
```ruby
|
|
212
|
+
# 1. Define variables
|
|
213
|
+
user = {name: "Alice", age: 30}
|
|
214
|
+
|
|
215
|
+
# 2. Inspect state
|
|
216
|
+
vars
|
|
217
|
+
|
|
218
|
+
# 3. Try different approaches
|
|
219
|
+
user[:name].upcase
|
|
220
|
+
|
|
221
|
+
# 4. Analyze code
|
|
222
|
+
?debug("user[:name].upcase")
|
|
223
|
+
|
|
224
|
+
# 5. Track what works
|
|
225
|
+
history search upcase
|
|
226
|
+
|
|
227
|
+
# 6. Save working solutions
|
|
228
|
+
snippet save user_greeting "puts \"Hello #{user[:name].upcase}!\""
|
|
229
|
+
|
|
230
|
+
# 7. Review session
|
|
231
|
+
history export debug_session.rb
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Workflow 4: Code Snippet Library
|
|
235
|
+
|
|
236
|
+
```ruby
|
|
237
|
+
# Save common patterns
|
|
238
|
+
snippet save sum_array "arr.reduce(:+)"
|
|
239
|
+
snippet save group_by_type "arr.group_by { |x| x.class }"
|
|
240
|
+
snippet save flatten_hash "hash.values.flatten"
|
|
241
|
+
|
|
242
|
+
# Later, quickly load them
|
|
243
|
+
snippet load sum_array
|
|
244
|
+
|
|
245
|
+
# Search when you remember part of it
|
|
246
|
+
snippet search flatten
|
|
247
|
+
|
|
248
|
+
# Share with team
|
|
249
|
+
history export my_snippets.rb
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 🚀 Installation & Setup
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Install gem
|
|
258
|
+
gem install pretty_irb
|
|
259
|
+
|
|
260
|
+
# Or add to Gemfile
|
|
261
|
+
echo "gem 'pretty_irb'" >> Gemfile
|
|
262
|
+
bundle install
|
|
263
|
+
|
|
264
|
+
# Run
|
|
265
|
+
pretty_irb
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## 📊 Command Reference Matrix
|
|
271
|
+
|
|
272
|
+
| Category | Command | What It Does |
|
|
273
|
+
|----------|---------|-------------|
|
|
274
|
+
| **Core** | `exit` | Leave REPL |
|
|
275
|
+
| | `help` | Show all commands |
|
|
276
|
+
| | `clear` | Clear screen |
|
|
277
|
+
| **History** | `history` | Show all commands |
|
|
278
|
+
| | `history search TERM` | Find commands |
|
|
279
|
+
| | `history last N` | Recent N commands |
|
|
280
|
+
| | `history export FILE` | Save to file |
|
|
281
|
+
| | `history clear` | Clear history |
|
|
282
|
+
| **Snippets** | `snippet list` | Show all snippets |
|
|
283
|
+
| | `snippet save NAME CODE` | Store code |
|
|
284
|
+
| | `snippet load NAME` | Run snippet |
|
|
285
|
+
| | `snippet show NAME` | View snippet |
|
|
286
|
+
| | `snippet delete NAME` | Remove snippet |
|
|
287
|
+
| | `snippet search TERM` | Find snippets |
|
|
288
|
+
| **Variables** | `vars` | List all vars |
|
|
289
|
+
| | `vars NAME` | Inspect var |
|
|
290
|
+
| | `vars type:TYPE` | Vars of type |
|
|
291
|
+
| | `vars search:TERM` | Find vars |
|
|
292
|
+
| | `vars memory` | Memory report |
|
|
293
|
+
| **Performance** | `bench CODE` | Benchmark code |
|
|
294
|
+
| | `bench compare A vs B` | Compare two |
|
|
295
|
+
| | `bench memory CODE` | Memory test |
|
|
296
|
+
| **Reference** | `cheat` | Show reference |
|
|
297
|
+
| | `cheat TOPIC` | Topic help |
|
|
298
|
+
| **Learning** | `?explain(method)` | Explain method |
|
|
299
|
+
| | `?example(topic)` | Code examples |
|
|
300
|
+
| | `?debug(code)` | Analyze code |
|
|
301
|
+
| | `?practices(topic)` | Best practices |
|
|
302
|
+
| | `?ref(keyword)` | Quick lookup |
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 💡 Pro Tips
|
|
307
|
+
|
|
308
|
+
### Tip 1: Build Your Snippet Library
|
|
309
|
+
```ruby
|
|
310
|
+
# Over time, save useful patterns
|
|
311
|
+
snippet save each_with_index "arr.each_with_index { |x, i| puts i, x }"
|
|
312
|
+
snippet save hash_select "hash.select { |k, v| v > 0 }"
|
|
313
|
+
snippet save safe_division "a / b rescue 'Division error'"
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Tip 2: Performance-Driven Development
|
|
317
|
+
```ruby
|
|
318
|
+
# Always benchmark before/after optimizations
|
|
319
|
+
bench "original_approach"
|
|
320
|
+
# ... make changes ...
|
|
321
|
+
bench compare "original_approach" vs "new_approach"
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Tip 3: Learn in Context
|
|
325
|
+
```ruby
|
|
326
|
+
# Use cheatsheet → try code → get explanation
|
|
327
|
+
cheat string
|
|
328
|
+
"hello".chars.reverse.join
|
|
329
|
+
?explain(chars)
|
|
330
|
+
?explain(reverse)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Tip 4: Export Sessions
|
|
334
|
+
```ruby
|
|
335
|
+
# Save successful sessions for reference
|
|
336
|
+
history export successful_implementation.rb
|
|
337
|
+
# Later: cat successful_implementation.rb
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Tip 5: Type Exploration
|
|
341
|
+
```ruby
|
|
342
|
+
# Create test data
|
|
343
|
+
strings = ["a", "b", "c"]
|
|
344
|
+
numbers = [1, 2, 3]
|
|
345
|
+
hashes = [{x: 1}, {y: 2}]
|
|
346
|
+
|
|
347
|
+
# Explore by type
|
|
348
|
+
vars type:String
|
|
349
|
+
vars type:Array
|
|
350
|
+
vars memory # See what takes space
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## 🎓 Learning Resources
|
|
356
|
+
|
|
357
|
+
### Included Documentation
|
|
358
|
+
1. **README.md** - Main features overview
|
|
359
|
+
2. **ADVANCED_FEATURES.md** - Detailed feature guide (800+ lines)
|
|
360
|
+
3. **AI_HELP.md** - AI learning features
|
|
361
|
+
4. **AI_QUICK_START.md** - Quick AI examples
|
|
362
|
+
5. **QUICK_REFERENCE.md** - Fast lookup
|
|
363
|
+
6. **FEATURE_SHOWCASE.md** - This file!
|
|
364
|
+
|
|
365
|
+
### Quick Start Path
|
|
366
|
+
1. Run `pretty_irb`
|
|
367
|
+
2. Type `help` to see all commands
|
|
368
|
+
3. Try `cheat` for Ruby reference
|
|
369
|
+
4. Try `?explain(map)` to learn
|
|
370
|
+
5. Type `snippet save` to store code
|
|
371
|
+
6. Type `history` to see your work
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 🔧 Technical Details
|
|
376
|
+
|
|
377
|
+
### Storage Locations
|
|
378
|
+
- **Snippets**: `~/.pretty_irb_snippets/` (JSON files)
|
|
379
|
+
- **History**: Only in-memory during session (export to save)
|
|
380
|
+
- **Config**: Can be extended via configuration
|
|
381
|
+
|
|
382
|
+
### Dependencies
|
|
383
|
+
- **irb** - Interactive Ruby base
|
|
384
|
+
- **reline** - Enhanced readline
|
|
385
|
+
- **colorize** - Terminal colors
|
|
386
|
+
- **did_you_mean** - Smart suggestions
|
|
387
|
+
- **rouge** - Syntax highlighting
|
|
388
|
+
|
|
389
|
+
### Ruby Compatibility
|
|
390
|
+
- Ruby 2.7.0+
|
|
391
|
+
- Works on Linux, macOS, Windows
|
|
392
|
+
- WSL supported
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 🌟 Why Pretty IRB?
|
|
397
|
+
|
|
398
|
+
### vs Regular IRB
|
|
399
|
+
- ✅ Way more powerful
|
|
400
|
+
- ✅ Better organized
|
|
401
|
+
- ✅ Persistent snippets
|
|
402
|
+
- ✅ Performance tools
|
|
403
|
+
- ✅ Learning features
|
|
404
|
+
- ✅ Beautiful output
|
|
405
|
+
|
|
406
|
+
### vs IRB Plugins
|
|
407
|
+
- ✅ Integrated experience
|
|
408
|
+
- ✅ No complex configuration
|
|
409
|
+
- ✅ All features built-in
|
|
410
|
+
- ✅ Active development
|
|
411
|
+
|
|
412
|
+
### Ideal For
|
|
413
|
+
- 🎓 **Learning Ruby** - Use AI helper & cheatsheet
|
|
414
|
+
- 🔧 **Debugging** - Inspect variables, search history
|
|
415
|
+
- ⚡ **Optimization** - Benchmark & compare code
|
|
416
|
+
- 📚 **Reference** - Cheatsheet always available
|
|
417
|
+
- 💾 **Prototyping** - Save & reuse snippets
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## 🚀 Next Steps
|
|
422
|
+
|
|
423
|
+
1. **Install**: `gem install pretty_irb`
|
|
424
|
+
2. **Run**: `pretty_irb`
|
|
425
|
+
3. **Explore**: Type `help`
|
|
426
|
+
4. **Learn**: Try `?explain(map)`
|
|
427
|
+
5. **Create**: Build your snippet library
|
|
428
|
+
6. **Share**: `history export my_work.rb`
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
## 📞 Support
|
|
433
|
+
|
|
434
|
+
- 📖 See ADVANCED_FEATURES.md for detailed guides
|
|
435
|
+
- 💬 Type `help` in Pretty IRB for command list
|
|
436
|
+
- 🔍 Use `history search` to find past commands
|
|
437
|
+
- 💾 Save sessions with `history export`
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
**Happy Ruby coding with Pretty IRB!** 🎨✨
|
data/FILE_STRUCTURE.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Pretty IRB - Complete File Structure
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
pretty_irb/
|
|
5
|
+
│
|
|
6
|
+
├── 📄 .gitignore
|
|
7
|
+
├── 📄 .ruby-version
|
|
8
|
+
├── 📄 Gemfile
|
|
9
|
+
├── 📄 Rakefile
|
|
10
|
+
├── 📄 LICENSE.txt
|
|
11
|
+
├── 📄 pretty_irb.gemspec
|
|
12
|
+
│
|
|
13
|
+
├── 📚 Documentation
|
|
14
|
+
│ ├── 📄 README.md (Main documentation)
|
|
15
|
+
│ ├── 📄 QUICKSTART.md (Get started in 3 steps)
|
|
16
|
+
│ ├── 📄 SETUP.md (Detailed setup guide)
|
|
17
|
+
│ ├── 📄 INSTALL.md (Installation & deployment)
|
|
18
|
+
│ ├── 📄 EXAMPLES.md (Code examples & usage)
|
|
19
|
+
│ ├── 📄 SUMMARY.md (Project summary)
|
|
20
|
+
│ └── 📄 PROJECT_OVERVIEW.ps1 (PowerShell overview)
|
|
21
|
+
│
|
|
22
|
+
├── 📁 bin/
|
|
23
|
+
│ └── console (Development console entry point)
|
|
24
|
+
│
|
|
25
|
+
├── 📁 exe/
|
|
26
|
+
│ └── pretty_irb (Gem executable)
|
|
27
|
+
│
|
|
28
|
+
├── 📁 lib/
|
|
29
|
+
│ ├── pretty_irb.rb (Main gem module)
|
|
30
|
+
│ │
|
|
31
|
+
│ └── 📁 pretty_irb/
|
|
32
|
+
│ ├── version.rb (Version: 0.1.0)
|
|
33
|
+
│ ├── formatter.rb (Syntax highlighting & formatting)
|
|
34
|
+
│ ├── auto_corrector.rb (Auto-correct functionality)
|
|
35
|
+
│ └── shell.rb (Main REPL shell)
|
|
36
|
+
│
|
|
37
|
+
└── 📁 spec/
|
|
38
|
+
├── spec_helper.rb (RSpec configuration)
|
|
39
|
+
├── pretty_irb_spec.rb (Main gem tests)
|
|
40
|
+
├── formatter_spec.rb (Formatter unit tests)
|
|
41
|
+
└── auto_corrector_spec.rb (Auto-corrector tests)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## File Descriptions
|
|
45
|
+
|
|
46
|
+
### Root Configuration Files
|
|
47
|
+
|
|
48
|
+
| File | Purpose |
|
|
49
|
+
|------|---------|
|
|
50
|
+
| `.gitignore` | Git ignore patterns |
|
|
51
|
+
| `.ruby-version` | Ruby version requirement (2.7.0) |
|
|
52
|
+
| `Gemfile` | Bundle dependencies specification |
|
|
53
|
+
| `Rakefile` | Build and test tasks |
|
|
54
|
+
| `LICENSE.txt` | MIT License |
|
|
55
|
+
| `pretty_irb.gemspec` | Gem specification and metadata |
|
|
56
|
+
|
|
57
|
+
### Documentation Files
|
|
58
|
+
|
|
59
|
+
| File | Purpose |
|
|
60
|
+
|------|---------|
|
|
61
|
+
| `README.md` | Comprehensive documentation |
|
|
62
|
+
| `QUICKSTART.md` | 3-step quick start guide |
|
|
63
|
+
| `SETUP.md` | Detailed setup instructions |
|
|
64
|
+
| `INSTALL.md` | Installation and deployment guide |
|
|
65
|
+
| `EXAMPLES.md` | Code examples and usage patterns |
|
|
66
|
+
| `SUMMARY.md` | Project overview and summary |
|
|
67
|
+
| `PROJECT_OVERVIEW.ps1` | PowerShell project information |
|
|
68
|
+
|
|
69
|
+
### Source Code Files
|
|
70
|
+
|
|
71
|
+
| File | Lines | Purpose |
|
|
72
|
+
|------|-------|---------|
|
|
73
|
+
| `lib/pretty_irb.rb` | ~15 | Main gem module, entry point |
|
|
74
|
+
| `lib/pretty_irb/version.rb` | ~3 | Version constant |
|
|
75
|
+
| `lib/pretty_irb/formatter.rb` | ~80 | Syntax highlighting, color output |
|
|
76
|
+
| `lib/pretty_irb/auto_corrector.rb` | ~60 | Error corrections, suggestions |
|
|
77
|
+
| `lib/pretty_irb/shell.rb` | ~150 | REPL implementation |
|
|
78
|
+
|
|
79
|
+
### Executable Files
|
|
80
|
+
|
|
81
|
+
| File | Type | Purpose |
|
|
82
|
+
|------|------|---------|
|
|
83
|
+
| `bin/console` | Shell | Development console |
|
|
84
|
+
| `exe/pretty_irb` | Shell | Gem executable |
|
|
85
|
+
|
|
86
|
+
### Test Files
|
|
87
|
+
|
|
88
|
+
| File | Tests | Purpose |
|
|
89
|
+
|------|-------|---------|
|
|
90
|
+
| `spec/spec_helper.rb` | Setup | RSpec configuration |
|
|
91
|
+
| `spec/pretty_irb_spec.rb` | 2 | Main gem functionality |
|
|
92
|
+
| `spec/formatter_spec.rb` | 6 | Output formatting tests |
|
|
93
|
+
| `spec/auto_corrector_spec.rb` | 3 | Auto-correct tests |
|
|
94
|
+
|
|
95
|
+
## Key Statistics
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Total Files: 25
|
|
99
|
+
- Documentation: 7 files
|
|
100
|
+
- Source Code: 5 files
|
|
101
|
+
- Configuration: 6 files
|
|
102
|
+
- Executables: 2 files
|
|
103
|
+
- Tests: 4 files
|
|
104
|
+
- License & Ignore: 1 file
|
|
105
|
+
|
|
106
|
+
Total Lines of Code: ~400+
|
|
107
|
+
- Core Logic: ~300 lines
|
|
108
|
+
- Tests: ~100 lines
|
|
109
|
+
|
|
110
|
+
Dependencies: 8 total
|
|
111
|
+
- Production: 5 gems
|
|
112
|
+
- Development: 3 gems
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## How to Navigate
|
|
116
|
+
|
|
117
|
+
1. **Getting Started**: Start with `QUICKSTART.md`
|
|
118
|
+
2. **Learn Setup**: Read `SETUP.md` for installation
|
|
119
|
+
3. **See Examples**: Check `EXAMPLES.md` for usage
|
|
120
|
+
4. **Understand Code**: Review files in `lib/pretty_irb/`
|
|
121
|
+
5. **Run Tests**: Execute `bundle exec rspec`
|
|
122
|
+
6. **Deploy**: Follow `INSTALL.md` guide
|
|
123
|
+
|
|
124
|
+
## Module Hierarchy
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
PrettyIRB
|
|
128
|
+
├── VERSION = "0.1.0"
|
|
129
|
+
├── Formatter (output formatting)
|
|
130
|
+
│ ├── format_code()
|
|
131
|
+
│ ├── format_output()
|
|
132
|
+
│ ├── format_error()
|
|
133
|
+
│ └── format_success()
|
|
134
|
+
├── AutoCorrector (error handling)
|
|
135
|
+
│ ├── suggest_corrections()
|
|
136
|
+
│ └── auto_correct_code()
|
|
137
|
+
├── Shell (REPL)
|
|
138
|
+
│ ├── initialize()
|
|
139
|
+
│ ├── run()
|
|
140
|
+
│ └── execute_code()
|
|
141
|
+
└── Error (exception class)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Dependencies Graph
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
pretty_irb
|
|
148
|
+
├── irb (>= 1.0)
|
|
149
|
+
│ └── (Ruby stdlib)
|
|
150
|
+
├── rouge (~> 3.26)
|
|
151
|
+
│ └── (Syntax highlighting)
|
|
152
|
+
├── colorize (~> 0.8)
|
|
153
|
+
│ └── (Terminal colors)
|
|
154
|
+
├── did_you_mean (~> 1.5)
|
|
155
|
+
│ └── (Error suggestions)
|
|
156
|
+
└── reline (~> 0.3)
|
|
157
|
+
└── (Enhanced readline)
|
|
158
|
+
|
|
159
|
+
Development:
|
|
160
|
+
├── rspec (~> 3.0)
|
|
161
|
+
├── rake (~> 13.0)
|
|
162
|
+
└── bundler (~> 2.0)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Quick Command Reference
|
|
166
|
+
|
|
167
|
+
```powershell
|
|
168
|
+
# Installation
|
|
169
|
+
cd c:\Users\Jayesh\Music\ROR\pretty_irb
|
|
170
|
+
bundle install
|
|
171
|
+
|
|
172
|
+
# Run shell
|
|
173
|
+
ruby bin/console
|
|
174
|
+
|
|
175
|
+
# Run tests
|
|
176
|
+
bundle exec rspec
|
|
177
|
+
|
|
178
|
+
# Build gem
|
|
179
|
+
gem build pretty_irb.gemspec
|
|
180
|
+
|
|
181
|
+
# Install locally
|
|
182
|
+
gem install --local pretty_irb-0.1.0.gem
|
|
183
|
+
|
|
184
|
+
# Use installed gem
|
|
185
|
+
pretty_irb
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## File Ownership
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Documentation (User Facing)
|
|
192
|
+
├── README.md ← Start here
|
|
193
|
+
├── QUICKSTART.md ← Then here
|
|
194
|
+
├── EXAMPLES.md ← See examples
|
|
195
|
+
└── INSTALL.md ← For deployment
|
|
196
|
+
|
|
197
|
+
Core Code (Developers)
|
|
198
|
+
├── lib/pretty_irb.rb ← Entry point
|
|
199
|
+
├── lib/pretty_irb/shell.rb ← Main logic
|
|
200
|
+
├── lib/pretty_irb/formatter.rb ← Output
|
|
201
|
+
├── lib/pretty_irb/auto_corrector.rb ← Errors
|
|
202
|
+
└── lib/pretty_irb/version.rb ← Version
|
|
203
|
+
|
|
204
|
+
Tests
|
|
205
|
+
├── spec/spec_helper.rb
|
|
206
|
+
├── spec/pretty_irb_spec.rb
|
|
207
|
+
├── spec/formatter_spec.rb
|
|
208
|
+
└── spec/auto_corrector_spec.rb
|
|
209
|
+
|
|
210
|
+
Configuration
|
|
211
|
+
├── pretty_irb.gemspec ← Gem config
|
|
212
|
+
├── Gemfile ← Dependencies
|
|
213
|
+
├── Rakefile ← Build tasks
|
|
214
|
+
└── .gitignore ← Git ignore
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Ready to Use!
|
|
218
|
+
|
|
219
|
+
Everything is set up and ready to go. Choose your next step:
|
|
220
|
+
|
|
221
|
+
1. **Try it out**: `ruby bin/console`
|
|
222
|
+
2. **Read docs**: Open `README.md`
|
|
223
|
+
3. **Run tests**: `bundle exec rspec`
|
|
224
|
+
4. **Build gem**: `gem build pretty_irb.gemspec`
|
|
225
|
+
5. **Deploy**: Follow `INSTALL.md`
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
**Project Status**: ✅ Complete and Production Ready
|
|
230
|
+
**Version**: 0.1.0
|
|
231
|
+
**Date**: November 25, 2025
|
data/Gemfile
ADDED