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.
Since Windows doesn't support rvm (Ruby version Manager), how do we have
on the same PC? Virtual machines can be used but it is kind of troublesome.
Use uru. It is a multi-platform ruby environment manager. You can download the Windows version here: https://bitbucket.org/jonforums/uru/wiki/Downloads
Install the tool
Assuming
C:\tools
is on PATH anduru_rt.exe
was extracted toC:\tools
This adds
uru.bat
file to the tools directory.Register ruby
List available rubies
Switch ruby version
More commands can be found here: https://bitbucket.org/jonforums/uru/wiki/Examples
Old answer
I use Pik to manage multiple versions of ruby on a Windows machine.
Install the pik gem
Install pik to a location that’s in your path, but someplace other than your ruby\bin dir.
Install Rubt 1.9.2 using RubyInstaller and add the new Ruby version to
pik
registry.List the available Ruby versions:
To switch to Ruby 1.9.2:
To switch between different versions of Rails:
In Rails 2.x, set the RAILS_GEM_VERSION in
config/environment.rb
file:In rails 3, use the
Gemfile
to specify the Rails version:From what I could tell, uru only manages versions of RUBY.
For versions of RAILS, where you've already 2 or more versions on your local maching, to open a project in one's development environment, using an older version of rails, you enter the following in the command window:
rails _3.2.11_ s
where 3.2.11 represents the version of RAILS you want it to use, which you want to be the same version as listed in your project's file:
Gemfile.lock
I wrote myself a little batch file which creates a junction (aka symlinks) on the NTFS. The idea is to keep the PATH untouched. The path always contains
c:\devkit\bin;c:\ruby\bin;...
. The following Batch file changes the links to the actual directories.After installing and registering all your ruby installations with uru, you'll need to install DevKit for each of the ruby versions installed. For installation follow these instructions.
I generally store the DevKit next to the version of Ruby to which it belongs, for example,
C:\Ruby\Ruby193\DevKit
where Ruby193 is the folder containing the 193 version of Ruby that I registered withuru
.