pledbrook / lazybones

A simple project creation tool that uses packaged project templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

processTemplates does not find files when Lazybones is executed for current directory '.'

svene opened this issue · comments

Given a very simple template (here named tt) with the following lazybones.groovy:

Map props = [:]
props.SOME_VALUE = 'some_value'
processTemplates 'build.gradle', props

and a build.gradle file in the template directory, the call lazybones create tt 0.0.1 .
(note the '.' for the folder) does not process build.gradle and reports:

Creating project from template tt 0.0.1 in current directory
No files filtered with file pattern [build.gradle] and template directory [.]

Using processTemplates '**/build.gradle', props works.
My guess is that it could be fixed in LazyBonesScript.findFilesByPattern():

https://github.com/pledbrook/lazybones/blob/master/lazybones-app/src/main/groovy/uk/co/cacoethes/lazybones/LazybonesScript.groovy#L240

since FilenameUtils.concat(templateDir.path, pattern)

removes './' of templateDir.path and then antPathMatcher.match() fails.

Thanks for the report. I wonder whether it would be better to canonicalise the file paths and then convert them into absolute ones before performing the match. Anyway, this scenario obviously needs adding to the functional tests.