buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assaf Arkin <as...@labnotes.org>
Subject Re: helper for directories
Date Fri, 23 Oct 2009 17:23:40 GMT
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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message