hoodwink.d enhanced


HOWTO Rake (or) pls keep going jim! #

by why in inspect

You should learn to Rake. I’ve been meaning to switch everything over for some time now. Rake can currently automate building of gems and documentation from your libraries. And now that’s it’s a hugely popular gem, you can feel safe moving away from setup.rb/install.rb.

Jim Weirich’s started a series of tutorials (Getting Started and Handling Common Tasks) explaining the visceral details of Raking. Not that it’s an involved process—his tutorials are brief. But he gives a lot of specific examples you can rip off. The 2nd article is particularly tasteful.

Rake can automatically generate file based tasks according to some simple pattern matching rules.

For example, we can capture the above logic in a single rule … no need to find all the source files and iterate through them.

  rule '.o' => '.c' do |t|
    sh "cc -c -o #{t.name} #{t.source}" 

The above rule says that if you want to generate a file ending in .o, then you if you have a file with the same base name, but ending in .c, then you can generate the .o from the .c.

said on 08 Apr 2005 at 02:31

Yeah, jim, you are reading this, keep it going, keep it going. Thanks for introducing Rake to us! Nice meeting it!

Comments are closed for this entry.