Saturday, August 28, 2010

My Windows (with git) RVM

I was disappointed to learn that RVM (Ruby Version Manager) doesn't work on Windows, however I wasn't surprised. Windows and Ruby don't always play well with each other.

I'm also a fan of Homebrew on my Mac. Homebrew is a command line package manager that downloads applications and creates symlinks so they are always on your path.

I hate working with Windows environment variable since they don't always reload without logging off and back in again.

For all of these reasons I started thinking about how I could configure my laptop to use multiple versions of Ruby without hacking my PATH environment variable.

My solution was to create a C:\Ruby directory and initialized a git repository within that directory.

I downloaded the 1.9.1 7-Zip package from rubyinstaller.org and extracted it into C:\Ruby. Then I added/committed all the files to a branch named 'v191'.

Finally I updated my PATH to include the C:\Ruby\bin directory.

To install a different version of Ruby I created a new branch named "v192", delete all the files and committed the deletion of the files. Here are the commands:


git checkout -b v192


rm -rf *


git add . -u && git commit -m "Cleared directory for next version"

After I have a clean C:\Ruby directory, I extract the new version to C:\Ruby and add/commit them to the git repository.

After installing I can do a git checkout {branchname} to switch my version of Ruby.

1 comment:

  1. Have you seen pik yet?

    http://github.com/vertiginous/pik

    ~Wayne

    ReplyDelete