|
1 | | -# grails-spring-restdocs-example |
2 | | -Example of using Spring REST Docs with Grails |
| 1 | +# rest-notes-grails |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This is a sample project using Grails 3, Spock, and Spring REST docs. For more |
| 6 | +information about the Grails framework please see [grails.org](http://grails.org). |
| 7 | + |
| 8 | +Grails is built on top of Spring Boot and Gradle so there are a few different ways to |
| 9 | +run this project including: |
| 10 | + |
| 11 | +### Gradle Wrapper (recommended) |
| 12 | + |
| 13 | +The gradle wrapper allows a project to build without having Gradle installed locally. The |
| 14 | +executable file will acquire the version of Gradle and other dependencies recommended for |
| 15 | +this project. This is especially important since some versions of Gradle may cause |
| 16 | +conflicts with this project. |
| 17 | + |
| 18 | +On Unix-like platforms, such as Linux and Mac OS X: |
| 19 | + |
| 20 | +``` |
| 21 | +$ ./gradlew run |
| 22 | +``` |
| 23 | + |
| 24 | +On Windows: |
| 25 | + |
| 26 | +``` |
| 27 | +$ gradlew run |
| 28 | +``` |
| 29 | + |
| 30 | +*Please note*, if you are including integration tests in Grails, they will not run as |
| 31 | +part of the `gradle test` task. Run them via the build task or individually as |
| 32 | +`gradle integrationTest` |
| 33 | + |
| 34 | +### Gradle Command Line |
| 35 | + |
| 36 | +Clean the project: |
| 37 | + |
| 38 | +``` |
| 39 | +$ gradle clean |
| 40 | +``` |
| 41 | + |
| 42 | +Build the project: |
| 43 | + |
| 44 | +``` |
| 45 | +$ gradle build |
| 46 | +``` |
| 47 | + |
| 48 | +Run the project: |
| 49 | + |
| 50 | +``` |
| 51 | +$ gradle run |
| 52 | +``` |
| 53 | + |
| 54 | +### Grails Command Line |
| 55 | + |
| 56 | +Grails applications also have a command line feature useful for code generation and |
| 57 | +running projects locally. The command line is accessible by typing `grails` in the |
| 58 | +terminal at the root of the project. Please ensure you are running the correct version |
| 59 | +of Grails as specified in [gradle.properties](gradle.properties) |
| 60 | + |
| 61 | +Similar to `gradle clean`, this task destroys the `build` directory and cached assets. |
| 62 | + |
| 63 | +``` |
| 64 | +grails> clean |
| 65 | +``` |
| 66 | + |
| 67 | +The 'test-app' task runs all of the tests for the project. |
| 68 | + |
| 69 | +``` |
| 70 | +grails> test-app |
| 71 | +``` |
| 72 | + |
| 73 | +The `run-app` task is used to run the application locally. By default, the project is |
| 74 | +run in development mode including automatic reloading and not caching static assets. It |
| 75 | +is not suggested to use this in production. |
| 76 | + |
| 77 | +``` |
| 78 | +grails> run-app |
| 79 | +``` |
| 80 | + |
| 81 | +### Building and Viewing the Docs |
| 82 | + |
| 83 | +This is an example of the Grails API profile. Therefore, there is no view layer to |
| 84 | +return the docs as static assets. The result of running `asciidoctor` or `build` is that |
| 85 | +the docs are sent to `/build/asciidoc/`. You can then publish them to a destination of |
| 86 | +your choosing using the [gradle github-pages](https://github.com/ajoberstar/gradle-git) |
| 87 | +plugin or similar. |
| 88 | + |
| 89 | +To just generate documentation and not run the application use: |
| 90 | + |
| 91 | +``` |
| 92 | +$ ./gradlew asciidoctor |
| 93 | +``` |
0 commit comments