简体   繁体   English

如何将Ruby升级到2.0

[英]How to upgrade Ruby to 2.0

My ruby version is 我的红宝石版本是

ruby 1.9.3p374 (2013-01-15) [i386-mingw32]

and I am running under Windows 8 with mingw installed. 我在安装了mingw的Windows 8下运行。

How can I upgrade it to ruby 2.0 ? 如何将其升级到ruby 2.0?

Pik let you play with and manage multiple versions and flavours of ruby on on your Windows box. Pik让您在Windows机器上玩和管理多个版本和风味的红宝石。 I have chosen this way because I'm not sure that everything I need will work on the first try with the new version, hence I want also to keep prior versions. 我之所以选择这种方式,是因为我不确定我需要的所有东西都能在新版本的第一次尝试中使用,因此我也希望保留以前的版本。

The installation is also simple: if you haven't jet Pik see topic: "Install pik using rubygems" then "pik install ruby 2.0.0" 安装也很简单:如果你还没有喷射Pik, 请参阅主题:“使用rubygems安装pik”然后“pik install ruby​​ 2.0.0”

for example: 例如:

Before 之前

C:\Sites>pik list
  160: jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (Java H...
  165: jruby 1.6.5.1 (ruby-1.9.2-p312) (2012-01-25 fffffff) (Java HotSpot(T...
  167: jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM)...
  187: ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
  192: ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
* 193: ruby 1.9.3p125 (2012-02-16) [i386-mingw32]

Install 安装

C:\Sites>pik install ruby 2.0.0
** Downloading:  http://rubyforge.org/frs/download.php/76807/ruby-2.0.0-p0-i386-
mingw32.7z
...

After installation 安装后

C:\Sites>pik list
  160: jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 f3b6154) (Java H...
  165: jruby 1.6.5.1 (ruby-1.9.2-p312) (2012-01-25 fffffff) (Java HotSpot(T...
  167: jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM)...
  187: ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
  192: ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
* 193: ruby 1.9.3p125 (2012-02-16) [i386-mingw32]
  200: ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

Now we can use version 2.0.0 现在我们可以使用2.0.0版

C:\Sites>pik use 200

C:\Sites>ruby --version
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

Wondering where the hell are the Ruby folders 想知道Ruby文件夹到底在哪里

 C:\>echo %HOME%
 C:\Users\rondinif

 C:\>where ruby 
 C:\Users\rondinif\.pik\rubies\Ruby-200-p0\bin\ruby.exe

 C:\>pik use 193
 C:\>where ruby 
 C:\RailsInstaller\Ruby1.9.3\bin\ruby.exe

 C:\>pik use 167
 C:\>where ruby 
     INFO: Could not find files for the given pattern(s).
 C:\>where jruby
 C:\Users\rondinif\.pik\rubies\JRuby-167\bin\jruby

and so on... 等等...

Just install ruby version 2.0 from the official rubyinstaller site. 只需从官方rubyinstaller站点安装ruby 2.0版。

There's nothing like 'upgrade'. 没有什么比'升级'更好的了。 You can actually run both versions on ur PC at the same time (many people prefer that too). 你可以在你的PC上同时运行这两个版本(许多人也喜欢这样)。 Also refer to this question: How to have multiple versions of Ruby AND Rails, and their combinations on Windows? 另请参阅此问题: 如何在Windows上拥有多个版本的Ruby AND Rails及其组合?

Well you could just try building it from source, just like how you installed 1.9.3. 那么你可以尝试从源代码构建它,就像你安装1.9.3一样。 Personally I would recommend using something like RubyInstaller or better still doing Ruby development inside a Linux VM. 就个人而言,我建议使用像RubyInstaller这样的东西,或者更好地在Linux VM中进行Ruby开发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM