Created
September 7, 2011 08:10
-
-
Save lackac/1200027 to your computer and use it in GitHub Desktop.
Use Pry everywhere
This file contains 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
require 'rubygems' | |
# This makes pry itself and all pry gems available | |
$LOAD_PATH.push(*Dir["#{ENV['HOME']}/.prygems/gems/*/lib"]).uniq! | |
begin | |
# Use Pry everywhere | |
require 'pry' | |
rescue LoadError => e | |
end | |
if defined? Pry | |
Pry.start | |
exit | |
else | |
# Do your normal IRB stuff in case Pry is not available | |
end |
This file contains 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
# We do this here as well in case pry was not started through IRB, | |
# but for example from rails console with pry being in the Gemfile | |
$LOAD_PATH.push(*Dir["#{ENV['HOME']}/.prygems/gems/*/lib"]).uniq! | |
# Further Pry configuration | |
# vim FTW | |
Pry.config.editor = "mvim --nofork" | |
# My pry is polite | |
Pry.hooks = { :after_session => proc { puts "bye-bye" } } | |
# Prompt with ruby version | |
Pry.prompt = [ | |
proc { |obj, nest_level| "#{RUBY_ENGINE}-#{RUBY_VERSION} (#{obj})#{":#{nest_level}" if nest_level > 0}> " }, | |
proc { |obj, nest_level| "#{RUBY_ENGINE}-#{RUBY_VERSION} (#{obj})#{":#{nest_level}" if nest_level > 0}* " } | |
] | |
# etc. |
This file contains 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
alias prygem='gem install -i ~/.prygems' | |
alias pry='irb' | |
# You should install gems you want in your REPL with `prygem`: | |
# | |
# $ prygem pry pry-doc hirb coderay |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shouldn't the bash / zshrc file be : irb=pry ?