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
I’m confused, what file are you editing to make these changes?
He is editing a command in the textmate bundle editor.
You will have to edit each command you want to have these changes in the Bundle Editor.
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.
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