Using RVM with different gemsets in TextMate

时间秒杀一切 提交于 2019-12-04 07:09:46

I've found the RVM wrappers method to be very buggy, and as you've discovered it doesn't work at all with gemsets unless you do a lot of tedious setup.

I've 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 $*

As long as you're in a TextMate project and you have a .rvmrc file in the project root it will run your code in the Ruby version and gemset specified in the .rvmrc. The cd makes sure RVM discovers the .rvmrc.

Put the code above into ~/bin/textmate_ruby_wrapper and then go to Preferences > Advanced > Shell Variables and set TM_RUBY to that same path.

I've found this solution which is even simpler. Under the TextMate Preferences - Advanced - Shell Variables:

Set your GEM_HOME:

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

Set your GEM_PATH:

env | grep GEM_PATH | awk '{ sub(/GEM_PATH=/, ""); print }'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!