Friday, January 06, 2006

I prefer Rake to NAnt (#1)

While working with Rake and NAnt I've found several reasons I prefer Rake. And, I've received several requests for a pro/con list concerning Rake. So, I'm going to start keeping a list. Here's reason #1.
I prefer escape characters (\") and Q delimiters (%Q) to entity codes (").
For example, executing an external program where the 1st parameter needs to be in quotes but not the second.
Rake (option 1): exec "foo.exe \"some text\" bar"
Rake (option 2)*: exec %Q[foo.exe "some text" bar]
NAnt: <exec program="foo.exe" commandline="&quot;some text&quot; bar"/>
*option 2 provided by Martin

3 comments:

  1. Anonymous1:02 PM

    I'm sure you'll get there yourself, but I have to say, the #1 reason I prefer Rake over just about any other build tool is that Rake is Ruby. 98% of the time that just means the syntax is easy and you can do scripty things (conditionals, loops, checking values in hashes, etc.), but in the other 2% of the time it really shines: you can 'require' a Ruby library and call a method to get things done (hence no duplicating existing functionality), and you can even change the functionality of Rake itself, simply, on the fly.

    Why on earth would you want to do that? Well, to do things like redefining an existing task that's specified in a framework somewhere without jumping through inane hoops set up by the build tool. Here's a real-world example of where we fixed a problem in a tool in a clean and compartmentalized way (i.e., it's visible to us when we look, and it's easy to undo once it's not needed) without changing our application or the vendor's code at all:

    http://dev.rubyonrails.org/ticket/2018

    Best,
    Rick

    ReplyDelete
  2. Anonymous1:21 PM

    I completely agree. I've added this as #2. I wasn't (and still am not going to) list the reasons in any particular order. I was going to wait till the next time I found something in a Ruby library that helped me out, but your comment prompted me to put it in sooner rather than later. Thanks for the feedback.

    ReplyDelete
  3. Anonymous10:42 PM

    Also...

    Rake (option 3): exec %{foo.exe "some text"}

    ReplyDelete

Note: Only a member of this blog may post a comment.