RVM | Running user scripts

混江龙づ霸主 提交于 2019-12-01 21:54:18

问题


Is it possible while using the Ruby version manager to run scripts not from the console but using other ways — at system startup or by a keyboard shortcut for example?


回答1:


RVM installs a command rvm-shell. You can use rvm-shell, pass it whatever you would pass rvm use, then you can execute a shell command.

rvm-shell will set your environment for that shell script, or you can use rvm-shell on one line, and have it execute the parameter as a shell command.

For example:

rvm-shell rbx-2.0 -c 'which ruby'

Which should equal your rbx ruby.




回答2:


It'd help to know the system, but the answer is yes, though you'd need to either know which is the current directory, or set the system ruby to be the one you needed for these scripts (especially startup). You might also need to experiment, as it would depend at which point in the startup you needed the scripts to run, but you can probably get more answers on that from the irc rvm channel.




回答3:


rvm default do /path/to/ruby/script


来源:https://stackoverflow.com/questions/8048050/rvm-running-user-scripts

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!