TextMate、rvm 和 TM_RUBY [英] TextMate, rvm and TM_RUBY
问题描述
在 TextMate RVM 说明中,它说要设置 TM_RUBY
到 /Users/wayne/.rvm/bin/textmate_ruby
和 图像 它显示它设置为 rvm-auto-ruby
.我决定将它设置为 rvm-auto-ruby
认为它会使用 RVM 的默认 Ruby 版本.
在将 TM_RUBY
设置为 rvm-auto-ruby
的 RSpec.bundle 中运行 Command R
时,将导致 加载错误.当您将其设置为 textmate_ruby
时,它会起作用.
这里唯一的问题是 TextMate 并不总是使用默认版本的 Ruby,因为它是硬编码在该文件中的.
/Users/jspooner/.rvm/bin/textmate_ruby
:
#!/usr/bin/env bashif [[ -s "/Users/jspooner/.rvm/environments/ruby-1.9.2-head" ]] ;然后源/Users/jspooner/.rvm/environments/ruby-1.9.2-head"执行红宝石$@"别的回声错误:缺少 RVM 环境文件:'/Users/jspooner/.rvm/environments/ruby-1.9.2-head'">&2出口 1菲
所以两个问题:
TM_RUBY=rvm-auto-ruby
实际上应该做什么?- 有没有办法让 TextMate 使用 RVM 默认值?
查看您的其他类似问题 TextMate 和 rvm 中的 Rspec 包被破坏.
<小时>为了帮助其他人解决同样的问题,解决方案似乎在:RVM/Textmate 无法识别 .rvmrc 选项.
基本上你用一个文件替换 ~/.rvm/bin/textmate_ruby
软链接.这就是我所做的:
cd ~/.rvm/bin
mv textmate_ruby old.textmate_ruby
- 在同一目录下创建一个名为
textmate_ruby
的shell脚本来替换软链接,内容如下:!/usr/bin/env sh
源 ~/.rvm/scripts/rvm光盘.执行红宝石$@" chmod +x textmate_ruby
在进行此更改之前,如果我执行 CMD+R 在 TextMate 中运行以下脚本,我会看到我的系统 Ruby 版本 (1.8.7) 显示:
放置 RUBY_VERSION
使用 CMD+CNTRL+SHIFT+E 评估脚本给了我 1.9.2.>
切换到使用该脚本后,两者都指向 Ruby 1.9.2,所以至少现在有一些一致性.我还没有看到 TextMate 跟踪我当前设置的 RVM Ruby 版本;相反,它使用 RVM 中设置的默认版本:rvm use 1.9.2 --default
.这仍然向前迈进了一步,因为我可以通过调整我的 --default
来控制使用哪个 Ruby TextMate.
如果您决定稍后还原,只需重命名或删除脚本并反向执行上述步骤 2.
In the TextMate RVM instructions the text it says to set TM_RUBY
to /Users/wayne/.rvm/bin/textmate_ruby
and in the image it shows it set to rvm-auto-ruby
. I decided to set it to rvm-auto-ruby
thinking that it would use RVM's default Ruby version.
When running Command R
in the RSpec.bundle having TM_RUBY
set to rvm-auto-ruby
will result in a load error. When you set it to textmate_ruby
it works.
The only problem here is that TextMate doesn't always use the default version of Ruby since it's hardcoded in that file.
/Users/jspooner/.rvm/bin/textmate_ruby
:
#!/usr/bin/env bash
if [[ -s "/Users/jspooner/.rvm/environments/ruby-1.9.2-head" ]] ; then
source "/Users/jspooner/.rvm/environments/ruby-1.9.2-head"
exec ruby "$@"
else
echo "ERROR: Missing RVM environment file: '/Users/jspooner/.rvm/environments/ruby-1.9.2-head'" >&2
exit 1
fi
So two questions:
- What should
TM_RUBY=rvm-auto-ruby
actually do? - Is there a way to have TextMate use the RVM default?
See your other, similar, question Rspec bundle is broken in TextMate and rvm.
To help others chasing this same issue, the solution seems to be at: RVM / Textmate doesnt recognize .rvmrc Options.
Basically you replace the ~/.rvm/bin/textmate_ruby
soft link with a file. This is what I did:
cd ~/.rvm/bin
mv textmate_ruby old.textmate_ruby
- Create a shell script called
textmate_ruby
in the same directory to replace the soft-link, using the following contents:!/usr/bin/env sh
source ~/.rvm/scripts/rvm cd . exec ruby "$@" chmod +x textmate_ruby
Before doing this change I'd see my system Ruby's version (1.8.7) displayed if I did CMD+R to run the following script in TextMate:
puts RUBY_VERSION
Evaluating the script using CMD+CNTRL+SHIFT+E gave me 1.9.2.
After switching to use that script both point to Ruby 1.9.2, so at least there's some consistency now. I don't see TextMate tracking my currently set RVM Ruby version yet; Instead it's using the default version set in RVM: rvm use 1.9.2 --default
. This is still a step forward because I can control which Ruby TextMate uses by adjusting my --default
.
If you decide you want to revert later, just rename, or delete, the script and reverse step 2 above.
这篇关于TextMate、rvm 和 TM_RUBY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!