views:

84

answers:

1

Since Windows doesn't support rvm (Ruby version Manager), how do we have

  • Ruby 1.8.7, Rails 2.3.8
  • Ruby 1.8.7, Rails 3.0.0
  • Ruby 1.9.2, Rails 3.0.0

on the same PC? Virtual machines can be used but it is kind of troublesome.

+4  A: 

I use Pik to manage multiple versions of ruby on a Windows machine.

Install the pik gem

> gem install pik
Successfully installed pik-0.2.6
1 gem installed

Install pik to a location that’s in your path, but someplace other than your ruby\bin dir.

>path
PATH=c:\pik;c:\ruby\Ruby187\bin;

>pik_install C:\pik
Thank you for using pik.

Installing to C:\pik
pik is installed

Install Rubt 1.9.2 using RubyInstaller and add the new Ruby version to pik registry.

>pik add C:\Ruby192\bin

List the available Ruby versions:

>pik list
187: ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] *
192: ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

To switch to Ruby 1.9.2:

>pik 192
>pik list
187: ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
192: ruby 1.9.2p0 (2010-08-18) [i386-mingw32] *

To switch between different versions of Rails:

In Rails 2.x, set the RAILS_GEM_VERSION in config/environment.rb file:

RAILS_GEM_VERSION = '= 2.3.8' unless defined? RAILS_GEM_VERSION

In rails 3, use the Gemfile to specify the Rails version:

gem "rails", "3.0.0"
KandadaBoggu