简体   繁体   English

TextMate,rvm和TM_RUBY

[英]TextMate, rvm and TM_RUBY

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 . TextMate RVM指令中 ,它说明将TM_RUBY设置为/Users/wayne/.rvm/bin/textmate_ruby并在图像中显示它设置为rvm-auto-ruby I decided to set it to rvm-auto-ruby thinking that it would use RVM's default Ruby version. 我决定把它设置为rvm-auto-ruby ,认为它会使用RVM的默认Ruby版本。

When running Command R in the RSpec.bundle having TM_RUBY set to rvm-auto-ruby will result in a load error . 当运行Command R在具有RSpec.bundle TM_RUBY设置为rvm-auto-ruby将导致负载误差 When you set it to textmate_ruby it works. 当你将它设置为textmate_ruby它可以工作。

The only problem here is that TextMate doesn't always use the default version of Ruby since it's hardcoded in that file. 这里唯一的问题是TextMate并不总是使用默认版本的Ruby,因为它在该文件中是硬编码的。

/Users/jspooner/.rvm/bin/textmate_ruby : /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: 所以有两个问题:

  1. What should TM_RUBY=rvm-auto-ruby actually do? TM_RUBY=rvm-auto-ruby究竟应该做什么?
  2. Is there a way to have TextMate use the RVM default? 有没有办法让TextMate使用RVM默认值?

Setting TM_RUBY to your-path/rvm-auto-ruby 将TM_RUBY设置为your-path/rvm-auto-ruby

http://rvm.io/integration/textmate/ http://rvm.io/integration/textmate/

should load whatever ruby and gemset is indicated in the .rvmrc file located in the project and if none default to rvm default. 应该加载任何ruby和gemset在项目中的.rvmrc文件中指示,如果没有默认为rvm默认值。 I just got this working and it is very smooth. 我刚刚开始工作,非常顺利。 I did need to get the latest version of rvm 我确实需要获得最新版本的rvm

rvm get head

to make it work and restart Textmate. 使其工作并重新启动Textmate。 Hope that helps. 希望有所帮助。

See your other, similar, question Rspec bundle is broken in TextMate and rvm . 在TextMate和rvm中查看您的其他类似问题Rspec包已损坏


To help others chasing this same issue, the solution seems to be at: RVM / Textmate doesnt recognize .rvmrc Options . 为了帮助其他人追逐同样的问题,解决方案似乎是: RVM / Textmate不识别.rvmrc选项

Basically you replace the ~/.rvm/bin/textmate_ruby soft link with a file. 基本上你用文件替换~/.rvm/bin/textmate_ruby软链接。 This is what I did: 这就是我做的:

  1. cd ~/.rvm/bin
  2. mv textmate_ruby old.textmate_ruby
  3. Create a shell script called textmate_ruby in the same directory to replace the soft-link, using the following contents: 使用以下内容在同一目录中创建名为textmate_ruby的shell脚本以替换软链接:
    \n\n

    !/usr/bin/env sh !/ usr / bin / env sh

    \n\nsource ~/.rvm/scripts/rvm source~ / .rvm / scripts / rvm \ncd . cd。 \nexec ruby "$@" exec ruby​​“$ @” \n
  4. 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: 在进行此更改之前,如果我使用CMD + R在TextMate中运行以下脚本,我会看到我的系统Ruby的版本(1.8.7):

puts RUBY_VERSION

Evaluating the script using CMD + CNTRL + SHIFT + E gave me 1.9.2. 使用CMD + CNTRL + SHIFT + E评估脚本给了我1.9.2。

After switching to use that script both point to Ruby 1.9.2, so at least there's some consistency now. 切换到使用该脚本后都指向Ruby 1.9.2,所以至少现在有一些一致性。 I don't see TextMate tracking my currently set RVM Ruby version yet; 我没有看到TextMate跟踪我当前设置的RVM Ruby版本; Instead it's using the default version set in RVM: rvm use 1.9.2 --default . 相反,它使用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 . 这仍然向前迈进了一步,因为我可以通过调整我的--default来控制Ruby TextMate使用的--default

If you decide you want to revert later, just rename, or delete, the script and reverse step 2 above. 如果您决定稍后要还原,只需重命名或删除脚本并反转上面的步骤2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM