Skip to content

Instantly share code, notes, and snippets.

@luislavena
Created August 3, 2012 20:49
Show Gist options
  • Save luislavena/3251384 to your computer and use it in GitHub Desktop.
Save luislavena/3251384 to your computer and use it in GitHub Desktop.
Testing Ruby 2.0 on Windows

Prepare for Ruby 2.0, today

Ruby 2.0 is around the corner, estimated to be launch February 2013, for its 20th anniversary!

Wouldn't be great to be able to test Ruby 2.0 features and report possible bugs?

Things like Refinements, built-in ANSI coloring for Windows or even better, faster startup

Users of other OS like Linux and OSX already can install upcoming versions of RUby thanks to RVM and rbenv tools, but what about Windows?

Good news, continuous builds

That's right, thanks to EngineYard for providing a Jenkins CI environment and some contributors for setting up dedicated workers, RubyInstaller project now continuously build and tests Ruby 1.9.3 and trunk (known as 2.0).

You can see the dashboard here.

But not we only run tests and check nothing breaks on Windows, we also package build artifacts from successful builds, one for Ruby 1.9.3 and Ruby 2.0.

How to use them?

Before we start, first you will need to ensure you have 7-zip installed to extract the .7z packages.

Download

Now, you can download the latest successful artifact for Ruby 2.0 from here.

Extract

Now that we have the .7z package, is time to extract it into a directory / drive and not forgetting to avoid spaces in the directories.

E.g.: C:\Rubies

Usage

After you extracted it, you will encounter a new directory like ruby-2.0.0-r36616-i386-mingw32 inside of it.

Now is time to start a Command Prompt (cmd.exe) and ensure this new version of Ruby is in the PATH:

SET PATH=C:\Rubies\ruby-2.0.0-r36616-i386-mingw32\bin;%PATH%

And now, the big magic:

C:\>ruby -v
ruby 2.0.0dev (2012-08-04 trunk 36616) [i386-mingw32]

It works!

Caveats

Rocky road ahead

Since Ruby 2.0 has not been released, some gems might present issues and others might not work at all. Be prepared to get your hands dirty as testing new and bleeding edge stuff is not for the faint of heart.

Compiled gems

Avoid pre-compiled gems, since most of those do not contains binaries compatible with Ruby 2.0 and will require compilation.

Obtain RubyInstaller's Development Kit (DevKit) and follow the installation instructions.

Once you have the DevKit installed, force gem compilation by adding --platform=ruby to the gem installation command. E.g.:

gem install rdiscount --platform=ruby

Some gems might depend on other libraries, so you might need to obtain those prior installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment