On Fri, Oct 23, 2009 at 1:02 AM, Peter Schröder <[email protected]> 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
>

Reply via email to