RVM / Textmate doesnt recognize .rvmrc

589 views
Skip to first unread message

Jacques Crocker

unread,
Jul 7, 2010, 12:24:56 AM7/7/10
to rubyversi...@googlegroups.com
I think RVM has the potential to work much better with Textmate. At the moment, using the instructions here:
http://rvm.beginrescueend.com/integration/textmate/

It creates a static wrapper that textmate will use when it runs Ruby. However, different projects have different .rvmrc's. Also, textmate can run bash script stuff just fine. So why not just have a textmate wrapper that ships with RVM that does something like:

source ~/.rvm/scripts/rvm
exec ruby "$@"

Trying it on my box, this seems to use textmate with the default configured rvm gemset.

However, what would be awesome is if it looked through the current directory hierarchy and tried to find a .rvmrc file up the ladder. If so, it can just source it directly

source ~/.rvm/scripts/rvm

#TODO: fancy bash stuff to look for the .rvmrc
# if it finds it, source the .rvmrc file right here

exec ruby "$@"


I don't know how to do the fancy bash stuff, but when I hard coded it and sourced the .rvmrc file for the project, it ran great in textmate. So looks like the trick is just to find the file path of the .rvmrc and Textmate will now be rvmrc enabled!

Wayne E. Seguin

unread,
Jul 7, 2010, 8:10:27 AM7/7/10
to rubyversi...@googlegroups.com
On Wed, Jul 7, 2010 at 12:24 AM, Jacques Crocker <rail...@gmail.com> wrote:
> I think RVM has the potential to work much better with Textmate. At the moment, using the instructions here:
> http://rvm.beginrescueend.com/integration/textmate/
>
> It creates a static wrapper that textmate will use when it runs Ruby. However, different projects have different .rvmrc's. Also, textmate can run bash script stuff just fine. So why not just have a textmate wrapper that ships with RVM that does something like:
>
> source ~/.rvm/scripts/rvm
> exec ruby "$@"
>
> Trying it on my box, this seems to use textmate with the default configured rvm gemset.
>
> However, what would be awesome is if it looked through the current directory hierarchy and tried to find a .rvmrc file up the ladder. If so, it can just source it directly
>
> source ~/.rvm/scripts/rvm
>
> #TODO: fancy bash stuff to look for the .rvmrc
> # if it finds it, source the .rvmrc file right here

If you have RVM sourced already then no fancy bash stuff is required,
you only have to put this here:

cd .

Jacques Crocker

unread,
Jul 7, 2010, 2:10:00 PM7/7/10
to rvm (Ruby Version Manager)
Brilliant. I changed my textmate_ruby wrapper script to:

#!/usr/bin/env sh
source ~/.rvm/scripts/rvm
cd .
exec ruby "$@"


And so far everything is working great from within textmate (taking
into account .rvmrc and everything). I'll fork and update the RVM site
with better instructions (rvm wrapper seems like the wrong approach
here)


On Jul 7, 5:10 am, "Wayne E. Seguin" <wayneeseg...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages