Reputation: 22404
I've added awesome_print to my ~/.irbrc
file like so:
require 'ap'
Inside a Rails project directory, if I run irb
it loads the gem fine, because I've already installed the gem locally. But if I run rails console
, it spits out this error:
cannot load such file -- ap
How can I resolve this? I am guessing that it's looking for the gem in the app's Gemfile, but I don't want to add it to the Gemfile because I don't want other developers requiring that dependency. I only want to use awesome_print on my machine.
I am also using rbenv, if that is of any help.
Upvotes: 3
Views: 1132
Reputation: 4349
There is this trick.
What you need to do is
# Copy the definition of the debundle! method into your ~/.irbrc
# Call 'debundle!' from IRB when you need to.
(as explained at the top of the file)
The text as it appears on the referred to site:
debundle.rb
allows you to require gems that are not in your Gemfile
when inspecting
programs that are run with Bundler.
Use at your own risk!
Paste the code of debundle.rb and you are done! A good place would be your .irbrc
file
before requiring irbtools.
The code is directly taken from pry-debundle.
Please look there for any further information. This repo exists to simplify debundling
without using the pry
repl.
Upvotes: 2