开发者

TextMate, rvm and TM_RUBY

开发者 https://www.devze.com 2023-01-27 21:35 出处:网络
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

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/.r开发者_StackOverflowvm/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?
  2. Is there a way to have TextMate use the RVM default?


Setting TM_RUBY to your-path/rvm-auto-ruby

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. I just got this working and it is very smooth. I did need to get the latest version of rvm

rvm get head

to make it work and restart Textmate. Hope that helps.


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:

  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:
    
    

    !/usr/bin/env sh

    source ~/.rvm/scripts/rvm cd . exec ruby "$@"
  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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消