前写天安装ROR环境的时候,重启系统开启一个shell使用命令
rails -v
显示rails尚未安装
但是安装aptana之后在aptana里面打开控制台就可以正常显示版本,应该是aptana自动加载了路径和函数吧
昨天看《RailsStutorial2》里面推荐了https://github.com/perfectionist/sample_project/wiki的开发简例
正好里面有较为详细的环境配置教程(比国内那些配置教程有用的信息要多的多)就发现了加载路径和函数的方法:
Setup PATH and define rvm function.
To use rvm just type
source ~/.rvm/scripts/rvm
into open shells, this creates the rvm function and adds various ~/.rvm/... directories to PATH.
You can also add this line to your ~/.bashrc file so it takes affect for all new shells.
I was going to use a slightly different approach so I defined an alias
use_rvm='source ~/.rvm/scripts/rvm'
and then invoked it when I needed to use rvm from the command line.
But I decided to install the following line in my .bash_profile
-s "$HOME/.rvm/scripts/rvm" && source "$HOME/.rvm/scripts/rvm"
You can add the line to your .bash_profile or .bashrc file depending how you set your environment up. This defines the rvmfunction and modifies your PATH only if the the ~/.rvm/scripts/rvm file exists. This is preferable to just adding the source statement.
推荐第一种方法,即使多开几个shells也都是可以的,不过现在使用的RubyMine IDE这些问题都不存在,但是,有问题了还是解决了比较安心,呵呵~~~~~~
补充:升级最新版的rvm好像能直接自动添加了~~~~~
rvm update
来源:oschina
链接:https://my.oschina.net/u/1045481/blog/195488