Dave Laribee

Sponsors

The Lounge

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
OMG Rake!

Rake is just... lovely. There's no other way to describe it. I just moved our XEVA Framework to rake and ended up with this build script weighing in at only 35 lines:

Check out the :harvest task where I'm requiring an external file that's contains code for bundling up the various build outputs, currently just .dll and .pdb files. The file looks like this:

I'm in love with Rake -- and the idea of executable configuration in general -- for a few reasons:

1) I can take my scripts down to a reasonable size. The NAnt script for this simple build weighed in at a hefty 162 lines. These two files combined hover around 65. That's much better signal to noise and it only gets better with the more complex scripts.

2) I can make new tasks lickity split. With ruby you just write some code inside a task. It's easy to leverage popular libraries like Hpricot for XML poking and peeking and such. No need to compile tasks and manage separate projects just for build code.

3) I can see what's happening! Ruby is a very flexible language. I can use it's tricks to pimp out my build scripts and I don't need to sift through angle bracket madness. Note how I opened up the Dir class to define a new method, exists?. Ah the joys of ruby. We can make things somewhat familiar to our .NET teams while keeping it idiomatic. With tools like IronRuby this prospect get's even juicier.

Getting Started

If you're just getting started with rake, you need ruby first. The "one click install" at the official Ruby site is what I'm using and it's a pain-free setup. There's plenty on Google, but I recommend giving the Rails Envy boys a click for a super-basic-but-effective primer. Remember the sh method is your friend and, when in doubt, RTFM!


Posted Mon, Aug 25 2008 10:29 PM by Dave Laribee
Filed under: , , ,

[Advertisement]

Comments

Ayende Rahien wrote re: OMG Rake!
on Tue, Aug 26 2008 8:07 AM

Welcome to the executable configuration world :-)

Tom Opgenorth wrote re: OMG Rake!
on Tue, Aug 26 2008 9:25 AM

This is nice - a lot easier to read than XML, IMHO.  

This is kind of what I was trying to get at at ALT.NET Canada in the build talk - that perhaps XML isn't the best language to script in.

Dave Laribee wrote re: OMG Rake!
on Tue, Aug 26 2008 10:48 AM

@Ayende - You're like the official ambassador of executable configuraiton to the .NET world! :) I've been using capistrano and rake for a while now with some rails side projects, I just finally got off my ass and rake-enabled our .NET stuff.

@Tom - Easier to read is a big part of it, but the feedback cycle and task testing story for custom tasks is much, much better. It's just code after all. Is the build talk online somewhere?

chris donnan wrote re: OMG Rake!
on Tue, Aug 26 2008 11:20 AM

I moved to rake for a project a few months back. It took thousands of lines of crappy nant, msbuild, ccnet etc and reduced it to a like 80 lines of lovely ruby. :) Homogeneity has huge value, not 9 syntax representations (some custom CC net stuff, some custom msbuild tasks - in C#, some bat files, some random roll your own xml, xml for ccnet, xml for etc etc.)

Great stuff. I am happy to see more .net folks using rake in a place where it can add value.  I blogged about this a while ago..

chrisdonnan.com/.../how-i-have-fit-ironpython-ruby-jruby-and-ironruby-into-my-existing-net-projects

Hope all is well;

-Chris

Tom Opgenorth wrote re: OMG Rake!
on Tue, Aug 26 2008 12:47 PM

@Dave:

Bil has a link to the video on his site at: weblogs.asp.net/.../alt-net-canada-day-2-noah-build-me-an-ark.aspx

Ray Vega wrote re: OMG Rake!
on Wed, Aug 27 2008 3:13 AM

You expressed the exact same feelings I had when I started using Python in place of NAnt for my build scripts for the exact same reasons. Nice to see as well yet another make the leap away from "XML Hell" (or as Jeremy Miller puts it "XMHell")

I, too, blogged about the joys of switching recently:

lexicalclosures.blogspot.com/.../snake-bitten-by-python-rip-nant.html

J.P. Hamilton wrote re: OMG Rake!
on Wed, Aug 27 2008 8:40 AM

This is awesome! Funny, how you sometimes find stuff just at the moment you need it. I am definitely going to use this for a project I am doing. If I never have to use NAnt again...that's ok by me.

ISerializable - Roy Osherove's Blog wrote Visual vs. “Executable” Build Configurations
on Wed, Aug 27 2008 4:37 PM

Dave wrote a really nice overview of how much he liked playing with Rake, the Ruby based build script

alberto wrote re: OMG Rake!
on Fri, Sep 12 2008 2:01 PM

Can you include ruby & rake in your tools folder? I don't see it in xeva and I like projects to be self-containing.

Dave Laribee wrote re: OMG Rake!
on Fri, Sep 12 2008 3:52 PM

@alberto - you probably *can* but I'd encourage you to think about ruby as a platform similar to a JVM or the .NET framework. Chances are you'll go deeper with rake and start using various gems and such. Then it really becomes a platform for build automation more than just the rake app itself.

alberto wrote re: OMG Rake!
on Sat, Sep 13 2008 8:09 AM

Yeah, I know, but makes it harder to sell it to other people. I'm not myself totally sold on that. You could also do that with nant or other commonly used tools, and that eases some pains, but also causes others. It can be a problem with breaking changes (i.e this worked in ruby/rake x.y.z when we built it, but not anymore, or having to tell everyone you have to install foo/upgrade your bar for this to work).

Maybe silly, maybe not, but it's a cause of friction you don't have if it's included in the project itself.

DotNetKicks.com wrote Using Rake to make a build
on Sun, Sep 14 2008 10:27 PM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Dave Laribee wrote Transitioning from NAnt to Rake
on Fri, Oct 17 2008 3:28 PM

Maybe you're interested in this Rake business . Maybe you've got a big investment in a whole

Mirrored Blogs wrote Transitioning from NAnt to Rake
on Fri, Oct 17 2008 4:34 PM

Maybe you're interested in this Rake business . Maybe you've got a big investment in a whole

Community Blogs wrote Transitioning from NAnt to Rake
on Fri, Oct 17 2008 4:53 PM

Maybe you're interested in this Rake business . Maybe you've got a big investment in a whole

I never want to see XML-driven build scripts again now that I’ve used rake. - Never Run With Scissors wrote I never want to see XML-driven build scripts again now that I’ve used rake. - Never Run With Scissors
on Thu, Dec 25 2008 2:29 PM

Pingback from  I never want to see XML-driven build scripts again now that I’ve used rake. - Never Run With Scissors

indomitablehef.com » Blog Archive » NashDotNet Resources wrote indomitablehef.com » Blog Archive » NashDotNet Resources
on Thu, Jan 15 2009 7:00 PM

Pingback from  indomitablehef.com  » Blog Archive   » NashDotNet Resources

Introducing rubicant - Beige Sunshine wrote Introducing rubicant - Beige Sunshine
on Thu, Jan 22 2009 10:03 PM

Pingback from  Introducing rubicant - Beige Sunshine

User links about "executable" on iLinkShare wrote User links about "executable" on iLinkShare
on Thu, Jan 29 2009 2:34 AM

Pingback from  User links about "executable" on iLinkShare

Tutorial Rake wrote Tutorial Rake
on Tue, Feb 17 2009 10:01 AM

Pingback from  Tutorial Rake

new ThoughtStream("Derick Bailey"); wrote How A .NET Developer Learned Ruby And Rake, To Build .NET Apps In Windows
on Wed, Apr 8 2009 11:01 AM

I recently decided it was time for me to learn Ruby and Rake – with the specific goal of replacing my

StevenHarman.net wrote Being Lazy with Rake
on Fri, May 29 2009 5:10 PM

Being Lazy with Rake

StevenHarman.net wrote OMG, Better Rake (for .net)!
on Mon, Nov 23 2009 6:32 PM

OMG, Better Rake (for .net)!

Add a Comment

(required)  
(optional)
(required)  
Remember Me?