[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Rant 0.3.2

Stefan Lang

4/3/2005 4:41:00 PM

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

== What's new in this release?

* Rant aids you in splitting up your buildfiles and placing them in
multiple directories.
* Bugfixes.

== More about Rant

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/?gr...)
and install with setup.rb:
% ruby setup.rb

== Resources

Current docs:: http://make.rub...
Rubyforge page:: http://rubyforge.org/proj...


28 Answers

Jamis Buck

4/3/2005 5:24:00 PM

0

On Apr 3, 2005, at 10:40 AM, Stefan Lang wrote:

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

Could you expand on that a little bit more? What are some of the
differences between Rake and Rant? From the name it sounds like the
relationship might be "Rake is to Make as Rant is to Ant", but that's
just a shot in the dark.

- Jamis



Stefan Lang

4/3/2005 7:48:00 PM

0

On Sunday 03 April 2005 19:23, Jamis Buck wrote:
> On Apr 3, 2005, at 10:40 AM, Stefan Lang wrote:
> > Rant is a flexible build tool written entirely in Ruby,
> > similar to Rake.
>
> Could you expand on that a little bit more? What are some of the
> differences between Rake and Rant? From the name it sounds like the
> relationship might be "Rake is to Make as Rant is to Ant", but that's
> just a shot in the dark.
>
> - Jamis

During development I use the following build tools as reference:
* Ant (Java)
* Nant (C#)
* make
* SCons (Python)
* Rake

Since the name Rake was already taken, I choose Rant.
(Although Rant perhaps sounds a bit "ambiguous" to (native) English
speakers :-)

WRT comparison with Rake: I replied to a post of Florian Gross in
which i explained some differences between Rake and Rant. Just
look for the header "Re: [ANN] First release of Rant". If you like,
I can send you the relevant email.
Anyway a short list of differences here:

Since the last release, Rant lets you define subdirectories:

file "prog" => "src/main.o" do
# puts some actions here
end
subdirs "src", "doc"

Now Rant will look for a task "main.o" in an Rantfile in "src/".
src/Rantfile could contain:

file "main.o" => "main.c" do
# compile main.c to main.o
end

A short Rantfile for your Ruby application could look like:

import %w(rubytest rubydoc rubypackage)

lib_files = Dir["lib/**/*.rb"]
dist_files = lib_files + %w(Rantfile README) + Dir["{test,bin}/*"]

desc "Run unit tests."
gen RubyTest do |t|
t.test_dir = "test"
t.pattern = "tc_*.rb"
end

desc "Generate html documentation."
gen RubyDoc do |t|
t.opts = %w(--title wgrep --main README README)
end

desc "Create packages."
gen RubyPackage, :wgrep do |t|
t.version "1.0.0"
t.summary "Simple grep program."
t.files dist_files
t.bindir "bin"
t.executable "wgrep"
t.package_task
end

task :clean do
sys.rm_rf %w(doc packages)
end

With this Rantfile, rant runs unit tests, RDoc, creates tar.gz, zip
and gem packages and provides the "clean" task.

We use +import+ in this file, which does a similar thing as require.
But it allows the following:
% rant-import --auto ant
And now you have an Rant script in the file "ant" which makes your project
independent from an Rant installation. Just run:
% ruby ant

You can define tasks and run Rant from irb, use it as a library or
invoke your Rantfile directly. Although it looks like Rant would
introduce methods in the global namespace, it doesn't. Methods of
the FileUtils module can be called through the +sys+ method.

Besides that, Rant provides (primitive) support for C# and a "Configure"
plugin.

I recommend to read the Rant documentation at http://make.ruby....

Stefan


Lionel Thiry

4/3/2005 9:12:00 PM

0

Stefan Lang a écrit :
> On Sunday 03 April 2005 19:23, Jamis Buck wrote:
>
>>On Apr 3, 2005, at 10:40 AM, Stefan Lang wrote:
>>
>>>Rant is a flexible build tool written entirely in Ruby,
>>>similar to Rake.
>>
>>Could you expand on that a little bit more? What are some of the
>>differences between Rake and Rant? From the name it sounds like the
>>relationship might be "Rake is to Make as Rant is to Ant", but that's
>>just a shot in the dark.
>>
>>- Jamis
>
>
> During development I use the following build tools as reference:
> * Ant (Java)

Following your code samples, I must tell I feel it hard to see where Rant is
affiliated with Ant.

> * Nant (C#)
> * make
> * SCons (Python)

I'm really curious here: what have you borrowed from SCons? Does Rant use a
directed acyclic graph for managing file dependencies? (AFAIK it's the main
mechanism of SCons internals)

> * Rake
>
> [snip]
>

--
Lionel Thiry

Nikolai Weibull

4/3/2005 9:28:00 PM

0

Lionel Thiry, April 4:

> I'm really curious here: what have you borrowed from SCons? Does Rant
> use a directed acyclic graph for managing file dependencies?

Isn't that what all dependency-management systems use?,
nikolai

--
Nikolai Weibull, now available free of change at http:/...!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


Stefan Lang

4/3/2005 10:13:00 PM

0

On Sunday 03 April 2005 23:09, Lionel Thiry wrote:
> Stefan Lang a écrit :
> > On Sunday 03 April 2005 19:23, Jamis Buck wrote:
> >>On Apr 3, 2005, at 10:40 AM, Stefan Lang wrote:
> >>>Rant is a flexible build tool written entirely in Ruby,
> >>>similar to Rake.
> >>
> >>Could you expand on that a little bit more? What are some of the
> >>differences between Rake and Rant? From the name it sounds like the
> >>relationship might be "Rake is to Make as Rant is to Ant", but that's
> >>just a shot in the dark.
> >>
> >>- Jamis
> >
> > During development I use the following build tools as reference:
> > * Ant (Java)
>
> Following your code samples, I must tell I feel it hard to see where Rant
> is affiliated with Ant.

An Rantfile is Ruby code. A buildfile for Ant is XML.
Besides that, one could call Ant as project oriented. I try to achieve
a similar goal with Rant.

>
> > * Nant (C#)
> > * make
> > * SCons (Python)
>
> I'm really curious here: what have you borrowed from SCons? Does Rant use a
> directed acyclic graph for managing file dependencies? (AFAIK it's the main
> mechanism of SCons internals)

If I understand the definition of a DAG correctly, yes.
Rant delays dependency resolving until the point where it's actually
needed:
task :t => %w(d1 d2) do
end

task :d1 do
...
task :d2 do
end
end
When invoking task "t", Rant will first invoke dependency "d1"
which will create task "d2", then the newly created task "d2"
will be invoked and afterwards the actions for "t" will be performed.
Don't know if something like that works with SCons.

With Rant it is possible to achieve the same goals as with a "Construction
Environment" in SCons (at least AFAIK SCons), but this is currently not
documented (mainly because it's currently not very convinient to do so
and it will change, expect docs in future releases).

Note that Ant and SCons are very heavyweight compared to Rant. And Rant
is in an early stage of development. I'm using other build tools as
reference for e.g. names of commandline switches or to decide detailed
semantics.

> --
> Lionel Thiry

Stefan



Lionel Thiry

4/4/2005 1:52:00 AM

0

Nikolai Weibull a écrit :
> Lionel Thiry, April 4:
>
>
>>I'm really curious here: what have you borrowed from SCons? Does Rant
>>use a directed acyclic graph for managing file dependencies?
>
>
> Isn't that what all dependency-management systems use?,
> nikolai
>
Uh, well... no.

For exemple, AFAIK Rake doesn't manage file dependcies, and task dependencies
are not managed with a DAG.

--
Lionel Thiry

Lionel Thiry

4/4/2005 2:13:00 AM

0

Stefan Lang a écrit :
> On Sunday 03 April 2005 23:09, Lionel Thiry wrote:
>>Following your code samples, I must tell I feel it hard to see where Rant
>>is affiliated with Ant.
>
>
> An Rantfile is Ruby code. A buildfile for Ant is XML.
> Besides that, one could call Ant as project oriented. I try to achieve
> a similar goal with Rant.

There is already another project called Rant on rubyforge, and that one claims
to be a real mimick of Ant in ruby. So, I suppose telling "Rant is for Ant what
Rake is for Make" fits better for that other project.

>>>* Nant (C#)
>>>* make
>>>* SCons (Python)
>>
>>I'm really curious here: what have you borrowed from SCons? Does Rant use a
>>directed acyclic graph for managing file dependencies? (AFAIK it's the main
>>mechanism of SCons internals)
>
>
> If I understand the definition of a DAG correctly, yes.
> Rant delays dependency resolving until the point where it's actually
> needed:
> task :t => %w(d1 d2) do
> end
>
> task :d1 do
> ...
> task :d2 do
> end
> end
> When invoking task "t", Rant will first invoke dependency "d1"
> which will create task "d2", then the newly created task "d2"
> will be invoked and afterwards the actions for "t" will be performed.
> Don't know if something like that works with SCons.
>
> With Rant it is possible to achieve the same goals as with a "Construction
> Environment" in SCons (at least AFAIK SCons), but this is currently not
> documented (mainly because it's currently not very convinient to do so
> and it will change, expect docs in future releases).
>
> Note that Ant and SCons are very heavyweight compared to Rant. And Rant
> is in an early stage of development. I'm using other build tools as
> reference for e.g. names of commandline switches or to decide detailed
> semantics.

I can't tell I master those topics, but I don't think it is exactly what I was
talking about. One of the feature of SCons is to be able to automatically
generate tasks based on file dependencies. In some way, it would be as if task
d2 didn't needed to be created, SCons would have done it for you. But it would
do it the same way you stated: only when needed.

Note: SCons doesn't even stop on "automagically generate the appropriate task
and only when needed", it even tries its best to find the dependencies itself.

Second Note: I think jam works the same way.

--
Lionel Thiry

Jim Weirich

4/4/2005 2:28:00 AM

0

On Sunday 03 April 2005 09:49 pm, Lionel Thiry wrote:
> Nikolai Weibull a écrit :
> > Lionel Thiry, April 4:
> >>I'm really curious here: what have you borrowed from SCons? Does Rant
> >>use a directed acyclic graph for managing file dependencies?
> >
> > Isn't that what all dependency-management systems use?,
> > nikolai
>
> Uh, well... no.
>
> For exemple, AFAIK Rake doesn't manage file dependcies,

If by managing file dependencies you mean automatically detect and maintain
the file dependencies, you are correct. But it is easy to get other tools to
work with rake to do that.

> and task dependencies are not managed with a DAG.

Actually they are. Ok, there are no checks to enforce the acyclic nature of
the dependency graph, but the arcs of the graph are certainly directed.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


Stefan Lang

4/4/2005 1:27:00 PM

0

On Monday 04 April 2005 04:14, Lionel Thiry wrote:
> Stefan Lang a écrit :
> > On Sunday 03 April 2005 23:09, Lionel Thiry wrote:
> >>Following your code samples, I must tell I feel it hard to see where Rant
> >>is affiliated with Ant.
> >
> > An Rantfile is Ruby code. A buildfile for Ant is XML.
> > Besides that, one could call Ant as project oriented. I try to achieve
> > a similar goal with Rant.
>
> There is already another project called Rant on rubyforge, and that one
> claims to be a real mimick of Ant in ruby. So, I suppose telling "Rant is
> for Ant what Rake is for Make" fits better for that other project.

I encountered this project when I registered Rant on RubyForge.
Looks like it's dead. No release, no docu and about 15 kB of Ruby code.

> --
> Lionel Thiry



Lionel Thiry

4/5/2005 11:44:00 PM

0

Jim Weirich a écrit :
> On Sunday 03 April 2005 09:49 pm, Lionel Thiry wrote:
>
>>Nikolai Weibull a écrit :
>>
>>>Lionel Thiry, April 4:
>>>
>>>>I'm really curious here: what have you borrowed from SCons? Does Rant
>>>>use a directed acyclic graph for managing file dependencies?
>>>
>>>Isn't that what all dependency-management systems use?,
>>> nikolai
>>
>>Uh, well... no.
>>
>>For exemple, AFAIK Rake doesn't manage file dependcies,
>
>
> If by managing file dependencies you mean automatically detect and maintain
> the file dependencies, you are correct. But it is easy to get other tools to
> work with rake to do that.
>
>
>>and task dependencies are not managed with a DAG.
>
>
> Actually they are. Ok, there are no checks to enforce the acyclic nature of
> the dependency graph, but the arcs of the graph are certainly directed.
>

In Rake, the existence of the graph is implicit, hidden in the Task instances
themselves, there isn't any explicit global DAG object.

Just pointing a fact, no offense. :)

--
Lionel Thiry