Less PHP, more Ruby

12 May 2009

Way back when we started RubyForge (summer 2003) there was kind of a clunky project approval and provisioning process - I'd ssh in, run a script, click some buttons, run another script, and it would be done. Only took 5-6 minutes or so, and no biggie, I'll automate all that any day now.

A few years later I read a posting by Zed Shaw saying "if you're ssh'ing in to a machine more than once a week you're doing it wrong." Boy, that hit a nerve... he was right on the money. Approving projects was just painful enough that I only wanted to do it 2-3 times a week, not every day.

Now, only a few years after that, I finally got around to rewriting stuff so that all happens automatically. As part of that I replaced a bunch of straight SQL with named scopes, optimized some other stuff, and generally made everything a lot more readable. The optimizations were fun; for example, updating the gitosis config file went from 4m30s to 13s and thus the cronjob now runs every 10 minutes vs every 30 minutes. It was also nice to replace a lot of system calls with FileUtils.chmod and such.

There's still more work to be done - I'm still using the pure Ruby PostgreSQL driver, and I've got some clumsy templating stuff that would be nicer in ERB, and I'm doing some stuff in Ruby that could be better done in SQL. The code is here and no doubt there's a lot of room for improvement. Still, it's nice to be moving forward. And Zed was right!