How to Have Multiple Versions of Ruby and Rails, and Their Combinations on Windows

How to upgrade Ruby to 2.0

Pik let you play with and manage multiple versions and flavours of ruby on on your Windows box. 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"

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

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

 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...

How to add new Ruby environment in URU?

You can use rubyinstaller to install specific version of ruby. After install was completed, you will have some version of ruby. You know the destination of them.

To add already installed but not registered version of ruby:

uru admin add SOME_PATH/../bin

Good article about rubyinstaller and uru.

Rubyinstaller downloads.

Uru examples.

Similar question on SO.

Use windows or linux to start work with Ruby On Rails?

If your current dev machine is running Windows, and you don't have access to a Linux environment right now, don't let that stop you from getting started with Rails. Definitely, definitely, definitely install the DevKit first thing (if it's not included in RubyInstaller yet). See https://github.com/oneclick/rubyinstaller/wiki/Development-Kit for that.

If you get deep into Rails development, or even start doing it for a living, you will inevitably drift towards using Linux on your dev machine. The problem is not Rails, but the many binary gems which are difficult or impossible to install on Windows.

The most popular Ruby library for manipulating images (ie. generating thumbnails) is RMagick, but trying to install it on Windows is enough to make a strong man cry. Paperclip is very nice for dealing with images and other attachments, but it is also a problem. Then there is a popular JSON parsing library which is also problematic on Windows. Unicorn (a popular Rails server) won't run at all on Windows, and Thin (my favorite) may also give you headaches. And so on, and so on.

You can get pretty far with Rails development on Windows these days, but at times you will find yourself having to test code on a remote server, rather than locally, and it can waste a lot of time.



Related Topics



Leave a reply



Submit