Rant – Ruby’s ant

Rant is a flexible build tool written entirely in Ruby.

The equivalent to a Makefile for make is the Rantfile. An Rantfile is actually a valid Ruby script that is read in by the rant command.

Rant currently features:

  • Rantfiles are written in Ruby.

  • Defining custom tasks

  • Automated packaging, testing and RDoc generation for Ruby applications and libraries.

  • The rant-import command creates a monolithic rant script, so you don’t depend on an rant installation anymore.

  • Creating gzipped tar and zip archives – without installing additional software.

  • Optional recognition of file changes based on MD5 checksums instead of file modification times.

  • Tasks with command change recognition.

  • Dependency checking for C/C++ source files.

As programmers usually want to see code, here is a short and very basic example of rant usage:

A file called Rantfile contains the code:

file "backup/data" => "data" do |t|

sys.cp t.source, t.name


Running rant in the directory of this file:

% rant
cp data backup/data

will ensure that the “data” file in the “backup” directory is up to date.

This document was written for version 0.5.6 of Rant. Most things described here will work for older/newer versions of Rant, but look at the README file in the Rant distribution you’ve installed for exact documentation of your Rant version.


The newest version of this document can be found at make.rubyforge.org.

For further information, feature requests, bugreports or comments join the mailing list make-cafe or visit the RubyForge site for Rant.

Also feel free to contact the author directly by sending an email to [email protected].


Installing Rant



read the section Copying in this document

Invoking rant

read doc/rant.rdoc

Writing an Rantfile

read doc/rantfile.rdoc

Automation for your Ruby library/application

read doc/rubyproject.rdoc

Independent from Rant? The rant-import command

read doc/rant-import.rdoc

Advanced Rantfiles

read doc/advanced.rdoc

Packaging (creating zip/tgz archives)

read doc/package.rdoc

Using MD5 checksums instead of file modification times

read doc/md5.rdoc

Compiling C/C++

read doc/c.rdoc

Buildfiles in subdirectories

read doc/subdirs.rdoc

Tasks with command change recognition

read doc/command.rdoc

Using the Configure plugin

read doc/configure.rdoc deprecated

Compiling C#

read doc/csharp.rdoc

Common file system operations

read doc/sys.rdoc


read the NEWS for new features, not backwards compatible changes and other issues.

Using Rant libraries

read doc/rubylib.rdoc


Copyright © 2005 Stefan Lang

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

The file COPYING in the Rant package contains a copy of the LGPL. Of course your Rantfiles don’t need to be licenced under the terms of the LGPL.

The file lib/rant/archive/minitar.rb is Copyright 2004 Mauricio Julio Fernandez Pradier and Austin Ziegler. It is licensed under the GNU General Public Licence or Ruby’s licence.

The file lib/rant/archive/rubyzip.rb and the files in the lib/rant/archive/rubyzip directory were written by Thomas Sondergaard. They are distributed under the same license as ruby. See www.ruby-lang.org/en/LICENSE.txt.

Other info

Rant was started in February 2005. It has been written and is maintained by Stefan Lang ([email protected]).


Rant has taken the basic syntax of a task and some other concepts from Rake. So thanks to Jim Weirich, the author of Rake.

Rant comes with parts of archive-tar-minitar to create (gzipped) tar archives on platforms where no tar command is available. archive-tar-minitar is developed by Mauricio Julio Fernandez Pradier and Austin Ziegler.

Rant comes with parts of rubyzip to create zip archives on platforms where no zip command is available. rubyzip is developed by Thomas Sondergaard.

Goals of Rant

  • Most important is to be a very flexible build tool. This currently means that you can run/use Rant in many different ways. E.g. you can invoke it the conventional way like make, define tasks and run Rant from irb (the interactive Ruby shell), create an independent script with rant-import, or simply use Rant as a library to automate tasks for your application.

  • Extensible: currently through plugins and generators. (Think of the plugin and import functions.)

  • Portability: see Platforms below for details

  • Well scaling: Rant should work acceptable for bigger projects (from a performance POV and for the writer of the Rantfiles).


Rant was tested on:

System		Ruby version
Linux		1.8.0

1.8.3 1.8.4 1.9

MacOS X		1.8.2
Windows XP		1.8.2 (OneClick Installer)
Windows XP		1.8.4 (OneClick Installer)
Windows 2000	1.8.2 (OneClick Installer)

It should run on most platforms where Ruby runs, but you never know…

If you encounter problems with Rant on any platform (with Ruby 1.8.0 or higher) please write a bugreport!

Why did you write another build tool?

Because I wasn’t satisfied by any other build tool. Before I started Rant, I had to write a program in C#. The program had to run under Windows, but I wanted to develop under Linux. Also I decided to write the documentation in Docbook.

So there where quite a few problems arising:

  • I had to compile with cscc on Linux.

  • compile with csc on Windows.

  • automate PDF and HTML generation from Docbook

Nant would have been ok to compile the C# sources. But it isn’t suited for more general tasks as clueing togheter other programs (needed for Docbook processing).

Then I tried to use Rake and it was the other way round. I liked the basic concept and syntax of Rake and of course I could have written code for Rake (e.g. with a so called Tasklib) to support portable C# compilation. But it was a bit quirky and because I like to work with Ruby, I decided to write my own build tool.