Engine Yard Blog RSS Feed

Did you know that JRuby on Windows had no dependencies? You don't even need Java installed. You don't need another Ruby installed. You can run our installer and be creating Rails applications or Ruby GUI applications immediately.

Installer splash screen

Well Duh!

Micah Martin created a Windows installer for JRuby that made JRuby much easier to install. A new user can double click on the installer, get their PATH configured, install a JVM if they need one, and have a fully functioning Ruby environment in a matter of seconds. We played with it a bit and decided it was cool beans. The rest is history. What we didn't count on was how popular Windows was as a platform. To non-Rubyists this may sound patently stupid, but as Rubyists, we mostly ignore Windows. Much to our surprise, we discovered that the number of Windows installer downloads started to match the number of downloads for our generic tar and zip downloads of JRuby. Cowabunga...people use Windows!?!!?

Seeing so many Windows installer downloads was a "well duh!" moment for us. Ever since that day, we realized that as Rubyists we need to embrace Windows and make sure the Ruby Windows experience is pleasant. I am going to talk about what JRuby is doing to make Windows developers happy, but I wanted to first try and make a rally cry to Rubyists everywhere...Please help make Windows a reasonable development platform choice.

Small Plea to Rubyists

If you have ever been to a Ruby conference and stood at the front of the room you will make one fairly common observation:

Pictures of Macs at conference

Macs Everywhere

In the public Ruby world, a Mac laptop seems like a prerequisite to membership (full-disclosure: I have been using Mac notebooks for 4-5 years). Much to Apple's credit they make very nice laptops. I think the bigger picture is seeing a laptop with 13% of the market share making up 95+% of a Ruby conference indicates a significant problem. If you are a Mac-using fork()-wielding Rubyist why should you care about Windows users?

The most obvious answer to why you should care is market share. There are a tremendous number of businesses which do their day-to-day work on a Windows OS. If these Windows-using companies adopt Ruby then there are more job opportunities for all of us.

A less dog-eat-dog motive is wanting to share something you love. I love using Ruby and I think any programmer, regardless of OS, should have the opportunity to use Ruby.

"Ruby cares" (faint PSA music in the background)

Okay, stepping off the soap box a little...

If you want to help, what can you do? Of course you can start using Windows, but odds are, you bought a Mac to avoid using Windows. ;)

Still, you can do several things:

  • Be helpful to anyone who submits a Windows patch to your library/application. Ultimately, little bugs here and there will make or break Ruby adoption on Windows.
  • Look for unix-y Ruby commands like fork() and consider alternatives like spoon. We can blame some of the unix-parentage of Ruby for this, but a little effort to make your code portable will make a big difference.
  • Of course, some libraries may never run on Windows. In that case, please mention that on your project's homepage. Perhaps even put a hook in your code to throw an error when being loaded from Windows.

    require 'rbconfig'
    if RbConfig::CONFIG['host_os'] == "mswin32"
        raise LoadError.new "This library does not work on Windows"
  • Make sure you are using libraries like Pathname which should help isolate you from writing Windows-unfriendly things like:

    def absolute?(filename)
        filename =~ /^\//

You can instead rely on Pathname to do the right thing for you:

    require 'pathname'
    Pathname.new("c:/").absolute?  # => true

If you find yourself making assumptions about files or filesystems, odds are your code will not work on Windows.

  • Test your library on a continuous integration (CI) server running on Windows (a little more on this below).

What we are doing

We are on a never-ending quest to improve our Windows support for JRuby. Lately, we have been spending some portion of our development week dog-fooding on Windows. This has been a boon for finding issues, and we will continue this practice for the foreseeable future.

Beyond dog-fooding, we have recently set up a CI instance running Windows (a long-desired item for us). We finally have quick feedback when we break something on Windows.

Windows CI progress

If you are interested in making your gem work on Windows, you can contact us and we will let you run your library on our CI box for a while to get it in shape for Windows. (We would extend the offer forever, but we only have so much processing power.) This can be a valuable experience in understanding some of the issues in making your code more portable. Take us up on the offer.

We also wrote a native version of the windows-specific extension win32ole with funding from Audentes Technologies (thanks guys). For those unfamiliar with win32ole, it is a library which allows you to connect to Windows applications and services and call them progmatically. For example, in a few lines of Ruby you can connect up to MS Word, load a document, and then save it as an HTML document. JRuby 1.6 will bundle win32ole in our windows installer. It is also released as a gem so you can update to the latest and greatest when fixes come out.

As some level of proof we have been working hard on Windows support, a majority of 1.5.x issues resolved have been Windows-related. We are going to keep polishing things until we get it right.

What will we do next?

We wanted to share some of our future Windows plans in the hopes people will have feedback and suggestions. Our next big project on Windows will be to make an 'all-in-one' installer. This installer will contain all the necessary stuff needed for a new Windows developer to go from zero to Rails. We plan on including the following in the new installer:

  • JRuby
  • JVM
  • Redcar editor (sweet Textmate clone)
  • Gems: Rails, Rake, RSpec, Rubygems, AR-JDBC
  • Simple Rails tutorials
  • Links to common Rails/Ruby websites

Our hope is that this will help give a new Windows developer a positive experience. Hitting lots of little roadblocks is no way to get introduced to a new technology.

Let's become a big tent

If you are a Windows person reading this, hopefully you can see that we are trying to make sure you have a top-notch Ruby runtime at your disposal. You can help form our future by giving us feedback on your experience. We really appreciate you giving us a try.

If you are not a Windows person, then hopefully you are on-board with the idea that Ruby should run well on Windows. I believe it is one of our largest potential growth factors, and we have definitely not given an appropriate amount of support on Windows. (Note: There are some heroic souls like Luis Lavena on the Ruby C impl side who are trying -- my hat goes off to them in fighting the good fight).

Let's make 2011 the year we start seeing more Windows laptops at conferences!


comments powered by Disqus