Skip to content

Commit

Permalink
[bertramdev#10] Include environment directory in excludedSeedFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
LarryBattleWork committed Mar 24, 2016
1 parent 8758cb1 commit f304d39
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions grails-app/services/seedme/SeedService.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package seedme

import grails.util.Environment
import groovy.io.FileType
import groovy.io.FileVisitResult
import groovy.text.GStringTemplateEngine
import org.codehaus.groovy.grails.commons.GrailsDomainClass
import org.codehaus.groovy.grails.commons.GrailsDomainClassProperty
Expand Down Expand Up @@ -467,20 +469,15 @@ class SeedService {
seedPaths.each { seedPath ->
def seedFolder = new File(seedPath.value)
def pluginName = seedPath.key
if(seedFolder.exists()) {
seedFolder?.eachFile { tmpFile ->
if(!tmpFile.isDirectory() && tmpFile.name.endsWith('.groovy') && !isSeedFileExcluded(tmpFile.name))
seedFiles << [file: tmpFile, plugin: pluginName]
}
seedFolder?.eachDir { tmpFolder ->
if(tmpFolder.name == env) {
tmpFolder.eachFile { tmpFile ->
if(!tmpFile.isDirectory() && tmpFile.name.endsWith('.groovy'))
seedFiles << [file: tmpFile, plugin: pluginName]
}
}
}
}
if(!seedFolder.exists()) return;
seedFolder.traverse([
type: FileType.FILES,
nameFilter: ~/.*\.groovy/,
preDir : { if (it.name != subDir ) return FileVisitResult.SKIP_SUBTREE }
], { file ->
if(!isSeedFileExcluded(file.name))
seedFiles << [file: file, plugin: pluginName]
})
}
return seedFiles
}
Expand Down

0 comments on commit f304d39

Please sign in to comment.