You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Peter Schröder <ps...@blau.de> on 2009/10/23 10:02:17 UTC

helper for directories

hi there,

i am looking for the way that buildr is creating directories on  
demand. i would like to use some magic like "if the directory is  
missing, just create it!" so that i dont have to create the  
directories myself.

kind regards,
peter

Re: helper for directories

Posted by Assaf Arkin <as...@labnotes.org>.
On Fri, Oct 23, 2009 at 1:02 AM, Peter Schröder <ps...@blau.de> wrote:

> hi there,
>
> i am looking for the way that buildr is creating directories on
> demand. i would like to use some magic like "if the directory is
> missing, just create it!" so that i dont have to create the
> directories myself.
>

Rake has a nice way of handling this using dependencies:

  directory "foo/bar"

  file "foo/bar/baz.h"=>"foo/bar" do
    # create baz.h, directory exists ...
  end

Personally, I use mkdir_p, which will create parent directories as
necessary, and not complain if directory already exists:

  file "foo/bar/baz.h" do
    mkdir_p "foo/bar"
    # create baz.h, directory exists ...
  end

Assaf



>
> kind regards,
> peter
>

AW: helper for directories

Posted by Klaas Prause <kp...@blau.de>.
As far as I have seen, buildr uses FileUtils for this stuff, so there is no magic think as far as I know. For all custom tasks I have used FileUtils to create missing dirs recursively.

Regards Klaas

-----Ursprüngliche Nachricht-----
Von: Peter Schröder [mailto:ps@blau.de] 
Gesendet: Freitag, 23. Oktober 2009 10:02
An: users@buildr.apache.org
Betreff: helper for directories

hi there,

i am looking for the way that buildr is creating directories on  
demand. i would like to use some magic like "if the directory is  
missing, just create it!" so that i dont have to create the  
directories myself.

kind regards,
peter