Sneaking Ruby Into The System

Posted Sat, 16 Sep 2006 13:49:41 GMT to Posted in Tags ,

Many of you may know of my love for the Ruby language. Used for most of my own projects and quick scripts, but have never been able to use it in any of my paid work. Until now.

It started a few weeks ago with a script I wanted to write. As I am the ‘translator guy’ at work, from time to time I need to convert the XML files that store the English text to something that a non-technical translator can easily read (I thought the XML was readable, but apparently I need to hand over Excel spreadsheets). As Ruby has nice XML library included, I just quickly whipped something up, and away I went. Never intending this to be anything more than a tool for myself and knowing my boss wouldn’t care as long as it got done without me having to spend a few hours, it seemed like the thing to do at the time.

Fast forward another two weeks. I overheard a few of my coworkers talking about how they can’t manipulate XML files in Auto-it, which they were using to cover some deficiencies in another build tool we were using called FinalBuilder. They started talking about either writing their own XML parser, or using yet another tool/language to do what they wanted.

A few of my coworks obviously didn’t like either idea. I mean, sure it was a solution, but it wasn’t an ideal solution. None of us liked the thought of debugging build/test/release scripts cobbled together from 3 different programs/languages. Some of us thought that if we were going to take the time to do something like write our own XML parser, we might as well spend the time to do something even smarter, like rewrite all our scripts in a single language. This would have several advantages, including things being uniform (1 language vs 3 helps there) and making it easy to track changes in svn (FinalBuilder has binary files, which caused problems when multiple people made enhancements).

So a number of suggestions were made, including batch files (ugh) and php. I obviously suggested Ruby, pointing out its portability (as opposed to Windows only solutions), readability, and the existence of desired functionality (eg. XML Parsing). The individual who was going to write the scripts had never used Ruby before, and so wanted to know more before making a decision. Coincidentally, I had a copy of Enterprise Integration With Ruby sitting on my desk,and was able to toss it over so he could take a look at the syntax (bonus points for its section on XML parsing). I also pointed out the ruby-doc site and pointed out rake.

Now, we have all of our build scripts written in rake format, and I reworked my translation scripts slightly to be rake tasks as well. At the moment we are working out some kinks in another series of scripts a coworker has written for creating packages for our clients, and we won’t have to waste time making small tweaks to packages manually.

Comments

  1. InCiter said 16 days later:

    Search the AutoItScript.com/forum for “_XMLDomWrapper.au3”. I do XML all the time with it.

    Lar.

Trackbacks

Use the following link to trackback from your own site:
http://www.crazyorgenius.com/articles/trackback/176

(leave url/email »)

   Comment Markup Help Preview comment