diff --git a/.github/workflows/work-jar.yml b/.github/workflows/work-jar.yml index bdb8441..eb4415e 100644 --- a/.github/workflows/work-jar.yml +++ b/.github/workflows/work-jar.yml @@ -4,6 +4,7 @@ on: branches: - main - feature/hook + - patch/groovy permissions: contents: write pages: write diff --git a/.gitignore b/.gitignore index b63da45..2e49d16 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ +src/main/resources/infos.yml + ### IntelliJ IDEA ### .idea/modules.xml .idea/jarRepositories.xml diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..30bab2a --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..9103d87 --- /dev/null +++ b/build.gradle @@ -0,0 +1,97 @@ +plugins { + id 'java' + id 'application' + id 'maven-publish' // Plugin pour la publication +} + +group = 'fr.sandro642.github' +version = '0.1.7.0-SNAPSHOT' // Version de votre projet + +// Ajoutez cette tâche à votre build.gradle +tasks.register('printVersion') { + doLast { + println project.version + } +} + +repositories { + mavenCentral() + + maven { + url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' + } + maven { + url 'https://oss.sonatype.org/content/repositories/snapshots/' + } +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' + + implementation 'io.projectreactor:reactor-core:3.6.9' + implementation 'org.springframework.boot:spring-boot-starter-webflux:3.2.2' + + compileOnly 'org.spigotmc:spigot-api:1.8-R0.1-SNAPSHOT' +} + +application { + mainClass = 'fr.sandro642.github.ConnectorAPI' +} + +tasks.jar { + manifest { + attributes 'Main-Class': 'fr.sandro642.github.ConnectorAPI' + } + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +tasks.test { + useJUnitPlatform() +} + +java { + withSourcesJar() // Ajoute le JAR des sources + withJavadocJar() // Ajoute le JAR de Javadoc +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + + groupId = project.group.toString() + artifactId = 'ConnectorAPI' + version = project.version.toString() + pom { + name = 'ConnectorAPI' + description = 'A library for connecting to APIs' + url = 'https://sandro642.github.io/connectorapi' + licenses { + license { + name = 'The MIT License, Version 2.0' + url = 'https://github.com/Sandro642/ConnectorAPI/blob/patch/groovy/LICENSE' + } + } + developers { + developer { + id = 'sandro642' + name = 'Sandro' + email = 'sandro33810@gmail.com' // Correction de l'email (point-virgule -> point) + } + } + scm { + connection = 'scm:git:git://github.com/sandro642/ConnectorAPI.git' + developerConnection = 'scm:git:ssh://github.com/sandro642/ConnectorAPI.git' + url = 'https://github.com/sandro642/ConnectorAPI' + } + } + } + } + repositories { + maven { + name = 'LocalRepo' + url = uri(layout.buildDirectory.dir('repo')) // Publie dans build/repo + } + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index b736ade..0000000 --- a/build.gradle.kts +++ /dev/null @@ -1,104 +0,0 @@ -plugins { - id("java") - application - id("org.openjfx.javafxplugin") version "0.0.13" - id("maven-publish") // Plugin pour la publication -} - - -group = "fr.sandro642.github" -version = "0.1.7-STABLE" // Version de votre projet - - -// Ajoutez cette tâche à votre build.gradle.kts -tasks.register("printVersion") { - doLast { - println(project.version) - } -} - -repositories { - mavenCentral() - - maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") - maven("https://oss.sonatype.org/content/repositories/snapshots/") -} - -dependencies { - testImplementation(platform("org.junit:junit-bom:5.10.0")) - testImplementation("org.junit.jupiter:junit-jupiter") - - implementation("io.projectreactor:reactor-core:3.6.9") - implementation("org.springframework.boot:spring-boot-starter-webflux:3.2.2") - - implementation("org.openjfx:javafx-controls:21") - implementation("org.openjfx:javafx-fxml:21") - - compileOnly("org.spigotmc:spigot-api:1.8-R0.1-SNAPSHOT") -} - -javafx { - version = "21" - modules = listOf("javafx.controls", "javafx.fxml") -} - -application { - mainClass.set("fr.sandro642.github.ConnectorAPI") -} - -tasks.jar { - manifest { - attributes["Main-Class"] = "fr.sandro642.github.ConnectorAPI" - } - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -tasks.test { - useJUnitPlatform() -} - -java { - withSourcesJar() // Ajoute le JAR des sources - withJavadocJar() // Ajoute le JAR de Javadoc -} - -publishing { - publications { - register("mavenJava") { - from(components["java"]) - - groupId = project.group.toString() - artifactId = "ConnectorAPI" - version = project.version.toString() - pom { - name.set("ConnectorAPI") - description.set("A library for connecting to APIs") - url.set("https://sandro642.github.io/connectorapi") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") - } - } - developers { - developer { - id.set("sandro642") - name.set("Sandro") - email.set("sandro33810@gmail.com") // Correction de l'email (point-virgule -> point) - } - } - scm { - connection.set("scm:git:git://github.com/sandro642/ConnectorAPI.git") - developerConnection.set("scm:git:ssh://github.com/sandro642/ConnectorAPI.git") - url.set("https://github.com/sandro642/ConnectorAPI") - } - } - } - } - repositories { - maven { - name = "LocalRepo" - url = uri(layout.buildDirectory.dir("repo")) // Publie dans build/repo - } - } -} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e583..9bbc975 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7f69a71..37f853b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Mon Jun 30 15:08:50 CEST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 index 1b6c787..faf9300 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +133,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +200,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +216,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +27,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +78,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..6457506 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ConnectorAPI' \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index 5dc4d28..0000000 --- a/settings.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = "ConnectorAPI" \ No newline at end of file diff --git a/src/test/java/fr/sandro642/github/test/Main.java b/src/test/java/fr/sandro642/github/test/Main.java index d83d6a6..7796031 100644 --- a/src/test/java/fr/sandro642/github/test/Main.java +++ b/src/test/java/fr/sandro642/github/test/Main.java @@ -29,7 +29,7 @@ public static void main(String[] args) { try { // Exemple d'utilisation comme demandé ApiResponse response = ConnectorAPI.JobGetInfos() - .getRoutes(VersionType.V1_BRANCH, MethodType.GET, "info") + .getRoutes(VersionType.V1_BRANCH, MethodType.GET, "version") .getResponse(); System.out.println("Data: " + response.getData()); @@ -40,7 +40,7 @@ public static void main(String[] args) { System.out.println(response.display()); try { - System.out.println("Valeur spécifique: " + response.getSpecData("version")); + System.out.println("Valeur spécifique: " + response.getSpecDataString("version")); } catch (Exception e) { System.out.println("Clé 'version' non trouvée dans les données"); }