You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Ed Smiley <es...@ebrary.com> on 2011/07/29 01:11:24 UTC

Running Buildr from inside Ruby code

Excuse me I didn't edit my subject line.  "Running Buildr from inside Ruby
code" is what I intended...

On Thu, Jul 28, 2011 at 4:03 PM, Ed Smiley <es...@ebrary.com> wrote:

> Haven't been too active on the list lately.  Buildr has been behaving
> itself very well....

Re: Running Buildr from inside Ruby code

Posted by Ed Smiley <es...@ebrary.com>.
Thanks Alex,

It's not on the top of my priorities, but I'd like to be able to incorporate
builds and Maven repo manipulation into Ruby programs (like Chef).  If I
come up with something interesting I'll let you know.

--ed

On Fri, Jul 29, 2011 at 6:39 AM, Alex Boisvert <al...@gmail.com>wrote:

> On Thu, Jul 28, 2011 at 4:03 PM, Ed Smiley <es...@ebrary.com> 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
>



-- 
Ed Smiley, Software Architect Sr
*e*brary | 410 Cambridge Avenue| Palo Alto, CA 94306 USA |
esmiley@ebrary.com
www.ebrary.com
*e*brary is a member of the ProQuest family of companies.

Re: Running Buildr from inside Ruby code

Posted by Alex Boisvert <al...@gmail.com>.
On Thu, Jul 28, 2011 at 4:03 PM, Ed Smiley <es...@ebrary.com> 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