如何避免“没有这样的文件来加载——map_by_method”带捆绑器的脚本/控制台?
我正在使用 bundler 运行 rails 2.3.10。我使用rvm,在全局gemsets中通常我把对irb有用的gems。默认情况下,我有这些:map_by_method、what_methods、ap、net-http-spy、hirb、looksee、pp、wirble。
当我启动 irb 时,它需要的宝石是可用的,而且事情看起来就像它们应该的那样。但是,当我启动脚本/控制台时,它无法访问当前 rvm gemset 中的 gem,只能访问 Gemfile
中定义的那些 gem。我收到消息no such file to load -- map_by_method
。显然我不想将这些 irb 特定文件放入我的 Gemfile 中。
您知道如何说服脚本/控制台在捆绑器之外使用 gem 吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Bundler 永远不会使用 Gemfile 中未定义的任何 gem。如果这些 gem 用于开发,请仅考虑将它们添加到名为 :development 的组中的 Gemfile 中
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
如果需要,您可以从脚本控制台手动获取 gem:
You can hand-require gems from within script console if you need them: