|
Hi Jeremy
I got my hands dirty trying to fix the bug I reported last week. In
essence the trail started when ran "ant test" on the CVS head obtained
from sourceforge. This failed because megg was finding the provided
java templates directory at
./templates/java
but failing later when attempting to load ./java/megg.xml (not
./templates/java/megg.xml!) when later parsing the megg properties.
When attempting to load a directory in the local folder ./java, megg
would fail when trying to find template files in ./templates/java.
The behaviour seems to be different when loading from the templates
collection distributed in the Jar file, which is why I assume the
problem has not been noticed before.
I have attempted a fix whereby megg now tries ./java then
./templates/java then $HOME/.megg/java and finally
$HOME/.megg/templates/java before resorting to the jar file. If fact,
my added code can actually find files at any path prefix, although I
haven't yet added that feature to the CLI (e.g. as an option -t
templates_dir).
I made my changes by creating an object to represent the
TemplatesDirectory which also allows the code for handling local file
templates to be somewhat simpler. I also took the opportunity to use
commons-io to make file copy a bit more transparent and the commons-io
groups' advice to use the java.io.File object rather than strings to
manipulate file names.
I haven't yet tested the option to download from a URL (which didn't
work when I tried it before my changes). It's next on my list.
However, I wanted to notify you just in case you wanted to have a look
and possibly merge my changes into a test branch for review. Not sure
how to generate a patch file yet (need to check my CVS manual), but
I'm sure I could upload one here if desired. Let me know.
Chris
P.S. My main motivation for what turned out to be a long weekend's
work was a desire to use Mike Clark's pragmatic automation template
announced here some time ago. It wouldn't load from the URL. It
wouldn't load when I downloaded the zip file and copied it into
./templates/pragouto-template, or tried ./pragauto-template but it did
work when I added megg/templates/pragouto-template to the megg.jar
using the "ant dist" target.
|