UnderpantsGnome

1. Collect Underpants 2. ??? 3. Profit!

rvm + gemsets + TextMate == yay!

February 19, 2010 04:47

So I started playing with rvm a while back and loved the concept of being able to have a gems(et) for each project to completely eliminate gem clashing.

So I now have an .rvmrc in each project directory with the necessary gems installed, no more, no less.

I also have a global gem set that has common gems in it that I use all over the place and aren’t really project specific so I don’t have to install them in every gems(et). Thanks Wayne!

Now, to take it to the next level I wanted to be able to use ⌘^R to run the current Cucumber scenario. So I needed to get TextMate aware of my rvm gems(et). This requires setting 3 project specific variables in TextMate.

  1. TM_RUBY
  2. GEM_HOME
  3. GEM_PATH

To get TM_RUBY cd into your project with a .rvmrc in it or set the environment with rvm your_ruby%gemset then run

which ruby

To get GEM_HOME and GEM_PATH run

env | grep GEM

To set these in your project you need to have the project drawer open and nothing selected, then click the “I” button in the bottom corner, then you can add your variables.

I tried to think up a way to have TextMate read the .rvmrc in the project directory, but I wasn’t able to get anything to setup the environment. If anybody has any suggestions I’d love to hear them.

Comments

Gravatar
Wayne E. Seguin February 19, 2010 19:36

Great writeup!

I’d like to point out one additional item for users of rvm, you can type ‘rvm info’ in your shell to gain the information about your current environment all in one command.

Thanks!

~Wayne
Gravatar
zak May 07, 2010 20:54

i can’t get it to work…

i’ve tried all the solutions mentioned.

any suggestions?

Gravatar
kalle October 09, 2010 15:32

@zak

try:

http://rvm.beginrescueend.com/integration/textmate/

helped me.

Gravatar
Ian Haigh March 17, 2011 00:26

More than one year on, and this entry is still helping people out … thanks :)

Gravatar
Greg July 16, 2011 18:33

Hello, I think this issue might be updated on the rvm site.

http://beginrescueend.com/integration/textmate/

I just set up the rvm-auto-ruby approach, and now my run command looks at the project .rvmrc file and executes that version of ruby, if no .rvmrc it defaults to the rvm default. Beautiful.

Add a comment

Textile enabled (Reference)