RVM:如何为init脚本获取已安装gems的路径

时间:2013-01-25 16:59:23

标签: rvm

使用rvm,我安装了一些带有可执行脚本的gem,例如god

$ gem install god
$ which god 
/usr/local/rvm/gems/ruby-1.9.3-p362/bin/god

我想从/etc/init.d脚本中调用上帝,但不想硬编码路径。有没有办法查询rvm以获取“默认”ruby gems目录的路径?

1 个答案:

答案 0 :(得分:1)

解决方案是generate a wrapper script

$ rvm wrapper 1.9.3-p362 bootup god
$ ls -l /usr/local/rvm/bin/bootup_god 
lrwxrwxrwx 1 root rvm 43 Jan 25 13:38 /usr/local/rvm/bin/bootup_god -> /usr/local/rvm/wrappers/ruby-1.9.3-p362/god*