« Rails / Python show and tell | Main | Reshaping the working environment »

More Watir magic - RT -> Trac

While not an ideal way of doing things I thought I'd tinker with using Watir to drive Internet Explorer to scrape data from our Request Tracker instance then use Ruby code to generate SQL for import into our Trac PostgreSQL database, and low and behold it works a charm!

The only real problem is the RT attachments which I cannot (easily) grab using Watir. Instead my script generates another script full of wget commands, and that in turn determines the file sizes of downloaded files and generates SQL statements to tell Trac the file sizes (since RT doesn't tell me). It also generates mkdir and mv commands for placing the attachment files in the right Trac project directory locations.

So now I just need to improve the script a little to strip ENH from the start of ticket subjects and mark them as enhancements instead, to fix some unicode encoding problems and some duplicate key violations I'm seeing (in a v small number of cases). In all I migrated 336 tickets!

I'll upload the scripts somewhere when I get a chance so you can learn from them (or teach me how to do it properly ;-)).

Post a comment