Make release posts generic
This commit is contained in:
parent
fdcef5d209
commit
e3cef3c004
3 changed files with 12 additions and 7 deletions
|
@ -4,12 +4,17 @@ data class GithubRepo(private val repositoryPath: String) {
|
||||||
|
|
||||||
private val urlPrefix = "https://github.com/"
|
private val urlPrefix = "https://github.com/"
|
||||||
|
|
||||||
|
val repoPath: String
|
||||||
val name: String
|
val name: String
|
||||||
get() {
|
|
||||||
|
init {
|
||||||
|
repoPath = repoPath(repositoryPath)
|
||||||
|
|
||||||
val usernameEnd = repoPath.indexOf("/")
|
val usernameEnd = repoPath.indexOf("/")
|
||||||
return repoPath.substring(usernameEnd + 1).trimEnd { ch -> ch == '/' }
|
name = repoPath.substring(usernameEnd + 1).trimEnd { ch -> ch == '/' }
|
||||||
}
|
}
|
||||||
val repoPath: String = repoPath(repositoryPath)
|
|
||||||
|
val capitalizedName = name.replaceFirstChar { it.uppercase() }
|
||||||
|
|
||||||
val url = urlPrefix + repoPath
|
val url = urlPrefix + repoPath
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ data class Release(
|
||||||
) {
|
) {
|
||||||
val title: String get() = id
|
val title: String get() = id
|
||||||
val text: String =
|
val text: String =
|
||||||
"\uD83C\uDF89 Navidrome $title has been published!\n\nRelease notes are available here: $link\n\n#Navidrome"
|
"\uD83C\uDF89 ${githubRepo.capitalizedName} $title has been published!\n\nRelease notes are available here: $link\n\n#${githubRepo.capitalizedName}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Release.asCollection() = listOf(this).asCollection()
|
fun Release.asCollection() = listOf(this).asCollection()
|
||||||
|
|
|
@ -109,7 +109,7 @@ class PublishersTest : DescribeSpec({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertThat(statusSlot.captured).isEqualTo("\uD83C\uDF89 Navidrome v0.0.0 has been published!\n\nRelease notes are available here: https://example.com\n\n#Navidrome")
|
assertThat(statusSlot.captured).isEqualTo("\uD83C\uDF89 Example v0.0.0 has been published!\n\nRelease notes are available here: https://example.com\n\n#Example")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue