On Sun, Jan 4, 2009 at 11:54 PM, Antoine Toulme <[email protected]> wrote: > Hi, > > while it's still fresh, I'd like to share the problems we encountered to > build a plugin with Buildr. > > As you may know, Buildr is packaged as an application, so doing a require > "buildr" brings quite a few things. > > In our case, we wanted to build a spec that was pretty much a copy/paste of > javac. > > We tried first by requiring the gem and some of its modules. It turns out > that there are a few clever tricks made in spec/spec_helpers.rb that are > necessary to send rake tasks properly. > > In the end, we were able to test by placing buildr4eclipse along with > buildr, and required the file explicitely. > With that setup, tests are actually running in the buildr/tmp folder :-/. At > least we could run the tests. > > There doesn't seem to be a way to require spec/spec_helpers.rb in the gem. > The file is present in there though.
Because Buildr is an open source project, it makes sense to include "everything you need to use it, extend it and patch it" [1] through whatever channel we use to distribute it, including Gems. But only files necessary for runtime use (i.e. public API and features) are added to the Gem load path. You can reach spec/ in two ways. With a bit of creative gem gymnastics you can find the expanded path of the gem and use that to require whichever file you need. Or you can use a vendor branch, which is my preferred approach. If you're using Git, have a look at braid [2]. Assaf [1] http://incubator.apache.org/buildr/contributing.html#living_on_the_edge [2] http://github.com/evilchelu/braid/wikis/home > I am quite unsure there is a pleasant way to work around those problems. If > the Buildr team is interested into helping with supporting testing of > plugins further more, I'd be happy to discuss about it. > > Thanks, > > Antoine > > -- > http://www.lunar-ocean.com/blog >
