问题
I am running rails 2.3.10 with bundler. I use rvm, in global gemsets usually I put the gems useful for the irb. By default I had these there: map_by_method, what_methods, ap, net-http-spy, hirb, looksee, pp, wirble.
When I start irb, the gems it needs are avalaible for it, and the things look as they should. However, when I start script/console, it cannot reach the gems in the current rvm gemset only those which are defined in Gemfile
. I get message no such file to load -- map_by_method
. Obviously I do not want to put those irb specific files to my Gemfile
.
Do you know some way, how to convince script/console to use also gems outside bundler?
回答1:
bundler will never use any gem that is not defined in the Gemfile. If those gems are for development use only consider adding them to the Gemfile in a group called :development
回答2:
You can hand-require gems from within script console if you need them:
$ script/console
=> require 'rubygems'
=> require 'mygem'
=> include 'MyGem::Stuff'
来源:https://stackoverflow.com/questions/4408313/how-to-avoid-no-such-file-to-load-map-by-method-script-console-with-bundler