On Thu, Jul 28, 2011 at 4:03 PM, Ed Smiley <[email protected]> wrote:

> Haven't been too active on the list lately.  Buildr has been behaving
> itself
> very well.
>
> I have an advanced question.
> This may have been covered, it seems obvious, but I haven't really seen
> this
> one discussed.
>
> I want to be able to have the option of running Buildr from within a Ruby
> application, Chef recipe etc.
> And yes, obviously I can exec it off as another process, but that seems
> really lame since Buildr is in Ruby.


I think executing as another process is fairly idiomatic Ruby (the "Ruby is
Unix/Posix" philosophy) though I understand your desire...

Right now, executing from Ruby code isn't well support because there's a few
assumptions in the bootstrap process that sort of break.   Buildr assumes
there's a buildfile somewhere to be read, it uses your current directory to
find it, buildr will also read other files like build.yaml and try to enable
gems, etc.   It's certainly possible to run it but it requires either
monkeying Buildr::Application or duplicating some code to achieve correct
initialization without these assumptions.

If you want to pursue this, I would recommend opening
lib/core/application.rb, copying whichever code your application needs for
initialization into a separate module and using that for bootstrap.   (If
you get there and want to share your work, I think there'd be interest in
putting this back into Buildr for others to embed).

alex

Reply via email to