rvm + gemsets + TextMate == yay! * 2
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.
Rick DeNatale on rvm + gemsets + TextMate == yay! * 2 on Apr 29, 2010 at 06:40 PM
I’m confused, what file are you editing to make these changes?
Jake on rvm + gemsets + TextMate == yay! * 2 on May 17, 2010 at 10:41 PM
He is editing a command in the textmate bundle editor.
jake on rvm + gemsets + TextMate == yay! * 2 on May 18, 2010 at 10:10 AM
You will have to edit each command you want to have these changes in the Bundle Editor.
Gerhard on rvm + gemsets + TextMate == yay! * 2 on Jun 02, 2010 at 04:27 AM
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.
Ed Ruder on rvm + gemsets + TextMate == yay! * 2 on Jul 30, 2010 at 04:06 PM
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.)