1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

-Provide option for generating docu for a single step

This commit is contained in:
Marcus Holl 2018-10-26 12:08:34 +02:00
parent 836eff22b9
commit d5c89e8b4a

View File

@ -227,6 +227,8 @@ stepsDir = null
outDir = null
stepsDocuDir = null
steps = []
//
// assign parameters
@ -245,6 +247,10 @@ if(args.length >= 3)
stepsDocuDir = stepsDocuDir ?: new File('documentation/docs/steps')
if(args.length >= 4)
steps << args[3]
// assign parameters
//
@ -271,12 +277,15 @@ if( !stepsDir.exists() ) {
// sanity checks
//
List steps = []
//
// find all the steps we have to document
stepsDir.traverse(type: FileType.FILES, maxDepth: 0)
{ if(it.getName().endsWith('.groovy')) steps << (it =~ /vars\/(.*)\.groovy/)[0][1] }
// find all the steps we have to document (if no step has been provided from outside)
if( ! steps) {
stepsDir.traverse(type: FileType.FILES, maxDepth: 0)
{ if(it.getName().endsWith('.groovy')) steps << (it =~ /vars\/(.*)\.groovy/)[0][1] }
} else {
System.err << "[INFO] Generating docu only for step ${steps.size > 1 ? 's' : ''} ${steps}.\n"
}
def gse = new GroovyScriptEngine( [ stepsDir.getName() ] as String[] , getClass().getClassLoader() )