试试rvm rvm
Ruby Version Manager (RVM)
http://rvm.beginrescueend.com
安装rvm
>下载并安装
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
>配置shell
$ emacs ~/.bashrc
#注释掉
#[ -z "$PS1" ] && return
if [ -n "$PS1" ] ; then
#在此放置原有内容
fi
#最尾部添加以下行
[ -s "$HOME/.rvm/scripts/rvm" ] && source "$HOME/.rvm/scripts/rvm"
>验证安装是否成功
$rvm -v
rvm 1.2.1 by Wayne E. Seguin ......
试试rvm
>安装jruby
$ rvm install jruby-1.5.6
jruby-1.5.6 - #fetching
jruby-1.5.6 - #downloading jruby-bin-1.5.6, this may take a while depending on
...
Successfully installed jruby-launcher-1.0.5-java
1 gem installed
Installing ri documentation for jruby-launcher-1.0.5-java...
Installing RDoc documentation for jruby-launcher-1.0.5-java...
>当前系统安装的ruby版本
$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
>当前shell切换到jruby
$ rvm use jruby-1.5.6
Using /home/itang/.rvm/gems/jruby-1.5.6
$ ruby -v
jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-03 9cf97c3) (Java HotSpot(TM) Client VM 1.6.0_22) [i386-java]
$ which ruby
/home/itang/.rvm/rubies/jruby-1.5.6/bin/ruby
>换回系统的
$ rvm system
$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
$ which ruby
/usr/local/bin/ruby
>将jruby 设为默认的ruby实现(每个shell都启用的)
$ rvm --default use jruby-1.5.6
Using /home/itang/.rvm/gems/jruby-1.5.6
>新开启一个shell窗口
$ which ruby
/home/itang/.rvm/rubies/jruby-1.5.6/bin/ruby
>jruby下安装rake
$ which gem
/home/itang/.rvm/rubies/jruby-1.5.6/bin/gem
$ gem install rake
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7...
Installing RDoc documentation for rake-0.8.7...
$ gem list
*** LOCAL GEMS ***
bouncy-castle-java (1.5.0145.2)
jruby-launcher (1.0.5)
jruby-openssl (0.7.2)
rake (0.8.7)
>将默认ruby实现重置, 即切回系统的
$ rvm reset
$ which ruby
/usr/local/bin/ruby
rvm升级
方式一: Upgrading to the latest gem
$ rvm update
$ rvm reload
方式二: Upgrading to the latest repository source
$ rvm get head
$ rvm reload
|