Added information about pry-nav for ruby debugging

This commit is contained in:
yan 2012-05-19 14:19:32 -07:00
parent cfe89df184
commit 0a921d3c1f
2 changed files with 13 additions and 2 deletions

View File

@ -187,12 +187,17 @@ an example.
## Pry
Pry (http://pry.github.com/) offers a much better out of the box IRB experience
with colors, tab completion, and lots of other tricks. You should:
with colors, tab completion, and lots of other tricks. You can also use it
as an actual debugger by installing pry-nav (https://github.com/nixme/pry-nav) to
get colorized debugging that shows you where you are as you step through.
You should:
### Install the gem
```bash
gem install pry
gem install pry-nav
gem install awesome_print
```
@ -200,16 +205,17 @@ gem install awesome_print
* as irb: `pry`
* as rails console: `script/console --irb=pry`
* as a debugger: `require 'pry'; binding.pry` in your code (or just type `pry!<space>` to make vim do it)
### Pry Customizations:
* `clear` command to clear screen
* `sql` command to execute something (within a rails console)
* `c` (continue) `n` (next) `s` (step) commands for debugging using pry-nav
* all objects displayed in readable format (colorized, sorted hash keys) - via awesome_print
* a few color modifications to make it more useable
* type `help` to see all the commands
## Git
### User Info

View File

@ -1,6 +1,11 @@
# === EDITOR ===
Pry.editor = 'vi'
# == Pry-Nav - Using pry as a debugger ==
Pry.commands.alias_command 'c', 'continue'
Pry.commands.alias_command 's', 'step'
Pry.commands.alias_command 'n', 'next'
# === CUSTOM PROMPT ===
# This prompt shows the ruby version (useful for RVM)
Pry.prompt = [proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, proc { |obj, nest_level, _| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }]