From: Stefan Lang Date: 2005-03-26T19:40:23+09:00 Subject: Re: [ANN] First release of Rant On Saturday 26 March 2005 03:44, Florian Gross wrote: > Stefan Lang wrote: > > 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. > 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.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.