Textmate Rails3 没有要加载的文件—捆绑器
当我尝试从 Rails3 中的 TextMate 运行测试时,我收到一个错误,我追溯到 boot.rb。当我尝试通过 textmate 运行 boot.rb 时,出现此错误:
LoadError: no such file to load — bundler
method gem_original_require in custom_require.rb at line 31
method require in custom_require.rb at line 31
at top level in boot.rb at line 4
即使在全新的 Rails 项目中也是如此。我可以从终端调用运行相同的 boot.rb 文件,
ruby <path_to>/boot.rb
我可以验证我的 TM_RUBY 变量与我从命令行调用 which ruby
时相同。您知道我为什么会收到此错误吗?
When I try to run tests from TextMate in Rails3 i get an error that I trace back to boot.rb. When I try to run boot.rb via textmate I get this error:
LoadError: no such file to load — bundler
method gem_original_require in custom_require.rb at line 31
method require in custom_require.rb at line 31
at top level in boot.rb at line 4
This is even in a brand new rails project. I am able to run the same boot.rb file from terminal calling
ruby <path_to>/boot.rb
I can verify that my TM_RUBY variable is the same as when i call which ruby
from the command line. Do you have any clue why I might be getting this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在使用 TextMate 和 RVM 时遇到了同样的问题。您需要做什么:
使用以下 RVM 命令为您要使用的 gemset 创建一个包装器脚本:
这将为您的 RVM 安装添加一个名为
textmate_ruby
的新别名。正如您可能知道的那样,假设您正在使用 Ruby Enterprise (ree) 和一个名为rails3 的 gemset,但任何 RVM 字符串都可以在这里工作。打开 TextMate 的首选项窗口,转到高级 >外壳变量。您需要将
TM_RUBY
shell 变量创建(或更新)为以下内容:如果您的 RVM 安装在您的用户目录中(如我的),则为:
(可选)您可以还需要/想要设置 RUBYOPT shell 变量,以指示 Ruby 加载 rubygems。这可能是使某些捆绑包(如 RSpec)正常工作所必需的。只需将该值设置为
rubygems
。这应该就是您所需要的。
I ran into this same problem with TextMate and RVM. What you need to do:
Create a wrapper script for the gemset you want to use, using this RVM command:
This will add a new alias to your RVM install called
textmate_ruby
. As you can probably tell this assumes you're using Ruby Enterprise (ree) and a gemset called rails3, but any RVM string will work here.Open TextMate's preferences window, go to Advanced > Shell Variables. You need to create (or update) the
TM_RUBY
shell variable to the following:If your RVM is installed in your user dir (like mine), that'll be:
(Optional) You may also need/want to set the
RUBYOPT
shell variable, to instruct Ruby to load rubygems. This may be necessary to make certain bundles (like RSpec) work. Just set the value torubygems
.This should be all you need.
我发现使用 rvm-auto-ruby 方法最简单。
使用
which
找到rvm-auto-ruby
二进制文件:结果是自动加载二进制文件的路径:
将此路径添加到 TextMate 下:Preferences -> ;高级-> Shell 变量
它的功能类似于指向您的 Ruby 活动版本的别名。
屏幕截图:http://cl.ly/23Yl
这些说明可在 RVM 网站上找到:https://rvm.io/integration/textmate/
I found it was simplest to use the
rvm-auto-ruby
approach.Locate the
rvm-auto-ruby
binary usingwhich
:The result is the path to the auto-loading binary:
Add this path to TextMate under: Preferences -> Advanced -> Shell Variables
It functions like an alias that points to your active version of Ruby.
Screenshot: http://cl.ly/23Yl
These instructions are available on the RVM website: https://rvm.io/integration/textmate/
为了让 TextMate 使用与命令行相同的 RVM Ruby 解释器,我执行了以下操作:
which ruby
- 对我来说,这是/Users/mgp/。 rvm/gems/ruby-1.9.2-p180/bin/ruby
/Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin
> 到我的PATH
shell 变量的前面。GEM_PATH
,其值为/Users/mgp/.rvm/gems/ruby-1.9.2-p180:/Users/mgp/.rvm/ gems/ruby-1.9.2-p180@global
To get TextMate to use the same RVM Ruby interpreter as the command line, I did the following:
which ruby
- for me, this was/Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin/ruby
/Users/mgp/.rvm/gems/ruby-1.9.2-p180/bin
to the front of myPATH
shell variable.GEM_PATH
with the value/Users/mgp/.rvm/gems/ruby-1.9.2-p180:/Users/mgp/.rvm/gems/ruby-1.9.2-p180@global
当您使用 RVM(ruby 版本管理器)而 textmate 不知道时,可能会发生这种情况。
rake 测试可以通过命令行进行吗?
This could be happening of you're using RVM (ruby version manager) and textmate doesn't know about it.
Does rake test work from the command line?