[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Should rake remove t.name on failed tasks?

Josef Wolf

11/29/2006 3:41:00 PM

Hello!

With rake, I often find myself doing something like that:

file "custom.iso" => "custom.dir" do |t|
begin
sh "mkisofs -r -V My Install CD' -cache-inodes" +
" -J -l -b isolinux/isolinux.bin" +
" -c isolinux/boot.cat -no-emul-boot" +
" -boot-load-size 4 -boot-info-table" +
" -o #{t.name} #{custom.dir}"

rescue
sh "rm #{t.name}"
raise

end
end

to avoid a broken target lying around.

I wonder whether I am missing something here. Shouldn't rake remove t.name?
I mean, once rake has started to build a target, it is pretty much sure that
the target _have_ to be rebuilt. Thus there's no rason to let a half-baked
target lying around should the build of that target fail.

AFAICS, make removes the target if it fails to build it, too.

What am I missing here? Any suggestions?

1 Answer

Daniel Berger

11/29/2006 3:54:00 PM

0


Josef Wolf wrote:
> Hello!
>
> With rake, I often find myself doing something like that:
>
> file "custom.iso" => "custom.dir" do |t|
> begin
> sh "mkisofs -r -V My Install CD' -cache-inodes" +
> " -J -l -b isolinux/isolinux.bin" +
> " -c isolinux/boot.cat -no-emul-boot" +
> " -boot-load-size 4 -boot-info-table" +
> " -o #{t.name} #{custom.dir}"
>
> rescue
> sh "rm #{t.name}"
> raise
>
> end
> end
>
> to avoid a broken target lying around.
>
> I wonder whether I am missing something here. Shouldn't rake remove t.name?

That seems a reasonable request. Jim, is there any downside to this?

Regards,

Dan