Mercurial > public > gradleplugins
view src/main/groovy/org/ssdt_ohio/gradle/doc/tools/UserClassDocProxy.groovy @ 35:80e46acfd82a version-0.4.6 tip
Add publishing configuration for publishToMavenLocal task
:
author | Kyle Miller <kyle.miller@mcoecn.org> |
---|---|
date | Tue, 09 Aug 2022 13:05:45 +0100 |
parents | e2d02e8742be |
children |
line wrap: on
line source
/* * Copyright (c) 2013. Ohio Department of Education. - All Rights Reserved. * Unauthorized copying of this file, in any medium, is strictly prohibited. * Written by State Software Development Team (http://ssdt.oecn.k12.oh.us/) */ package org.ssdt_ohio.gradle.doc.tools import org.codehaus.groovy.groovydoc.GroovyFieldDoc import org.codehaus.groovy.groovydoc.GroovyProgramElementDoc import static org.apache.commons.lang3.StringUtils.splitByCharacterTypeCamelCase class UserClassDocProxy extends groovy.util.Proxy { private static LABEL_PATTERN = ~/.*label = '([\w\s]*)'.*/ private static GROUP_PATTERN = ~/.*group = '([\w\s]*)'.*/ GroovyFieldDoc[] properties() { getAdaptee().properties().findAll { GroovyFieldDoc p -> !p.isTransient() && p.name() != 'version' && !p.annotations().any { it.name().contains('Transient') } } } def propertyMissing(String name) { getAdaptee()."$name" } def getLabel(GroovyProgramElementDoc p) { def result def d = p.annotations().find { it.name() == 'Display' } if (d) { def m = LABEL_PATTERN.matcher(d.description()) if (m.matches()) { result = m.group(1) } } return result ?: labelFromCamelCase(p.name() - "get") } def getGroup(GroovyProgramElementDoc p) { def result def d = p.annotations().find { it.name() == 'Display' } if (d) { def m = GROUP_PATTERN.matcher(d.description()) if (m.matches()) { result = m.group(1) } } return labelFromCamelCase(result) ?: '' } static String labelFromCamelCase(String s) { splitByCharacterTypeCamelCase(s).collect { it.trim() }.findAll { it }.join(' ').capitalize() } }