One of my biggest complaints about Ruby on Rails relates to the environment needed to develop an application. Last Wednesday I took-off for a few days of holiday up in Vermont. Internet access is limited to my mobile phone while I’m in Vermont, so I have to take development as “offline” as possible while I’m up there. Doing this with my Rails applications is a mess.
If I was doing PHP development, things were pretty straightforward for me to setup my laptop as a mobile development environment. I could download XAMPP, or another all-in-one Windows-AMP stack, to a USB drive and copy all the source code I needed. I guess I would also need to export a copy of a MySQL database as well, but that’s a pretty quick step. After running the XAMP installer, I could drop all my source code into the folder and presto! things would be working good as new.
Ruby on Rails doesn’t afford me those kind of luxuries. My laptop runs Windows 7, so I can’t just `gem install rails` and call it a day. I’d never setup a local development environment on Windows (I always use a Linux server), so my plan was to download a few different packages and see what I could make work. Since I was in a rush to depart, I downloaded as much as I could under the premise that I would be able to install things later. Hopefully I would have enough pieces.
I found two common approaches out there to quickly setup a development environment on Windows. The first involved virtual machines, where you would run your own Linux server within Windows. I tried downloading 2 (or maybe 3) different server images, none of them would boot correctly in VirtualBox. My second plan was to install a XAMP-like environment but with Ruby on Rails instead of PHP. I was able to get this to install, but it seemed the stack I downloaded included some strange version of Ruby that wasn’t compatible with my application.
Nevertheless, I realized that regardless of what I did while “offline”, I wouldn’t have been able to get my applications up and running without internet access to install the different gems and plugins I require for my applications. I had probably downloaded enough pieces to patch together a framework/Rails-stack, but that wouldn’t include the externally referenced modules in my code. Gems and plugins (and by plugins I mean git submodules) are great, but you need to plan for them first when you’re going offline.
In a deployed, production-level application, gems and plugins might be frozen or bundled with your application, but that doesn’t fit well with the development of an application. It would be really handy if the “download” button on Github automagically included all the git submodules you would need for an application, and I’m optimistic bundler will help solve some of the gem-deployment issues Rails applications face.
Now that I’m back “online,” I’m going to stick with my trusty development servers. They might not be easy to carry around with me, but at least I don’t have to worry about keeping their configuration up to date or taking them offline.