Closed ErwinvanBrandwijk closed 13 years ago
Possible solution in my fork.
void include(Map params = [:]) {
def files = []
if(params.path){
// pass a directory
def includedChangeLogPath = params.path
// get all files ending with .groovy
new File(includedChangeLogPath).eachFileMatch(~/.*.groovy/) { file->
files << file.getPath()
}
// order the files, alphabetic
files.sort()
}else if (params.file){
// pass a file
files << params.file
}
files.each {
def parser = ChangeLogParserFactory.getInstance().getParser(it, resourceAccessor)
def includedChangeLog = parser.parse(it, null, resourceAccessor)
includedChangeLog?.changeSets.each { changeSet ->
databaseChangeLog.addChangeSet(changeSet)
}
includedChangeLog?.preconditionContainer?.nestedPreconditions.each { precondition ->
databaseChangeLog.preconditionContainer.addNestedPrecondition(precondition)
}
}
}
Accepted in master and working
Liquibase has an includeAll tag, it isn't possible in groovy-liquibase.
It could be make as his own method or add it to include.
IncludeAll should only read the groovy files in a directory, NOT a subdirectory.
includeAll(path: "/path/") OR include(path: "/path/")