Skip to content

Commit 5ef69a1

Browse files
Merge pull request #2 from ChillyCheesy/update/documentation
Update/documentation
2 parents 072c861 + 84fb758 commit 5ef69a1

File tree

5 files changed

+73
-19
lines changed

5 files changed

+73
-19
lines changed

README.md

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
# Modulo Application Plugin
1+
<div align="center">
22

3+
# Modulo Application Plugin
34
![Release App](https://github.com/ChillyCheesy/ModuloGradleApplication/actions/workflows/release-app.yml/badge.svg?branch=master)
5+
[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/com.chillycheesy.modulo-application)](https://plugins.gradle.org/plugin/com.chillycheesy.modulo-application)
6+
7+
</div>
8+
9+
---
410

511
## Overview.
612
The HomeTracker Application Plugin give help to deploy HomeTracker's modules.
@@ -16,14 +22,16 @@ The HomeTracker Application Plugin give help to deploy HomeTracker's modules.
1622
* [module](#closures-module)
1723
* [Tasks section](#tasks)
1824
* [generateModuleYml](#tasks-generateModuleYml)
25+
* [runModuloServer](#tasks-runModuloServer)
26+
* [deployModuleToLocalModuloServer](#tasks-deployModuleToLocalModuloServer)
1927

2028
## Getting Started Using the Plugin. <a id="start"></a>
2129
### *Step 1: Apply the plugin to your Gradle build script.* <a id="start-1"></a>
2230
To apply the plugin, please add this following part of code.
2331

2432
```groovy
2533
plugins {
26-
id 'com.chillycheesy.modulo-application' version '0.0.3'
34+
id 'com.chillycheesy.modulo-application' version '1.1.0'
2735
}
2836
2937
group 'your.group'
@@ -50,8 +58,7 @@ $> ./gradlew build
5058
```
5159

5260
### *Step 4: Use your module.* <a id="start-4"></a>
53-
Take the built module and put it in the *modules* file of your Modulo server.
54-
61+
Take the built module and put it in the *modules* file of your Modulo server.
5562
> Enjoy 🍻 🌶🧀
5663
5764
## Plugins Documentation. <a id="doc"></a>
@@ -83,18 +90,32 @@ The following array was the exhaustive list of **module**'s parameters.
8390

8491
| Key | Description | Equivalent of YAML | Default value |
8592
|:----------------:|:---------------------------------------------------------|:------------------:|-----------------------------------------------:|
86-
| moduleName | Module name. | name | Your Gradle project name. |
87-
| version | Module version. | version | Your Gradle project version. |
88-
| authors | Module authors. | authors | ['ChillyCheesy'] |
89-
| main | Module main. | main | Concat the project group and the project name. |
90-
| mainPageName | Module main page name. | mainPageName | 'index' |
91-
| dependencies | Module dependencies. | dependencies | Empty list. |
92-
| softDependencies | Module soft dependencies. | softDependencies | Empty list. |
93-
| target | The output folder for the generated **module.yml** file. | none | 'src/main/resources' |
93+
| moduleName | Module name. | name | Your Gradle project name. |
94+
| version | Module version. | version | Your Gradle project version. |
95+
| authors | Module authors. | authors | ['ChillyCheesy'] |
96+
| main | Module main. | main | Concat the project group and the project name. |
97+
| mainPageName | Module main page name. | mainPageName | 'index' |
98+
| dependencies | Module dependencies. | dependencies | Empty list. |
99+
| softDependencies | Module soft dependencies. | softDependencies | Empty list. |
100+
| target | The output folder for the generated **module.yml** file. | none | 'src/main/resources' |
101+
| moduloVersion | The target version for the modulo server. | none | 'BINKS-0.1.1' |
102+
94103

95104

96105
## Tasks section. <a id="tasks"></a>
97106
### generateModuleYml. <a id="tasks-generateModuleYml"></a>
98-
This task generate the **module.yml** file.
107+
This task generate the **module.yml** file.
108+
If you run the processResources task. It will automatically call the generateModuleYml task.
109+
The processResources task depends on the generateModuleYml task.
110+
111+
112+
### runModuloServer. <a id="tasks-runModuloServer"></a>
113+
This task run a modulo server. The version of the modulo server is defined by the **moduloVersion** parameter.
114+
*[(See moduloVersion closure for more information.)](#closures-module)*
115+
The server name is automatically downloaded and placed in the ```modulo-server``` folder at the root of your project.
116+
The runModuloServer task depends on the deployModuleToLocalModuloServer task.
117+
118+
### deployModuleToLocalModuloServer. <a id="tasks-deployModuleToLocalModuloServer"></a>
119+
This task build your module and copy it on the ```modulo-server/modules``` folder at the root of your project.
99120

100121
🌶🧀

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
id 'maven-publish'
66
}
77

8-
version = '1.0.0'
8+
version = '1.1.0'
99
group = 'com.chillycheesy'
1010

1111
repositories {

src/main/groovy/com/chillycheesy/modulo/extensions/ModuleExtension.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ModuleExtension {
4242
/**
4343
* Modulo api version.
4444
*/
45-
String moduloVersion = 'BINKS-0.1.0'
45+
String moduloVersion = 'BINKS-0.1.1'
4646

4747
/**
4848
* Init the extension with default values.

src/main/groovy/com/chillycheesy/modulo/tasks/DeployModuleTask.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@ package com.chillycheesy.modulo.tasks
22

33
import org.gradle.api.Project
44

5+
/**
6+
* Define deployModuleToLocalModuloServer Task.
7+
* This task build your module and copy it on the ```modulo-server/modules``` folder at the root of your project.
8+
*/
59
class DeployModuleTask implements ModuloTask {
610

11+
/**
12+
* Create the task.
13+
* @param project Target project.
14+
* @return The new task
15+
*/
716
@Override
817
def generate(Project project) {
918
return project.task('deployModuleToLocalModuloServer') {
1019
group = 'modulo'
1120
description = 'Deploy the module to the local modulo server module file.'
1221
doLast {
1322
final moduleSrc = project.fileTree("$project.buildDir/libs")
14-
final moduleDest = project.file('modulo/modules')
23+
final moduleDest = project.file('modulo-server/modules')
1524
assert moduleDest.exists() || moduleDest.mkdirs()
1625
project.copy {
1726
from moduleSrc

src/main/groovy/com/chillycheesy/modulo/tasks/RunModuloServer.groovy

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,43 @@ package com.chillycheesy.modulo.tasks
33
import com.chillycheesy.modulo.extensions.ModuleExtension
44
import org.gradle.api.Project
55

6+
/**
7+
* Define the runModuloServer task.
8+
* This task download and run a modulo server.
9+
* The server is downloaded from the official repository at the <code>modulo-server</code> folder.
10+
*/
611
class RunModuloServer implements ModuloTask {
712

13+
/**
14+
* Official repository url.
15+
*/
816
private final def LINK = 'https://s01.oss.sonatype.org/content/repositories/releases/com/chillycheesy/modulo-server'
917

18+
/**
19+
* The ModuleExtension store plugin.yml data and other information.
20+
*/
1021
private ModuleExtension moduleExtension
1122

23+
/**
24+
* Create the task.
25+
* @param moduleExtension The module extension who store plugin.yml data and other information.
26+
*/
1227
RunModuloServer(ModuleExtension moduleExtension) {
1328
this.moduleExtension = moduleExtension
1429
}
1530

31+
/**
32+
* Create the task.
33+
* @param project Target project.
34+
* @return The new task
35+
*/
1636
@Override
1737
def generate(Project project) {
1838
return project.task('runModuloServer') {
1939
group = 'modulo'
20-
description = 'Run the Modulo server.'
40+
description = 'Run a Modulo server.'
2141
doLast {
22-
final file = new File("${project.rootDir.path}/modulo/modulo-server-${moduleExtension.moduloVersion}.jar")
42+
final file = new File("${project.rootDir.path}/modulo-server/modulo-server-${moduleExtension.moduloVersion}.jar")
2343
assert file.parentFile.exists() || file.parentFile.mkdirs()
2444
project.delete(project.fileTree(file.parent) {
2545
include '*.jar'
@@ -36,7 +56,11 @@ class RunModuloServer implements ModuloTask {
3656
}
3757
}
3858

39-
private def downloadFile(File file) {
59+
/**
60+
* Download the modulo server jar file.
61+
* @param file The file to download.
62+
*/
63+
private downloadFile(File file) {
4064
def url = "$LINK/${moduleExtension.moduloVersion}/${file.getName()}"
4165
println "Downloading ${url} to ${file.getPath()}..."
4266
new URL(url).openConnection().with { connection ->

0 commit comments

Comments
 (0)