[ANN] First release of Rant

S

Stefan Lang

From the documentation:

Rant is a flexible build tool written entirely in Ruby,
similar to Rake.

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

Rant currently features:
* Defining custom tasks
* Automated packaging, testing and RDoc generation for Ruby
applications and libraries.
* Primitive support for compiling C# sources portably with csc, cscc
and mcs.
* A configure plugin for easy environment and build-parameter
checking (but not like autoconf!) which saves data in a yaml file.
* The rant-import command creates a monolithic rant script,
so you don't depend on an rant installation anymore.

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 "data", t.name
end

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.

== Installing Rant

You can install Rant as a RubyGem:
% gem install -r rant

or download the package from RubyForge(http://rubyforge.org/frs/?group_id=615)
and install with setup.rb:
% ruby setup.rb

== Resources

Current docs:: http://make.rubyforge.org
Rubyforge page:: http://rubyforge.org/projects/make/
 
F

Florian Gross

Stefan said:
From the documentation:

Rant is a flexible build tool written entirely in Ruby,
similar to Rake.

So how does it compare to Rake? What's new?

I think Rake already does automated packaging, testing and RDoc
generation as well as support for compiling stuff via shelling out.

I'm not sure I understand what the build-parameter stuff would be for?
Any samples for that?

Not that I want to turn down your effort or anything, it's always nice
to have choice, but I'm not yet sure how this differs to Rake and would
like to know more about it.

Thank you!
 
S

Stefan Lang

So how does it compare to Rake? What's new?

I think Rake already does automated packaging, testing and RDoc
generation as well as support for compiling stuff via shelling out.

I'm not sure I understand what the build-parameter stuff would be for?
Any samples for that?

Not that I want to turn down your effort or anything, it's always nice
to have choice, but I'm not yet sure how this differs to Rake and would
like to know more about it.

I'll try to explain, but first apology for my English!
Rake authors and enthusiasts, please don't feel offended.

Of course the first obvious difference is the support for C#:

gen Assembly, "myprog.exe" do |t|
t.libs = %w(System.Drawing.dll System.Windows.Forms.dll)
t.sources = Dir["src/*.cs"]
t.resources = Dir["res/*.*"]
end

It't true you could construct a shell command and it would work for,
say csc. But this works for csc, cscc and mcs (and tested on Windows,
Linux and MaxOS X).

The not so ovious differences are the internals. The implementation of
Rant differs completely from that of Rake. Rake was started as a quick
hack and it seems that this shines through in its design.

Some examples where this becomes visible:

task :t1 => :t2 do
puts "t1"
end
Running this with Rake I get:
% rake t1
(in /home/stefan/tmp)
rake aborted!
Don't know how to build task 't2'

With Rant:
% rant
rant: [ERROR] Unknown task `t2',
referenced in `/home/stefan/tmp/Rantfile', line 1!
rant: [ERROR] Task `t1' fail.
rant aborted!

Or with regards to documenting Ruby code:
In the Rakefile you define an RDocTask, setting the RDoc options.
Then you define the GemSpec and duplicate this options.
Rant figures out that you have defined a Task for RDoc, uses this
options also for the gemspec and sets the has_rdoc attribute.

...packaging:
You define a package task and Rake automatically adds a task
for repackaging. I don't know a way to turn this off. Not necessary
with rant:
% rant -a package
The -a option forces a run of the task given as argument and all
its dependencies. So this works for ALL tasks.
With rake there is now way to give the package task another name.
Rant uses defaults but you have the ability to name ALL tasks as you
like.

Then the Rake docs state that you can use rake as a standalone script.
(It didn't work for me, but perhaps I made some mistake.)
But as soon as you have:
require 'rake/somerakecode"
in your Rakefile, it doesn't work anymore.

With rant I do:
import "somerantcode"
And then I run:
% rant-import --auto ant
% ruby ant
The file "ant" contains a monolithic version of Rant with exactly
the code required for your project.

Another detail:
I can define tasks and run Rant from irb:

irb(main):001:0> require 'rant'
=> true
irb(main):002:0> task :hello do
irb(main):003:1* puts "hello"
irb(main):004:1> end
=> #<Rant::Task:0x40311b7c ...
irb(main):005:0> Rant.run
hello
=> 0

... and another one:
AFAIK at any time you can only have one Rake instance, because
Rake solves very much with global/class (instance) variables.
You can have any number of Rant instances (in one Ruby interpreter)
at any time. It *should* (not tested) be possible to run them in parallel.

WRT the Configure plugin: It is currently not that usefull but
here is a short code snippet for demonstration:

conf = plugin :Configure do |conf|
conf.init_modes = [:guess, :interact]
conf.override_modes = [:env]
conf.task # define a task named :configure
conf.check "csc" do |c|
c.default "cscc"
c.guess {
CsCompiler.look_for_cs_compiler
}
c.interact {
c.prompt "Command to invoke your C# Compiler: "
}
c.react {
c.msg "Using `#{c.value}' as C# compiler."
}
end
conf.check "target" do |c|
c.default "myprog.exe"
c.interact {
c.prompt "Name for executable: "
}
end
# define more checks
end

# from our example above
gen Assembly, conf["target"] do |t|
t.libs = %w(System.Drawing.dll System.Windows.Forms.dll)
t.sources = Dir["src/*.cs"]
t.resources = Dir["res/*.*"]
end

# configuration will be saved in a YAML file called "config"
# (can be changed). The user can override values at commandline:
% rant csc=mcs target="myprog_test.exe"

OK, I think that are enough details. Generally I *think* that
Rant is more flexible and extensible, though Rake is older and
already in use by many people so it's better tested.
Thank you!
Thank you for reading this long post :)

PS: Expect some German documentation for Rant in the future.
 
F

Florian Gross

Stefan said:
Not that I want to turn down your effort or anything, it's always nice
to have choice, but I'm not yet sure how this differs to Rake and would
like to know more about it.

[Nice explanation of lots of improvements.]

OK, I think that are enough details. Generally I *think* that
Rant is more flexible and extensible, though Rake is older and
already in use by many people so it's better tested.

Thanks, that explains the differences quite well. I think I will have a
look at it in the future -- it would be quite a bit of work to migrate
my current Rakefiles to it so I guess I will have a look at it when I
start the next one.

Thanks again for library and the kind explanation of its philosophy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] Rant 0.3.2 28
[ANN] Rant 0.3.4 0
[ANN] Rant 0.3.6 0
[ANN] Rant 0.3.8 10
[ANN] Rant 0.4.6 2
[ANN] Rant 0.4.2 2
[ANN] Rant 0.4.4 1
[ANN] Rant 0.4.0 3

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top