UnderpantsGnome

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

rvm + gemsets + TextMate == yay! * 2

February 19, 2010 23:13

Ok so in my last post I mentioned I wasn’t able to find a way to automatically use an existing .rvmrc file. I spent some time with it again this afternoon and was able to get it to work. So now if you are using TextMate and you want to run a ruby script that uses your rvm environment all you have to do is edit the commands you use and replace the #! and add a couple lines. The odd thing is this is pretty much exactly what I was trying before, though on a different machine.

#!/usr/bin/env bash

[[ -f "$HOME/.rvm/scripts/rvm" ]] && . $HOME/.rvm/scripts/rvm
[[ -f "$TM_PROJECT_DIRECTORY/.rvmrc" ]] && . $TM_PROJECT_DIRECTORY/.rvmrc

And that’s it, you get your rvm config in TextMate.

Comments

Gravatar
Rick DeNatale April 30, 2010 01:40

I’m confused, what file are you editing to make these changes?

Gravatar
Jake May 18, 2010 05:41

He is editing a command in the textmate bundle editor.

Gravatar
jake May 18, 2010 17:10

You will have to edit each command you want to have these changes in the Bundle Editor.

Gravatar
Gerhard June 02, 2010 11:27

This kinda’ works, but I’m getting a weird error related to paths even though the path that it’s complaining about is correct and the file exists, is readable etc.

Also, formatting is all screwy when it uses rvm & gemsets.

Gravatar
Ed Ruder July 30, 2010 23:06

What got everything working for me was to: a) follow the directions on http://rvm.beginrescueend.com/integration/textmate/, b) rename a second Builder.rb file in ~/Library/Application\ Support/TextMate/Pristine\ Copy/Support/lib, and c) set up TM_RUBY per slides 36 & 37 of http://www.slideshare.net/freelancing_god/zsh-and-rvm (create a shell script that resolves to rvm’s ruby on the fly and point TextMate to it)!

Now, everything is working like a charm! (No mucking with TextMate’s Bundle Editor, either, which is nice.)

Add a comment

Textile enabled (Reference)