Skip to content

Instantly share code, notes, and snippets.

@ctoestreich
Created February 24, 2012 18:29
Show Gist options
  • Save ctoestreich/1902796 to your computer and use it in GitHub Desktop.
Save ctoestreich/1902796 to your computer and use it in GitHub Desktop.
Grails Docs Helper Script
includeTargets << grailsScript("_GrailsDocs")
target(main: "Copy controllers, services, domain and views from svn excluded grails-app dirs to the answers dir and create gdoc from them in ref sidebar") {
//make sure they all compile
depends(compile)
//closure to include or exclude certain file types
def filesetToInclude = {directory ->
fileset(dir: directory) {
include(name: '**/*.groovy')
include(name: '**/*.gsp')
include(name: '**/*.xml')
include(name: '**/*.properties')
}
}
def initCopyDirs = ['grails-app/controllers', 'grails-app/domain', 'grails-app/services', 'grails-app/views']
ant.sequential {
//add the conf dir for now
(initCopyDirs + ['grails-app/conf']).each { directory ->
println "copying $directory to answers/$directory"
copy(todir: "answers/${directory}") {
filesetToInclude(directory)
}
}
println "completed copying files"
}
initCopyDirs.each { directory ->
ant.fileScanner {
filesetToInclude(directory)
}.each {File file ->
println "wrapping file ${file.name}"
echo(file: "src/docs/ref/Answers/${file.name}.gdoc", """
{code}
${file.getText()}
{code}
""")
}
}
depends(docs)
}
setDefaultTarget(main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment