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.
@@ -0,0 +1,466 @@
1
+ # 📦 Publishing Pretty IRB to RubyGems
2
+
3
+ Complete guide to build and publish your gem to the official RubyGems repository.
4
+
5
+ ---
6
+
7
+ ## 📋 Pre-Publication Checklist
8
+
9
+ Before publishing, ensure:
10
+
11
+ - [ ] Version number updated in `lib/pretty_irb/version.rb`
12
+ - [ ] All tests passing: `bundle exec rspec`
13
+ - [ ] README.md is complete and accurate
14
+ - [ ] CHANGELOG.md created (recommended)
15
+ - [ ] LICENSE.txt file present
16
+ - [ ] .gemspec file is correct with all required fields
17
+ - [ ] gem built successfully locally
18
+
19
+ ---
20
+
21
+ ## Step 1: Update Version Number
22
+
23
+ Edit `lib/pretty_irb/version.rb`:
24
+
25
+ ```ruby
26
+ module PrettyIRB
27
+ VERSION = "0.1.0"
28
+ end
29
+ ```
30
+
31
+ Choose version using Semantic Versioning:
32
+ - **0.1.0** - Initial release (Major.Minor.Patch)
33
+ - **0.2.0** - New features added
34
+ - **0.2.1** - Bug fixes only
35
+ - **1.0.0** - Stable production version
36
+
37
+ ---
38
+
39
+ ## Step 2: Verify .gemspec File
40
+
41
+ Check `pretty_irb.gemspec` has all required fields:
42
+
43
+ ```ruby
44
+ spec.name = "pretty_irb"
45
+ spec.version = PrettyIRB::VERSION
46
+ spec.authors = ["Your Name"]
47
+ spec.email = ["your.email@example.com"]
48
+ spec.summary = "Beautiful, feature-rich Ruby REPL"
49
+ spec.description = "Enhanced Interactive Ruby Shell with syntax highlighting, auto-correct, AI helper, and more"
50
+ spec.homepage = "https://github.com/yourusername/pretty_irb"
51
+ spec.license = "MIT"
52
+
53
+ spec.files = `git ls-files -z`.split("\x0")
54
+ spec.bindir = "exe"
55
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
56
+ spec.require_paths = ["lib"]
57
+
58
+ spec.required_ruby_version = ">= 2.7.0"
59
+
60
+ spec.add_dependency "irb", ">= 1.0"
61
+ spec.add_dependency "reline", "~> 0.3"
62
+ spec.add_dependency "colorize", "~> 0.8"
63
+ spec.add_dependency "rouge", "~> 3.26"
64
+ spec.add_dependency "did_you_mean", "~> 1.5"
65
+ ```
66
+
67
+ **Important updates needed:**
68
+ - Change `authors` to your name
69
+ - Change `email` to your email
70
+ - Update `homepage` to your GitHub repo URL
71
+ - Verify all dependencies are correct
72
+
73
+ ---
74
+
75
+ ## Step 3: Create a RubyGems Account
76
+
77
+ If you don't have one:
78
+
79
+ 1. Go to https://rubygems.org
80
+ 2. Click "Sign up"
81
+ 3. Fill in username, email, password
82
+ 4. Verify email address
83
+ 5. Save your API key (copy from Settings → API Keys)
84
+
85
+ ---
86
+
87
+ ## Step 4: Set Up Local Credentials
88
+
89
+ Create `~/.gem/credentials` file:
90
+
91
+ ```bash
92
+ mkdir -p ~/.gem
93
+ touch ~/.gem/credentials
94
+ chmod 600 ~/.gem/credentials
95
+ ```
96
+
97
+ Edit `~/.gem/credentials` and add:
98
+
99
+ ```yaml
100
+ ---
101
+ :rubygems_api_key: your_api_key_here
102
+ ```
103
+
104
+ **Windows PowerShell** - Create file manually:
105
+ ```powershell
106
+ # Create directory
107
+ New-Item -ItemType Directory -Path "$env:USERPROFILE\.gem" -Force
108
+
109
+ # Create credentials file
110
+ $credentials = @"
111
+ ---
112
+ :rubygems_api_key: your_api_key_here
113
+ "@
114
+
115
+ $credentials | Out-File -FilePath "$env:USERPROFILE\.gem\credentials" -Encoding ASCII
116
+ ```
117
+
118
+ Then set permissions (if on Windows with WSL):
119
+ ```bash
120
+ chmod 600 ~/.gem/credentials
121
+ ```
122
+
123
+ **Alternative: Use gemcutter gem**
124
+ ```bash
125
+ gem install gemcutter
126
+ gem tumble # Interactive setup
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Step 5: Build the Gem
132
+
133
+ Navigate to your project directory:
134
+
135
+ ```bash
136
+ cd c:\Users\Jayesh\Music\ROR\pretty_irb
137
+ ```
138
+
139
+ Build the gem:
140
+
141
+ ```bash
142
+ gem build pretty_irb.gemspec
143
+ ```
144
+
145
+ Output: `pretty_irb-0.1.0.gem` file created
146
+
147
+ Verify the build:
148
+ ```bash
149
+ gem list --local pretty_irb
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Step 6: Test the Gem Locally (Optional but Recommended)
155
+
156
+ Install from the local gem file:
157
+
158
+ ```bash
159
+ gem install ./pretty_irb-0.1.0.gem
160
+ ```
161
+
162
+ Test it works:
163
+ ```bash
164
+ pretty_irb
165
+ ```
166
+
167
+ Uninstall for testing:
168
+ ```bash
169
+ gem uninstall pretty_irb
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Step 7: Publish to RubyGems
175
+
176
+ Push the gem to RubyGems:
177
+
178
+ ```bash
179
+ gem push pretty_irb-0.1.0.gem
180
+ ```
181
+
182
+ **Expected output:**
183
+ ```
184
+ Pushing gem to https://rubygems.org...
185
+ Successfully registered gem: pretty_irb (0.1.0)
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Step 8: Verify Publication
191
+
192
+ Check RubyGems:
193
+
194
+ 1. Visit: https://rubygems.org/gems/pretty_irb
195
+ 2. Or search: https://rubygems.org/search?query=pretty_irb
196
+ 3. Or check in terminal:
197
+ ```bash
198
+ gem search pretty_irb
199
+ gem search pretty_irb -r # -r checks remote
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Step 9: Install from RubyGems (Public)
205
+
206
+ Anyone can now install with:
207
+
208
+ ```bash
209
+ gem install pretty_irb
210
+ ```
211
+
212
+ Or in Gemfile:
213
+ ```ruby
214
+ gem 'pretty_irb'
215
+ bundle install
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Updating to a New Version
221
+
222
+ When you want to release version 0.2.0:
223
+
224
+ 1. **Update version** in `lib/pretty_irb/version.rb`:
225
+ ```ruby
226
+ VERSION = "0.2.0"
227
+ ```
228
+
229
+ 2. **Update CHANGELOG.md** with changes
230
+
231
+ 3. **Commit to Git**:
232
+ ```bash
233
+ git add .
234
+ git commit -m "Release v0.2.0"
235
+ git tag v0.2.0
236
+ git push origin main
237
+ git push origin v0.2.0
238
+ ```
239
+
240
+ 4. **Build and Push**:
241
+ ```bash
242
+ gem build pretty_irb.gemspec
243
+ gem push pretty_irb-0.2.0.gem
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Complete Workflow Script
249
+
250
+ Save this as `publish.sh`:
251
+
252
+ ```bash
253
+ #!/bin/bash
254
+
255
+ # Colors
256
+ RED='\033[0;31m'
257
+ GREEN='\033[0;32m'
258
+ YELLOW='\033[1;33m'
259
+ NC='\033[0m' # No Color
260
+
261
+ # Get version from lib/pretty_irb/version.rb
262
+ VERSION=$(grep 'VERSION = ' lib/pretty_irb/version.rb | sed 's/.*VERSION = "\(.*\)".*/\1/')
263
+
264
+ echo -e "${YELLOW}Publishing Pretty IRB v${VERSION}...${NC}"
265
+
266
+ # Step 1: Run tests
267
+ echo -e "${YELLOW}Running tests...${NC}"
268
+ bundle exec rspec
269
+ if [ $? -ne 0 ]; then
270
+ echo -e "${RED}Tests failed! Fix errors before publishing.${NC}"
271
+ exit 1
272
+ fi
273
+
274
+ # Step 2: Build gem
275
+ echo -e "${YELLOW}Building gem...${NC}"
276
+ gem build pretty_irb.gemspec
277
+ if [ ! -f "pretty_irb-${VERSION}.gem" ]; then
278
+ echo -e "${RED}Gem build failed!${NC}"
279
+ exit 1
280
+ fi
281
+
282
+ # Step 3: Test local install
283
+ echo -e "${YELLOW}Testing local install...${NC}"
284
+ gem install "./pretty_irb-${VERSION}.gem"
285
+ gem uninstall pretty_irb --force
286
+
287
+ # Step 4: Push to RubyGems
288
+ echo -e "${YELLOW}Pushing to RubyGems...${NC}"
289
+ gem push "pretty_irb-${VERSION}.gem"
290
+ if [ $? -ne 0 ]; then
291
+ echo -e "${RED}Push failed!${NC}"
292
+ exit 1
293
+ fi
294
+
295
+ # Step 5: Verify
296
+ echo -e "${YELLOW}Verifying on RubyGems...${NC}"
297
+ sleep 5
298
+ gem search pretty_irb -r
299
+
300
+ echo -e "${GREEN}✓ Successfully published Pretty IRB v${VERSION}!${NC}"
301
+ echo -e "${GREEN}Install with: gem install pretty_irb${NC}"
302
+ ```
303
+
304
+ Usage:
305
+ ```bash
306
+ chmod +x publish.sh
307
+ ./publish.sh
308
+ ```
309
+
310
+ ---
311
+
312
+ ## PowerShell Publishing Script
313
+
314
+ Save as `publish.ps1`:
315
+
316
+ ```powershell
317
+ # Get version from version.rb
318
+ $versionMatch = Select-String -Path "lib/pretty_irb/version.rb" -Pattern 'VERSION = "(.*?)"'
319
+ $VERSION = $versionMatch.Matches[0].Groups[1].Value
320
+
321
+ Write-Host "Publishing Pretty IRB v$VERSION..." -ForegroundColor Yellow
322
+
323
+ # Step 1: Run tests
324
+ Write-Host "Running tests..." -ForegroundColor Yellow
325
+ bundle exec rspec
326
+ if ($LASTEXITCODE -ne 0) {
327
+ Write-Host "Tests failed!" -ForegroundColor Red
328
+ exit 1
329
+ }
330
+
331
+ # Step 2: Build gem
332
+ Write-Host "Building gem..." -ForegroundColor Yellow
333
+ gem build pretty_irb.gemspec
334
+
335
+ $gemFile = "pretty_irb-$VERSION.gem"
336
+ if (!(Test-Path $gemFile)) {
337
+ Write-Host "Gem build failed!" -ForegroundColor Red
338
+ exit 1
339
+ }
340
+
341
+ # Step 3: Test local install
342
+ Write-Host "Testing local install..." -ForegroundColor Yellow
343
+ gem install ".\$gemFile"
344
+ gem uninstall pretty_irb --force
345
+
346
+ # Step 4: Push to RubyGems
347
+ Write-Host "Pushing to RubyGems..." -ForegroundColor Yellow
348
+ gem push $gemFile
349
+ if ($LASTEXITCODE -ne 0) {
350
+ Write-Host "Push failed!" -ForegroundColor Red
351
+ exit 1
352
+ }
353
+
354
+ # Step 5: Verify
355
+ Write-Host "Verifying on RubyGems..." -ForegroundColor Yellow
356
+ Start-Sleep -Seconds 5
357
+ gem search pretty_irb -r
358
+
359
+ Write-Host "✓ Successfully published Pretty IRB v$VERSION!" -ForegroundColor Green
360
+ Write-Host "Install with: gem install pretty_irb" -ForegroundColor Green
361
+ ```
362
+
363
+ Usage:
364
+ ```powershell
365
+ powershell -ExecutionPolicy Bypass -File publish.ps1
366
+ ```
367
+
368
+ ---
369
+
370
+ ## Troubleshooting
371
+
372
+ ### Error: "Please sign in"
373
+ **Solution**: Ensure credentials are set in `~/.gem/credentials`
374
+ ```bash
375
+ cat ~/.gem/credentials # Check if API key is there
376
+ ```
377
+
378
+ ### Error: "Gem already exists"
379
+ **Solution**: You're publishing the same version twice. Increment version number.
380
+
381
+ ### Error: "403 Forbidden"
382
+ **Solution**: API key is invalid or expired. Get a new one from RubyGems Settings.
383
+
384
+ ### Error: "Gem file not found"
385
+ **Solution**: Make sure you built the gem first with `gem build pretty_irb.gemspec`
386
+
387
+ ### Can't find gem after pushing
388
+ **Solution**: RubyGems indexing takes 1-5 minutes. Wait and try:
389
+ ```bash
390
+ gem search pretty_irb -r
391
+ ```
392
+
393
+ ---
394
+
395
+ ## Best Practices
396
+
397
+ ✅ **Do:**
398
+ - Test locally before publishing
399
+ - Use semantic versioning
400
+ - Keep CHANGELOG.md updated
401
+ - Write descriptive commit messages
402
+ - Tag releases in Git
403
+ - Test on multiple Ruby versions
404
+ - Keep dependencies minimal
405
+
406
+ ❌ **Don't:**
407
+ - Publish major breaking changes without bumping major version
408
+ - Publish with failing tests
409
+ - Use vague version names
410
+ - Forget to update documentation
411
+ - Publish private credentials
412
+
413
+ ---
414
+
415
+ ## Resources
416
+
417
+ - **RubyGems.org**: https://rubygems.org
418
+ - **Gem Guides**: https://guides.rubygems.org
419
+ - **Semantic Versioning**: https://semver.org
420
+ - **Make Ruby Gems**: https://guides.rubygems.org/make-your-own-gem/
421
+
422
+ ---
423
+
424
+ ## Quick Reference Commands
425
+
426
+ ```bash
427
+ # Build gem
428
+ gem build pretty_irb.gemspec
429
+
430
+ # Push to RubyGems (requires credentials)
431
+ gem push pretty_irb-0.1.0.gem
432
+
433
+ # Search RubyGems
434
+ gem search pretty_irb -r
435
+
436
+ # Install from RubyGems
437
+ gem install pretty_irb
438
+
439
+ # Uninstall locally
440
+ gem uninstall pretty_irb
441
+
442
+ # Check local gems
443
+ gem list pretty_irb
444
+
445
+ # View gem info
446
+ gem info pretty_irb
447
+ ```
448
+
449
+ ---
450
+
451
+ ## Final Checklist Before Publishing
452
+
453
+ - [ ] Version updated to next release number
454
+ - [ ] All tests pass: `bundle exec rspec`
455
+ - [ ] README.md is complete and accurate
456
+ - [ ] CHANGELOG.md has entry for new version
457
+ - [ ] .gemspec file has correct metadata
458
+ - [ ] RubyGems account created
459
+ - [ ] API key saved in `~/.gem/credentials`
460
+ - [ ] Gem builds without errors: `gem build pretty_irb.gemspec`
461
+ - [ ] Local test install works
462
+ - [ ] Ready to push: `gem push pretty_irb-X.X.X.gem`
463
+
464
+ ---
465
+
466
+ **You're all set to publish Pretty IRB to RubyGems!** 🚀
data/QUICKSTART.md ADDED
@@ -0,0 +1,70 @@
1
+ # Quick Start
2
+
3
+ ## 🚀 Get Started in 3 Steps
4
+
5
+ ### Step 1: Install Dependencies
6
+ ```bash
7
+ cd c:\Users\Jayesh\Music\ROR\pretty_irb
8
+ bundle install
9
+ ```
10
+
11
+ ### Step 2: Run Pretty IRB
12
+ ```bash
13
+ ruby bin/console
14
+ # or for development
15
+ ruby exe/pretty_irb
16
+ ```
17
+
18
+ ### Step 3: Start Using It!
19
+ ```ruby
20
+ pretty_irb >> 1 + 2
21
+ => 3
22
+
23
+ pretty_irb >> "hello".upcase
24
+ => "HELLO"
25
+
26
+ pretty_irb >> help # See available commands
27
+ ```
28
+
29
+ ## 📚 Common Commands
30
+
31
+ | Command | Description |
32
+ |---------|-------------|
33
+ | `help` | Show available commands |
34
+ | `exit` | Quit the shell |
35
+ | `clear` | Clear the screen |
36
+ | `history` | Show command history |
37
+ | `reset` | Reset the context |
38
+
39
+ ## 🎨 Features at a Glance
40
+
41
+ ✨ **Beautiful Syntax Highlighting**
42
+ - Your Ruby code is automatically highlighted with vibrant colors
43
+
44
+ 🔧 **Smart Auto-Correction**
45
+ - Common typos are automatically fixed
46
+ - Helpful suggestions for errors
47
+
48
+ 💡 **Smart Error Messages**
49
+ - Get suggestions when you make mistakes
50
+ - Better error reporting than standard IRB
51
+
52
+ ⚡ **Enhanced Readline**
53
+ - Command history with arrow keys
54
+ - Better line editing
55
+ - Tab completion
56
+
57
+ ## 📖 Learn More
58
+
59
+ - See `README.md` for full documentation
60
+ - Check `EXAMPLES.md` for code examples
61
+ - Read `SETUP.md` for detailed setup instructions
62
+
63
+ ## 🎯 Next Steps
64
+
65
+ 1. **Explore the code**: Look at `lib/pretty_irb/` to understand how it works
66
+ 2. **Run tests**: Execute `bundle exec rspec` to run tests
67
+ 3. **Build the gem**: Run `gem build pretty_irb.gemspec`
68
+ 4. **Customize**: Add your own auto-corrections and themes
69
+
70
+ Enjoy your Pretty IRB! 🎉