Created
April 25, 2011 20:42
-
-
Save MyArtChannel/941174 to your computer and use it in GitHub Desktop.
Use Pry as IRB replacement in rails 3 console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to the end of your development.rb and add | |
# | |
# gem 'pry' | |
# | |
# to your Gemfile and run bundle to install. | |
silence_warnings do | |
begin | |
require 'pry' | |
IRB = Pry | |
rescue LoadError | |
end | |
end |
much obliged grosser, that worked great for me. No messing with the actual project source
I use following one-liner because it leaves irb command unchanged and bundle console
runs whatever you have in Gemfile (eg. bundle console development
). And use pry
if you want repl without Gemfile.
echo "Pry.start || exit rescue LoadError" > ~/.irbrc
I use this in my zshrc:
pry () {
if [ -e Gemfile.lock ] && [ -e ./config/environment.rb ] && grep -q pry Gemfile.lock
then
bundle exec pry -r ./config/environment "$@"
else
/usr/bin/pry "$@"
fi
}
@grosser reload!
doesn't work here using the alias. Any ideas?
@l0b0 see where reload! is defined and include this too or see what else gets included to irb
@13k thanks works great
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@grosser FTW!