Fixes tests and copies jar after build (for nixpacks).
This commit is contained in:
parent
98fb2948fc
commit
fe6c801ec6
6 changed files with 33 additions and 14 deletions
|
@ -67,3 +67,16 @@ sqldelight {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nixpacks looks in build/libs
|
||||||
|
tasks.register<Copy>("copyJarToRoot") {
|
||||||
|
println("copy bopy")
|
||||||
|
from("build/libs")
|
||||||
|
into("../build/libs")
|
||||||
|
include("*.jar")
|
||||||
|
dependsOn(":app:build")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.build {
|
||||||
|
finalizedBy("copyJarToRoot")
|
||||||
|
}
|
||||||
|
|
|
@ -36,32 +36,32 @@ object DateGuesser {
|
||||||
Regex("\\d{4}-\\d{2}-\\d{2}") to DateTimeFormatter.ofPattern("yyyy-MM-dd"),
|
Regex("\\d{4}-\\d{2}-\\d{2}") to DateTimeFormatter.ofPattern("yyyy-MM-dd"),
|
||||||
Regex("\\d{4}_\\d{2}_\\d{2}") to DateTimeFormatter.ofPattern("yyyy_MM_dd"),
|
Regex("\\d{4}_\\d{2}_\\d{2}") to DateTimeFormatter.ofPattern("yyyy_MM_dd"),
|
||||||
Regex("\\d{4}\\d{2}\\d{2}") to DateTimeFormatter.ofPattern("yyyyMMdd"),
|
Regex("\\d{4}\\d{2}\\d{2}") to DateTimeFormatter.ofPattern("yyyyMMdd"),
|
||||||
Regex("\\d{2}.\\d{2}.\\d{4}") to DateTimeFormatter.ofPattern("dd.MM.YYYY"),
|
Regex("\\d{2}\\.\\d{2}\\.\\d{4}") to DateTimeFormatter.ofPattern("dd.MM.YYYY"),
|
||||||
Regex("\\d{2}.\\d{2}.\\d{2}") to DateTimeFormatter.ofPattern("dd.MM.yy"),
|
Regex("\\d{2}\\.\\d{2}\\.\\d{2}") to DateTimeFormatter.ofPattern("dd.MM.yy"),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun guessDateTime(filename: String) = dateTimePatterns.asSequence().map {
|
private fun guessDateTime(filename: String) = dateTimePatterns.asSequence().mapNotNull { rxPattern ->
|
||||||
it.first.findAll(filename).mapNotNull { mr ->
|
rxPattern.first.findAll(filename).mapNotNull { mr ->
|
||||||
try {
|
try {
|
||||||
LocalDateTime.parse(mr.groups[0]?.value!!, it.second)
|
LocalDateTime.parse(mr.groups[0]?.value!!, rxPattern.second)
|
||||||
} catch (e: DateTimeParseException) {
|
} catch (_: DateTimeParseException) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.firstOrNull()
|
}.firstOrNull()
|
||||||
}.firstOrNull()
|
}.firstOrNull()
|
||||||
|
|
||||||
private fun guessDate(filename: String) = datePatterns.asSequence().map {
|
private fun guessDate(filename: String) = datePatterns.asSequence().mapNotNull { rxPattern ->
|
||||||
it.first.findAll(filename).mapNotNull { mr ->
|
rxPattern.first.findAll(filename).mapNotNull { mr ->
|
||||||
try {
|
try {
|
||||||
LocalDate.parse(mr.groups[0]?.value!!, it.second)
|
LocalDate.parse(mr.groups[0]?.value!!, rxPattern.second)
|
||||||
} catch (e: DateTimeParseException) {
|
} catch (_: DateTimeParseException) {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
}.firstOrNull()
|
}.firstOrNull()
|
||||||
}.firstOrNull()
|
}.firstOrNull()
|
||||||
|
|
||||||
fun guess(filename: String): LocalDateTime? {
|
fun guess(filename: String): LocalDateTime? {
|
||||||
return guessDateTime(filename) ?: guessDate(filename)?.atTime(0, 0)
|
return guessDateTime(filename) ?: (guessDate(filename)?.atTime(0, 0))
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,7 +31,7 @@ class DocumentController(val modifiers: TemplateModifiers, val repository: Sqlit
|
||||||
extId = document.extId.value,
|
extId = document.extId.value,
|
||||||
referenceDate = document.referenceDate.formatHumanLong(),
|
referenceDate = document.referenceDate.formatHumanLong(),
|
||||||
tags = { document.tags.map { TagsBlock(tag = it.value) }.asSequence() },
|
tags = { document.tags.map { TagsBlock(tag = it.value) }.asSequence() },
|
||||||
description = document.description.ifBlank { "-" },
|
description = document.description.ifBlank { "" },
|
||||||
files = FileList(
|
files = FileList(
|
||||||
modifiers = modifiers,
|
modifiers = modifiers,
|
||||||
delete = true,
|
delete = true,
|
||||||
|
|
|
@ -12,7 +12,11 @@
|
||||||
<div class="space"></div>
|
<div class="space"></div>
|
||||||
|
|
||||||
<b>Description</b>
|
<b>Description</b>
|
||||||
|
{if $description}
|
||||||
<pre>{$description|html}</pre>
|
<pre>{$description|html}</pre>
|
||||||
|
{else}
|
||||||
|
<p>-</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,11 @@ class DateGuesserTest {
|
||||||
fun test_date() {
|
fun test_date() {
|
||||||
val values = listOf(
|
val values = listOf(
|
||||||
"2023-10-05T00:00" to "20231005_Form.pdf",
|
"2023-10-05T00:00" to "20231005_Form.pdf",
|
||||||
"2023-10-05T10:15" to "File-20231005-101500_Form.pdf",
|
"2023-10-05T00:00" to "File-20231005_Form.pdf",
|
||||||
"2023-10-05T00:00" to "File-2023-10-05_Form.pdf",
|
"2023-10-05T00:00" to "File-2023-10-05_Form.pdf",
|
||||||
"2023-10-05T00:00" to "File-2023_10_05_Form.pdf",
|
"2023-10-05T00:00" to "File-2023_10_05_Form.pdf",
|
||||||
"2023-10-05T00:00" to "File-2023_10_05.pdf",
|
"2023-10-05T00:00" to "File-2023_10_05.pdf",
|
||||||
|
"2023-10-05T10:15" to "File-20231005-101500_Form.pdf",
|
||||||
"2023-10-05T11:22:33" to "File.20231005-112233.pdf",
|
"2023-10-05T11:22:33" to "File.20231005-112233.pdf",
|
||||||
"2022-11-11T00:00:00" to "File.20221111000000.pdf",
|
"2022-11-11T00:00:00" to "File.20221111000000.pdf",
|
||||||
"8888-11-11T00:00:00" to "File.88881111000000.pdf",
|
"8888-11-11T00:00:00" to "File.88881111000000.pdf",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
org.gradle.java.home=C:/Users/stefa/.jdks/temurin-21.0.5
|
||||||
# Enable the build cache to save time by reusing outputs produced by other successful builds.
|
# Enable the build cache to save time by reusing outputs produced by other successful builds.
|
||||||
# https://docs.gradle.org/current/userguide/build_cache.html
|
# https://docs.gradle.org/current/userguide/build_cache.html
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
|
Loading…
Reference in a new issue