Skip to content

Commit 6fe58ee

Browse files
committed
Add documentation: user guide and api docs
Closes gh-1081
1 parent d1a11fb commit 6fe58ee

File tree

16 files changed

+2499
-4
lines changed

16 files changed

+2499
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ subprojects.each {
422422
}
423423

424424
apply {
425-
from 'gradle/docs.gradle' // tasks for building the documentation (e.g. user guide, javadocs)
425+
// from 'gradle/docs.gradle' // tasks for building the documentation (e.g. user guide, javadocs)
426426
from 'gradle/assemble.gradle' // tasks for creating an installation or distribution
427427
from 'gradle/findbugs.gradle'
428428
}

docs/build.gradle

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath "org.graceframework:grace-gradle-plugin:2023.3.0-RC2"
7+
}
8+
}
9+
10+
apply plugin: 'groovy'
11+
apply plugin: 'java-library'
12+
apply plugin: 'org.graceframework.grace-doc'
13+
14+
def DOCUMENTATION_GROUP = 'Documentation'
15+
def groovyVersion = libs.versions.groovy.get()
16+
def springFrameworkVersion = libs.versions.spring.framework.get()
17+
def springBootVersion = libs.versions.spring.boot.get()
18+
19+
repositories {
20+
mavenCentral()
21+
}
22+
23+
configurations {
24+
documentation
25+
}
26+
27+
dependencies {
28+
documentation libs.groovy.ant
29+
documentation libs.groovy.groovydoc
30+
documentation libs.javaparser
31+
documentation libs.spring.core
32+
documentation libs.spring.boot
33+
documentation libs.snakeyaml
34+
}
35+
36+
def cleanTask = project.tasks.findByName('clean')
37+
if (cleanTask == null) {
38+
task clean(type: Delete) {
39+
delete(buildDir)
40+
}
41+
}
42+
else {
43+
cleanTask.doLast {
44+
ant.delete(dir: 'build/docs')
45+
}
46+
}
47+
48+
tasks.withType(Groovydoc) {
49+
group = DOCUMENTATION_GROUP
50+
docTitle = "Grace Framework - ${project.version}"
51+
windowTitle = "Grace Framework - ${project.version}"
52+
footer = ""
53+
destinationDir = project.file('build/docs/manual/api')
54+
def files = []
55+
project.rootProject.subprojects
56+
.findAll { !it.name != 'docs' && !it.name.startsWith('grace-test-suite') }
57+
.each { subproject ->
58+
if(subproject.file('src/main/groovy').exists()) {
59+
files += subproject.files('src/main/groovy')
60+
}
61+
if(subproject.file('src/main/java').exists()) {
62+
files += subproject.files('src/main/java')
63+
}
64+
}
65+
if (project.file('src/main/groovy').exists()) {
66+
files += project.files('src/main/groovy')
67+
}
68+
source = files
69+
classpath += configurations.documentation
70+
71+
link("https://docs.oracle.com/en/java/javase/17/docs/api/", 'java.')
72+
link("https://docs.groovy-lang.org/docs/groovy-${groovyVersion}/html/gapi/", 'groovy.', 'org.codehaus.groovy.', 'org.apache.groovy.')
73+
link("https://docs.spring.io/spring-framework/docs/${springFrameworkVersion}/javadoc-api", 'org.springframework.core.', 'org.springframework.context.', 'org.springframework.beans.')
74+
link("https://docs.spring.io/spring-boot/${springBootVersion[0..2]}/api/java", 'org.springframework.boot.', 'org.springframework.boot.actuate.info.')
75+
}
76+
77+
docs {
78+
dependsOn groovydoc
79+
sourceDir = project.file('src/docs')
80+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Next, let's get started on creating your first project.
2+
3+
[source,console,subs="attributes"]
4+
----
5+
$ sdk use grace {version}
6+
$ grace create-app com.examples.bookstore
7+
----
8+
9+
you will see the new project has been created,
10+
11+
[source,console,subs="attributes"]
12+
----
13+
| Creating a new application
14+
15+
Name: bookstore
16+
Package: com.example
17+
Profile: web
18+
Features: asset-pipeline, async, bootstrap, cache, database-migration, events, fields, geb, gsp, hibernate, jquery, scaffolding
19+
Database: h2
20+
Project root: /Users/grace/bookstore
21+
22+
| Application created by Grace {version}.
23+
----
24+
25+
[source,console]
26+
----
27+
.
28+
├── app
29+
│ ├── assets
30+
│ ├── conf
31+
│ ├── controllers
32+
│ ├── domain
33+
│ ├── i18n
34+
│ ├── init
35+
│ ├── services
36+
│ ├── taglib
37+
│ └── views
38+
├── buildSrc
39+
│ └── build.gradle
40+
├── db
41+
│ └── migrations
42+
├── gradle
43+
│ └── wrapper
44+
├── src
45+
│ ├── integration-test
46+
│ ├── main
47+
│ └── test
48+
├── HELP.md
49+
├── README.md
50+
├── build.gradle
51+
├── gradle.properties
52+
├── gradlew
53+
├── gradlew.bat
54+
└── settings.gradle
55+
----
56+
57+
then we create a domain class `Book`, which has a `name` property,
58+
We use `generate` command to generate all the controller, services, gsp views,
59+
60+
[source,console,subs="attributes"]
61+
----
62+
$ cd blog
63+
$ grace generate scaffold Book name:string
64+
----
65+
66+
Now, let's running the app,
67+
68+
[source,console,subs="attributes"]
69+
----
70+
$ grace run-app
71+
----
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Please follow these instructions in order to complete your installation.
2+
3+
=== Prerequisites
4+
5+
Grace CLI requires Java JDK v17.0 or above in order to run. Groovy v4.0.x is packaged as part of this distribution, and therefore does not need to be installed (any
6+
existing Groovy installation is ignored).
7+
8+
Grace CLI will use whatever JDK it finds on your path, to check that you have an appropriate version you should run:
9+
10+
[source,console]
11+
----
12+
$ java -version
13+
----
14+
15+
Alternatively, you can set the JAVA_HOME environment variable to point a suitable JDK.
16+
17+
=== Environment Variables
18+
19+
No specific environment variables are required to run the CLI, however, you may want to set GRACE_HOME to point to a specific installation. You should also add GRACE_HOME/bin to your PATH environment variable.
20+
21+
=== Checking Your Installation
22+
23+
To test if you have successfully installed the CLI you can run the following command:
24+
25+
[source,console]
26+
----
27+
$ grace -v
28+
----
29+
30+
If you see the output like below, congratulations, you have installed it successfully.
31+
32+
[source,console]
33+
----
34+
------------------------------------------------------------
35+
Grace {version}
36+
------------------------------------------------------------
37+
38+
Build time: 2025-06-22 13:30:19 UTC
39+
Revision: ba9b75634a9c2e79e0612d93df9c9fc81d05dd74
40+
41+
Spring Boot: 3.3.13
42+
Gradle: 8.14.2
43+
Groovy: 4.0.27
44+
JVM: 17.0.15 (BellSoft 17.0.15+10-LTS)
45+
OS: Mac OS X 12.7.6 aarch64
46+
----
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
https://github.com/graceframework/grace-framework[Grace] is a fork of https://github.com/apache/grails-core/tree/5.1.x[Grails 5.1.x] that started development in early 2022, it's a powerful and open-source One-Person web framework used to build enterprise-grade https://spring.io/projects/spring-boot/[Spring Boot] applications with the powerful https://groovy-lang.org/[Groovy] programming language. The core framework is very extensible and there are numerous https://github.com/grace-plugins/[Plugins] available that provide easy integration of add-on features.
3+
4+
=== Why Grace?
5+
6+
Grace inherits the excellent concepts and designs of Grails, and based on this, has undergone significant restructuring to ensure that each module is independent and decoupled, such as Grace API, Grace Boot, Grace CLI, Grace Plugin API, Grace Plugin Core, Grace Spring Boot, Grace Util. Meanwhile, in order to better focus on maintenance and upgrades, Grace also merged the previously spun-off modules, Converters plugin, GSP, Grace Test Support. Grace Boot as an https://graceframework.org/grace-framework/2023.3.x/api/grails/boot/config/GrailsAutoConfiguration.html[Auto-configuration], it will load all other modules and plugins. Grace follows good modular design, and these modules can be used independently in Spring Boot applications.
7+
8+
Spring is the foundation for Grace, which is built on top of Spring Boot. To better support Spring Boot and integrate with other Spring ecosystems, Grace has rewritten `Plugin.doWithSpring()` using Spring Boot's https://docs.spring.io/spring-boot/3.3/reference/using/auto-configuration.html[Auto-configuration], which also reduces redundant configurations and provides significant performance improvements. Grace has also provided https://docs.spring.io/spring-boot/3.3/specification/configuration-metadata/index.html[Configuration Metadata] files include in Grace plugins' jars, the files are designed to let IDE developers offer contextual help and “code completion” as users are working with application.properties or application.yaml files. So, a Grace plugin is an extended Spring Boot Starter.
9+
10+
It is worth mentioning that Grace supports all current versions of Spring Boot, including https://github.com/graceframework/grace-framework/releases/tag/v2022.2.9[2.7], https://github.com/graceframework/grace-framework/releases/tag/v2023.0.3[3.0], https://github.com/graceframework/grace-framework/releases/tag/v2023.1.0[3.1], https://github.com/graceframework/grace-framework/releases/tag/v2023.2.0[3.2], https://github.com/graceframework/grace-framework/releases/tag/v2023.3.0[3.3], https://github.com/graceframework/grace-framework/releases/tag/v2023.3.0[3.4], and https://github.com/graceframework/grace-framework/releases/tag/v2023.3.0[3.5]. This makes the upgrade path easier and more manageable.
11+
12+
Grace has been actively developing, bringing numerous improvements and new features, including Plugins, GSP, Console, Shell, and https://github.com/grace-profiles[Profiles]. Of course, it has also fixed a large number of legacy defects left in Grails 5, this makes developers happy.
13+
14+
You can learn more on the page https://github.com/graceframework/grace-framework/wiki/What's-New-in-Grace-Framework[What's New in Grace Framework].
15+
16+
=== Grace vs Spring Boot
17+
18+
Grace and Spring Boot frameworks are excellent for building web applications, but their use depends on what you want. Generally, Grace framework may be advantageous in full-stack and monolithic applications, but Spring Boot is preferred for developing complex and microservice applications.
19+
20+
Grace is not a replacement for Spring Boot, it is built on top of Spring Boot. It provides its' own https://docs.spring.io/spring-boot/3.3/reference/features/developing-auto-configuration.html#features.developing-auto-configuration.custom-starter[Spring Boot Starters] - Grace Boot as an AutoConfiguration, it will load all other modules and plugins. Grace follows good modular design, and these modules can be used independently in Spring Boot applications. So, a Grace application is really a Spring Boot application.
21+
22+
Grace has better developer productivity than Spring Boot. Because it follows the convention over the configuration principle, it minimizes code requirements. This enhances productivity and fosters faster app development. The framework creates faster and more functional prototypes than Spring Boot due to its simple code generation like scaffolding and CoC.
23+
24+
Grace has better support Groovy than Spring Boot. Grace fully embraces Groovy to enable many features that would not be possible using Java alone, including flexible and powerful Plug-in architecture and a rich https://github.com/grace-plugins[Plugin ecosystem] and many built-in https://github.com/grace-plugins/grace-dynamic-modules[Dynamic Module types], many https://docs.groovy-lang.org/latest/html/documentation/#_domain_specific_languages[DSLs], https://docs.groovy-lang.org/latest/html/documentation/#_available_ast_transformations[AST Transformations], https://docs.groovy-lang.org/latest/html/documentation/#_traits[Trait]-based solutions, and much more.
25+
26+
Grace provides a powerful CLI that allows you to quickly create new projects of many different types using https://github.com/grace-profiles[Application Profiles] and https://github.com/grace-templates[Templates] and get started easily. These are all extensible and easy to customize, you can create your own Profiles, Templates, and Commands to meet any of your needs. The learning curve for Grace is moderate and more straightforward than Spring Boot due to its emphasis on convention and simplicity.
27+
28+
You can learn more on the page https://github.com/graceframework/grace-framework/wiki/Grace-vs-Spring-Boot[Grace vs Spring Boot].

docs/src/docs/guide/releases.adoc

Whitespace-only changes.

0 commit comments

Comments
 (0)