Using RVM with various gemset in TextMate

I installed RVM and made separate gems for my projects according to the best RVM methods . Now run the test file in TextMate dosen't, and I read here what to do. The problem is that this will not work, because the manual expects that I will have only one gemset (they call it "Rails3"). I usually have 2-3 projects open at the same time (using different gems), so I can not use this approach effectively.

Have any of you solved this problem?

+6
ruby textmate rvm
source share
2 answers

I found the RVM wrapper method very inconvenient, and since you found that it doesn’t work at all with gemset unless you do a lot of tedious installation.

I had some success using the following script as TM_RUBY :

 #!/bin/bash base_dir=${TM_PROJECT_DIRECTORY:-$PWD} cd $base_dir exec $MY_RUBY_HOME/bin/ruby $* 

While you are working in the TextMate project, and you have the .rvmrc file in the root of the project, it will run your code in the Ruby and gemset version specified in .rvmrc . cd ensures that RVM detects .rvmrc .

Put the code above in ~/bin/textmate_ruby_wrapper , and then go to Settings> Advanced> Shell Variables and set TM_RUBY to the same path.

+12
source share

I found this solution which is even simpler. In the TextMate settings - Advanced - Shell Variables:

Set GEM_HOME :

 env | grep GEM_HOME | awk '{ sub(/GEM_HOME=/, ""); print }' 

Set GEM_PATH :

 env | grep GEM_PATH | awk '{ sub(/GEM_PATH=/, ""); print }' 
0
source share

All Articles