Sunday, January 21, 2007

playing with ruby

It's been a while since I played with ruby.

I have a Subversion repository that contains stupid stuff like my .emacs file, and then I have some personal wiki's and blogs that use files or mysql dbs under the covers.

I haven't been very diligent about setting up a backup process for all that crap, so I've been playing a bit with some scripts to automate all of that stuff using Ruby. My ruby skills are quite rudimentary and based entirely on some playing around I did with rails two years ago. But it's been exciting (and tedious) learning about stuff.

First off, the AWS S3 ruby libraries look cool, but don't work unless you have a ruby version > 1.8.4. I had 1.8.3 and it took me forever to find the root cause of an obscure error.

I also never knew about ri - the perldoc for ruby. Check out RI for emacs which lets you run ri from within emacs.

Also loading inf-ruby.el allows you to do M-x run-ruby and get an interactive ruby shell within emacs. This is great for a ruby beginner like me, because I can experiment with stuff from within emacs while I'm coding.

The S3 Rake file is a great starting point for backing up mysql databases and svn repositories, but is specific to a rails setup. I'm not working on a rails app; just trying to backup wiki databases and an arbitrary svn repository; so I'm rewriting it as a class that should be callable either as a command (from cron, which is what I want), or from rake. If I get it looking decent, I'll put it up somewhere.

No comments: