Skip to content

Commit 08006fa

Browse files
committed
Use 'grace-doc' Gradle plugin to generate documentation
Closes gh-31
1 parent 770bf34 commit 08006fa

File tree

11 files changed

+499
-4
lines changed

11 files changed

+499
-4
lines changed

build.gradle

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ group = "org.graceframework.plugins"
2121
apply plugin: "eclipse"
2222
apply plugin: "idea"
2323
apply plugin: "java-library"
24+
apply plugin: "org.graceframework.grace-doc"
2425
apply plugin: "org.graceframework.grace-plugin"
2526
apply plugin: "io.github.gradle-nexus.publish-plugin"
2627
apply plugin: "maven-publish"
@@ -41,15 +42,12 @@ dependencies {
4142
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
4243
}
4344
compileOnly "org.graceframework:grace-boot"
44-
documentation "org.fusesource.jansi:jansi:$jansiVersion"
4545
documentation "org.apache.groovy:groovy:$groovyVersion"
4646
documentation "org.apache.groovy:groovy-ant:$groovyVersion"
4747
documentation "org.apache.groovy:groovy-templates:$groovyVersion"
4848
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"
4949
}
5050

51-
bootJar.enabled = false
52-
5351
java {
5452
toolchain {
5553
languageVersion = JavaLanguageVersion.of(17)
@@ -64,6 +62,46 @@ jar {
6462
includeEmptyDirs = false
6563
}
6664

65+
66+
def cleanTask = project.tasks.findByName('clean')
67+
if (cleanTask == null) {
68+
task clean(type: Delete) {
69+
delete(buildDir)
70+
}
71+
}
72+
else {
73+
cleanTask.doLast {
74+
ant.delete(dir: 'build/docs')
75+
}
76+
}
77+
78+
tasks.withType(Groovydoc) {
79+
group = 'Documentation'
80+
docTitle = "Grace Geb - ${project.version}"
81+
destinationDir = project.file('build/docs/manual/api')
82+
def files = []
83+
project.rootProject.subprojects
84+
.findAll { !it.name != 'docs' && !it.name.startsWith('examples') }
85+
.each { subproject ->
86+
if(subproject.file('src/main/groovy').exists()) {
87+
files += subproject.files('src/main/groovy')
88+
}
89+
if(subproject.file('src/main/java').exists()) {
90+
files += subproject.files('src/main/java')
91+
}
92+
}
93+
if (project.file('src/main/groovy').exists()) {
94+
files += project.files('src/main/groovy')
95+
}
96+
source = files
97+
classpath += configurations.documentation
98+
}
99+
100+
docs {
101+
dependsOn groovydoc
102+
sourceDir = project.file('docs')
103+
}
104+
67105
publishing {
68106
publications {
69107
maven(MavenPublication) {

docs/guide/installation.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
== Installation
2+
3+
To start using this library, there are only a couple simple steps:
4+
5+
. Import the library in your `build.gradle`
6+
7+
[source,groovy,subs="attributes",indent=1]
8+
testImplementation "org.graceframework.plugins:geb:{version}"

docs/guide/introduction.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Geb Functional Testing for Grace application
2+
3+
This plugin just provides the Geb dependencies and a `create-functional-test` command for generating Geb tests in a Grace app.
4+
5+
For further reference please see the http://www.gebish.org[Geb documentation].

docs/guide/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
introduction: Introduction
2+
installation: Installation
3+
usage: Usage

docs/guide/usage.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
== Usage

docs/resources/doc.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
api=../api
2+
guide=../../guide
3+
tags=../ref/Tags
4+
sourcedir=.
5+
sourceRepo=https://github.com/graceframework/grace-geb/edit/6.3.x/docs
6+
safe=UNSAFE
7+
title=Grace Geb
8+
subtitle=Provides Integration with Geb for Functional Testing
9+
authors=Michael Yan
10+
copyright=Copyright © 2022-2025 Michael Yan and the original authors. The content is licensed under a Creative Commons Attribution 4.0 International (CC BY SA 4.0) license.

docs/resources/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2+
"http://www.w3.org/TR/html4/loose.dtd">
3+
4+
<html lang="en">
5+
<head>
6+
<meta http-equiv="refresh" content="0; url=manual/" />
7+
</head>
8+
9+
</body>
10+
</html>
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4+
<head>
5+
<title>${sectionNumber} ${title.encodeAsHtml()} ${version}</title>
6+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7+
<link rel="stylesheet" href="${resourcesPath}/css/main.css" type="text/css" media="screen, print" title="Style" charset="utf-8"/>
8+
<link rel="stylesheet" href="${resourcesPath}/css/pdf.css" type="text/css" media="print" title="PDF" charset="utf-8"/>
9+
<script type="text/javascript">
10+
function addJsClass() {
11+
var classes = document.body.className.split(" ");
12+
classes.push("js");
13+
document.body.className = classes.join(" ");
14+
}
15+
</script>
16+
</head>
17+
18+
<body class="body" onload="addJsClass();">
19+
<div id="navigation">
20+
<div class="navHeader">
21+
<% if (logo) { %>
22+
<span id="logo">${logo}</span>
23+
<% } else { %>
24+
<span id="logo">
25+
<a href="https://graceframework.org" title="Grace Framework Website">
26+
<img src="${resourcesPath}/img/grace.svg" alt="Grace Framework" />
27+
</a>
28+
</span>
29+
<% } %>
30+
<div class="docHeader">
31+
<h1 class="docTitle">${docTitle.encodeAsHtml()}</h1>
32+
<h3 class="docSubTitle">${subtitle.encodeAsHtml()}</h3>
33+
</div>
34+
</div>
35+
<div class="navLinks">
36+
<ul>
37+
<li>
38+
<div id="nav-summary" onmouseover="toggleNavSummary(false)" onmouseout="toggleNavSummary(true)">
39+
<a href="${path}/guide/index.html" class="button">Table of contents</a>
40+
41+
<div id="nav-summary-childs" style="display:none;">
42+
<% toc.children.eachWithIndex { ch, i -> %>
43+
<div class="toc-item" style="margin-left:0"><a href="${path}/guide/${ch.name.encodeAsUrlPath().encodeAsHtml()}.html"><strong>${i + 1}</strong><span>${ch.title.encodeAsHtml()}</span></a>
44+
</div>
45+
<% } %>
46+
</div>
47+
</div>
48+
</li>
49+
<!-- <li class="separator selected">
50+
<a id="ref-button" onclick="localToggle(); return false;" href="#">Quick Reference</a>
51+
</li> -->
52+
<li class="separator selected">
53+
<a id="ref-button" href="${resourcesPath}/api/index.html">API Docs</a>
54+
</li>
55+
</ul>
56+
</div>
57+
58+
59+
</div>
60+
61+
<table id="colset" border="0" cellpadding="0" cellspacing="0">
62+
<tr>
63+
<td id="col1">
64+
<div id="main" class="corner-all">
65+
66+
<% if(prev){ %>
67+
<div class="toc-item prev-left"><a href="${path}/guide/${prev?.name?.encodeAsUrlPath()?.encodeAsHtml()}.html">&lt;&lt; <strong>${chapterNumber - 1}</strong><span>${prev?.title?.encodeAsHtml()}</span></a></div>
68+
<% } %>
69+
70+
<span id='toggle-col1' class="toggle">(<a href="#" onclick="localToggle(); return false;">Quick Reference</a>)</span>
71+
72+
<% if(next){ %>
73+
<div class="toc-item next-right"><a href="${path}/guide/${next?.name?.encodeAsUrlPath()?.encodeAsHtml()}.html"><strong>${chapterNumber + 1}</strong><span>${next?.title?.encodeAsHtml()}</span> >></a></div>
74+
<% } %>
75+
76+
77+
<div class="project">
78+
<h1>${sectionNumber} ${title.encodeAsHtml()}</h1>
79+
80+
<p><strong>Version:</strong> ${version}</p>
81+
</div>
82+
83+
<% if (sectionToc) { %>
84+
<div id="table-of-content">
85+
<h2>Table of Contents</h2>
86+
<%
87+
sectionWriter = { lvl, section, prefix ->
88+
%>
89+
<div class="toc-item" style="margin-left:${lvl * 10}px"><a href="#${ section.name.encodeAsUrlFragment().encodeAsHtml() }"><strong>$prefix</strong><span>${section.title?.encodeAsHtml()}</span></a>
90+
</div>
91+
<%
92+
lvl++
93+
section.children.eachWithIndex { s, j ->
94+
sectionWriter.call(lvl, s, prefix + '.' + (j + 1))
95+
}
96+
}
97+
98+
sectionToc.eachWithIndex { s, i ->
99+
sectionWriter.call(0, s, chapterNumber + '.' + (i + 1))
100+
}
101+
%>
102+
</div>
103+
<% } %>
104+
105+
${content}
106+
107+
<div style="clear:both;margin-top:15px;"></div>
108+
<% if(prev){ %>
109+
<div class="toc-item prev-left"><a href="${path}/guide/${prev?.name?.encodeAsUrlPath()?.encodeAsHtml()}.html">&lt;&lt; <strong>${chapterNumber - 1}</strong><span>${prev?.title?.encodeAsHtml()}</span></a></div>
110+
<% }
111+
if(next){ %>
112+
<div class="toc-item next-right"><a href="${path}/guide/${next?.name?.encodeAsUrlPath()?.encodeAsHtml()}.html"><strong>${chapterNumber + 1}</strong><span>${next?.title?.encodeAsHtml()}</span> >></a></div>
113+
<% } %>
114+
<div style="clear:both"></div>
115+
</div>
116+
</td>
117+
<td id="col2">
118+
<div class="local clearfix">
119+
<div class="local-title">
120+
<a href="${path}/guide/index.html" target="mainFrame">Quick Reference</a>
121+
<span class="toggle">(<a href="#" onclick="localToggle(); return false;">hide</a>)</span>
122+
</div>
123+
<div class="menu">
124+
<% for (cat in refMenu) { %>
125+
<div class="menu-block"><h1 class="menu-title" onclick="toggleRef(this.parentNode.childNodes[1])">${cat.name.encodeAsHtml()}</h1><div class="menu-sub">
126+
<% if (cat.usage.exists()) { %>
127+
<div class="menu-item"><a href="${path}/ref/${cat.name.encodeAsUrlPath().encodeAsHtml()}/Usage.html">Usage</a></div>
128+
<% } %>
129+
<% for (txt in cat.sections) { %>
130+
<div class="menu-item"><a href="${path}/ref/${cat.name.encodeAsUrlPath().encodeAsHtml()}/${txt.name[0..-6].encodeAsUrlPath().encodeAsHtml()}.html">${txt.name[0..-6].encodeAsHtml()}</a>
131+
</div>
132+
<% } %>
133+
</div>
134+
</div>
135+
<% } %>
136+
</div>
137+
</div>
138+
</td>
139+
</tr>
140+
</table>
141+
142+
<div id="footer">
143+
${copyright}
144+
${footer}
145+
</div>
146+
147+
<script type="text/javascript" src="${resourcesPath}/js/docs.js"></script>
148+
149+
</body>
150+
</html>

0 commit comments

Comments
 (0)