Skip to content

Instantly share code, notes, and snippets.

@sizovs
Last active August 29, 2015 14:03
Show Gist options
  • Save sizovs/1b1f3753198d91bb2420 to your computer and use it in GitHub Desktop.
Save sizovs/1b1f3753198d91bb2420 to your computer and use it in GitHub Desktop.
new File('.').eachFileRecurse(groovy.io.FileType.FILES) {
if (it.name.endsWith(".java")) {
def hits = it.text =~ /\/\/\s*DROP\s*\[\s*(.*)\s*\]\n/
hits.each { match, key ->
def dropConditionForAGivenKey = dropConditions[(key)]
if (!dropConditionForAGivenKey) {
println("<!> Cannot find drop conditions for key '$key'")
return
}
try {
def canBeDropped = dropConditionForAGivenKey()
if (canBeDropped) {
println "--- Drop condition for key '$key' is satisfied. Time to cleanup $it.name"
}
} catch (IOException ioException) {
println("<!> Cannot evaluate drop condition for key '$key' due to: $ioException")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment