Skip to content

Commit 7f5e87f

Browse files
authored
Merge pull request #53 from TheProgramSrc/feat/simplecoreapi-0.8.0
feat: comply with SimpleCoreAPI v0.8.0
2 parents fb0263a + 949ba5c commit 7f5e87f

File tree

11 files changed

+91
-123
lines changed

11 files changed

+91
-123
lines changed

build.gradle.kts

+11-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ val env = project.rootProject.file(".env").let { file ->
1515
if(file.exists()) file.readLines().filter { it.isNotBlank() && !it.startsWith("#") && it.split("=").size == 2 }.associate { it.split("=")[0] to it.split("=")[1] } else emptyMap()
1616
}.toMutableMap().apply { putAll(System.getenv()) }
1717

18-
val projectVersion = env["VERSION"] ?: "0.3.0-SNAPSHOT"
18+
val projectVersion = env["VERSION"] ?: "0.4.0-SNAPSHOT"
1919

2020
group = "xyz.theprogramsrc"
2121
version = projectVersion
@@ -33,7 +33,7 @@ repositories {
3333
}
3434

3535
dependencies {
36-
compileOnly("xyz.theprogramsrc:simplecoreapi:0.6.2-SNAPSHOT")
36+
compileOnly("xyz.theprogramsrc:simplecoreapi:0.8.0-SNAPSHOT")
3737

3838
implementation("me.carleslc.Simple-YAML:Simple-Yaml:1.8.4")
3939

@@ -171,14 +171,16 @@ publishing {
171171
}
172172
}
173173

174-
nexusPublishing {
175-
repositories {
176-
sonatype {
177-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
178-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
174+
if(env["ENV"] == "prod") {
175+
nexusPublishing {
176+
repositories {
177+
sonatype {
178+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
179+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
179180

180-
username.set(env["SONATYPE_USERNAME"])
181-
password.set(env["SONATYPE_PASSWORD"])
181+
username.set(env["SONATYPE_USERNAME"])
182+
password.set(env["SONATYPE_PASSWORD"])
183+
}
182184
}
183185
}
184186
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package xyz.theprogramsrc.filesmodule
2+
3+
import xyz.theprogramsrc.simplecoreapi.global.models.module.Module
4+
import xyz.theprogramsrc.simplecoreapi.global.models.module.ModuleDescription
5+
6+
class FilesModule: Module {
7+
8+
override val description: ModuleDescription =
9+
ModuleDescription(
10+
name = "@name@",
11+
version = "@version@",
12+
authors = listOf("Im-Fran")
13+
)
14+
15+
override fun onDisable() {
16+
TODO("Not yet implemented")
17+
}
18+
19+
override fun onEnable() {
20+
TODO("Not yet implemented")
21+
}
22+
}

src/main/kotlin/xyz/theprogramsrc/filesmodule/Main.kt

-5
This file was deleted.

src/main/kotlin/xyz/theprogramsrc/filesmodule/config/JsonConfig.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package xyz.theprogramsrc.filesmodule.config
22

33
import com.google.gson.*
4-
import xyz.theprogramsrc.filesmodule.utils.file
4+
import xyz.theprogramsrc.simplecoreapi.global.utils.extensions.file
55
import java.io.File
66

77
/**

src/main/kotlin/xyz/theprogramsrc/filesmodule/config/PropertiesConfig.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package xyz.theprogramsrc.filesmodule.config
22

3-
import xyz.theprogramsrc.filesmodule.utils.file
3+
import xyz.theprogramsrc.simplecoreapi.global.utils.extensions.file
44
import java.io.File
55
import java.util.*
66

src/main/kotlin/xyz/theprogramsrc/filesmodule/config/YmlConfig.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package xyz.theprogramsrc.filesmodule.config
22

33
import org.simpleyaml.configuration.ConfigurationSection
44
import org.simpleyaml.configuration.file.YamlConfiguration
5-
import xyz.theprogramsrc.filesmodule.utils.file
5+
import xyz.theprogramsrc.simplecoreapi.global.utils.extensions.file
66
import java.io.File
77

88
/**

src/main/kotlin/xyz/theprogramsrc/filesmodule/utils/FileUtils.kt

-52
This file was deleted.

src/main/resources/module.properties

-6
This file was deleted.

src/test/kotlin/xyz/theprogramsrc/filesmodule/config/JsonConfigTest.kt

+18-16
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ import java.io.File
88

99
internal class JsonConfigTest {
1010

11-
companion object {
12-
private val config = JsonConfig(File("test.json"))
13-
14-
@BeforeAll
15-
fun setUp() {
16-
config.destroy()
17-
config.load()
18-
}
19-
20-
@AfterAll
21-
fun tearDown() {
22-
config.destroy()
23-
}
24-
25-
}
26-
2711
@Test
2812
fun has() {
2913
assertFalse(config.has("test"))
@@ -81,4 +65,22 @@ internal class JsonConfigTest {
8165
assertEquals(3 as Number, config.getNumber("addNumber"))
8266
config.remove("addNumber")
8367
}
68+
69+
companion object {
70+
private val config = JsonConfig(File("test.json"))
71+
72+
@JvmStatic
73+
@BeforeAll
74+
fun setUp() {
75+
config.destroy()
76+
config.load()
77+
}
78+
79+
@JvmStatic
80+
@AfterAll
81+
fun tearDown() {
82+
config.destroy()
83+
}
84+
85+
}
8486
}

src/test/kotlin/xyz/theprogramsrc/filesmodule/config/PropertiesConfigTest.kt

+19-16
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ import java.io.File
88

99
internal class PropertiesConfigTest {
1010

11-
companion object {
12-
private val config = PropertiesConfig(File("test.properties"))
13-
14-
@BeforeAll
15-
fun setUp() {
16-
config.destroy()
17-
config.load()
18-
}
19-
20-
@AfterAll
21-
fun tearDown() {
22-
config.destroy()
23-
}
24-
25-
}
26-
2711
@Test
2812
fun has() {
2913
assertFalse(config.has("test"))
@@ -56,4 +40,23 @@ internal class PropertiesConfigTest {
5640
assertNull(config.get("test"))
5741
assertFalse(config.has("test"))
5842
}
43+
44+
companion object {
45+
private val config = PropertiesConfig(File("test.properties"))
46+
47+
@JvmStatic
48+
@BeforeAll
49+
fun setUp() {
50+
config.destroy()
51+
config.load()
52+
}
53+
54+
@JvmStatic
55+
@AfterAll
56+
fun tearDown() {
57+
config.destroy()
58+
}
59+
60+
}
61+
5962
}

src/test/kotlin/xyz/theprogramsrc/filesmodule/config/YmlConfigTest.kt

+18-16
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@ import java.io.File
88

99
internal class YmlConfigTest {
1010

11-
companion object {
12-
private val config = YmlConfig(File("test.yml"))
13-
14-
@BeforeAll
15-
fun setUp() {
16-
config.destroy()
17-
config.load()
18-
}
19-
20-
@AfterAll
21-
fun tearDown() {
22-
config.destroy()
23-
}
24-
25-
}
26-
2711
@Test
2812
fun hasAndSet() {
2913
assertFalse(config.has("test"))
@@ -71,4 +55,22 @@ internal class YmlConfigTest {
7155
assertTrue(config.has("test"))
7256
config.remove("test")
7357
}
58+
59+
companion object {
60+
private val config = YmlConfig(File("test.yml"))
61+
62+
@JvmStatic
63+
@BeforeAll
64+
fun setUp() {
65+
config.destroy()
66+
config.load()
67+
}
68+
69+
@JvmStatic
70+
@AfterAll
71+
fun tearDown() {
72+
config.destroy()
73+
}
74+
75+
}
7476
}

0 commit comments

Comments
 (0)