Home Download Buy Blog Forum Support

Building Ruby and using RVM

Re: Building Ruby and using RVM

Postby brickattack on Thu Nov 10, 2011 2:54 am

Just for reference, this is how I got TextMate to run my current directory's rvm http://beginrescueend.com/integration/textmate/

So rather than pointing Sublime at
Code: Select all
/Users/alex/.rvm/bin/rvm 1.9.2
or
Code: Select all
/Users/alex/.rvm/bin/ruby
you could do
Code: Select all
/Users/youruser/.rvm/bin/rvm-auto-ruby
and it would rvm's default ruby version (that you might need to change if you never have since it would probably be whatever shipped with your pc - for macs it'd be 1.8.7). Sublime would use the default version, I think, because it does not have a context of a directory so it wouldn't locate your project's .rvmrc file. If someone could figure that part out, it'd be great because you wouldn't have to worry about what gemsets or ruby versions you're using.

Here is the rvm-auto-ruby script
Code: Select all
#!/usr/bin/env bash

true ${rvm_scripts_path:="$rvm_path/scripts"}
true ${rvm_environments_path:="$rvm_path/environments"}

if [[ -n "$rvm_path" && -s "$rvm_scripts_path/rvm" ]]; then
  source "$rvm_scripts_path/rvm" > /dev/null 2>&1

elif [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
  source "$HOME/.rvm/scripts/rvm" > /dev/null 2>&1

elif [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
  source "/usr/local/rvm/scripts/rvm" > /dev/null 2>&1

else
  echo "Unable to detect rvm, please manually set the rvm_path env variable." >&2
  exit 1
fi

[[ -s "$rvm_environments_path/default" ]] && source "$rvm_environments_path/default"

rvm_promptless=1 rvm rvmrc load > /dev/null 2>&1

exec ruby "$@"
@brickattack ST2 OS X
brickattack
 
Posts: 14
Joined: Fri Apr 22, 2011 5:19 pm

Previous

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 6 guests