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("yyyyMMdd"),
|
||||
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{4}") to DateTimeFormatter.ofPattern("dd.MM.YYYY"),
|
||||
Regex("\\d{2}\\.\\d{2}\\.\\d{2}") to DateTimeFormatter.ofPattern("dd.MM.yy"),
|
||||
|
||||
)
|
||||
|
||||
private fun guessDateTime(filename: String) = dateTimePatterns.asSequence().map {
|
||||
it.first.findAll(filename).mapNotNull { mr ->
|
||||
private fun guessDateTime(filename: String) = dateTimePatterns.asSequence().mapNotNull { rxPattern ->
|
||||
rxPattern.first.findAll(filename).mapNotNull { mr ->
|
||||
try {
|
||||
LocalDateTime.parse(mr.groups[0]?.value!!, it.second)
|
||||
} catch (e: DateTimeParseException) {
|
||||
LocalDateTime.parse(mr.groups[0]?.value!!, rxPattern.second)
|
||||
} catch (_: DateTimeParseException) {
|
||||
null
|
||||
}
|
||||
}.firstOrNull()
|
||||
}.firstOrNull()
|
||||
|
||||
private fun guessDate(filename: String) = datePatterns.asSequence().map {
|
||||
it.first.findAll(filename).mapNotNull { mr ->
|
||||
private fun guessDate(filename: String) = datePatterns.asSequence().mapNotNull { rxPattern ->
|
||||
rxPattern.first.findAll(filename).mapNotNull { mr ->
|
||||
try {
|
||||
LocalDate.parse(mr.groups[0]?.value!!, it.second)
|
||||
} catch (e: DateTimeParseException) {
|
||||
LocalDate.parse(mr.groups[0]?.value!!, rxPattern.second)
|
||||
} catch (_: DateTimeParseException) {
|
||||
null
|
||||
}
|
||||
}.firstOrNull()
|
||||
}.firstOrNull()
|
||||
|
||||
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,
|
||||
referenceDate = document.referenceDate.formatHumanLong(),
|
||||
tags = { document.tags.map { TagsBlock(tag = it.value) }.asSequence() },
|
||||
description = document.description.ifBlank { "-" },
|
||||
description = document.description.ifBlank { "" },
|
||||
files = FileList(
|
||||
modifiers = modifiers,
|
||||
delete = true,
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
<div class="space"></div>
|
||||
|
||||
<b>Description</b>
|
||||
{if $description}
|
||||
<pre>{$description|html}</pre>
|
||||
{else}
|
||||
<p>-</p>
|
||||
{/if}
|
||||
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -15,15 +15,16 @@ class DateGuesserTest {
|
|||
fun test_date() {
|
||||
val values = listOf(
|
||||
"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.pdf",
|
||||
"2023-10-05T10:15" to "File-20231005-101500_Form.pdf",
|
||||
"2023-10-05T11:22:33" to "File.20231005-112233.pdf",
|
||||
"2022-11-11T00:00:00" to "File.20221111000000.pdf",
|
||||
"8888-11-11T00:00:00" to "File.88881111000000.pdf",
|
||||
null to "Document.pdf",
|
||||
)
|
||||
)
|
||||
|
||||
values.forEach { value ->
|
||||
assertEquals(
|
||||
|
|
|
@ -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.
|
||||
# https://docs.gradle.org/current/userguide/build_cache.html
|
||||
org.gradle.caching=true
|
||||
|
|
Loading…
Reference in a new issue