Created
September 29, 2011 15:43
-
-
Save czj/1251031 to your computer and use it in GitHub Desktop.
.irbrc that runs Pry instead of IRB
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
# This script comes from Pry Everywhere by Luca Pette | |
# http://lucapette.com/pry/pry-everywhere/ | |
# https://github.com/carlhuda/bundler/issues/183#issuecomment-1149953 | |
if defined?(::Bundler) | |
global_gemset = ENV['GEM_PATH'].split(':').grep(/ruby.*@global/).first | |
if global_gemset | |
all_global_gem_paths = Dir.glob("#{global_gemset}/gems/*") | |
all_global_gem_paths.each do |p| | |
gem_path = "#{p}/lib" | |
$LOAD_PATH << gem_path | |
end | |
end | |
end | |
# Use Pry everywhere | |
require "rubygems" | |
require 'pry' | |
Pry.start | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 usepry
if you want repl without Gemfile.