From 0a921d3c1f9e461e86d5c8b648b20d267f752909 Mon Sep 17 00:00:00 2001 From: yan Date: Sat, 19 May 2012 14:19:32 -0700 Subject: [PATCH] Added information about pry-nav for ruby debugging --- README.md | 10 ++++++++-- irb/pryrc | 5 +++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b0e6560..5965c19 100644 --- a/README.md +++ b/README.md @@ -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!` 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 diff --git a/irb/pryrc b/irb/pryrc index dbfcdf4..72e375f 100644 --- a/irb/pryrc +++ b/irb/pryrc @@ -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} * " }]