mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Sanitize repo names from repos().
This commit is contained in:
parent
a7006d5cd7
commit
6816ba8a3b
1 changed files with 5 additions and 3 deletions
|
@ -74,7 +74,7 @@ data class ProxyConfig(val host: String = "", val port: Int = 0, val type: Strin
|
||||||
fun toAetherProxy() = Proxy(type, host, port) // TODO make support for proxy auth
|
fun toAetherProxy() = Proxy(type, host, port) // TODO make support for proxy auth
|
||||||
}
|
}
|
||||||
|
|
||||||
data class HostConfig(var url: String = "", var name: String = url, var username: String? = null,
|
data class HostConfig(var url: String = "", var name: String, var username: String? = null,
|
||||||
var password: String? = null) {
|
var password: String? = null) {
|
||||||
fun hasAuth() : Boolean {
|
fun hasAuth() : Boolean {
|
||||||
return (! username.isNullOrBlank()) && (! password.isNullOrBlank())
|
return (! username.isNullOrBlank()) && (! password.isNullOrBlank())
|
||||||
|
@ -95,8 +95,10 @@ fun repos(vararg repos : String) {
|
||||||
newRepos(*repos)
|
newRepos(*repos)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createRepoName(url: String) = url.replace("/", "_").replace("\\", "_").replace(":", "_")
|
||||||
|
|
||||||
fun newRepos(vararg repos: String) {
|
fun newRepos(vararg repos: String) {
|
||||||
repos.forEach { Kobalt.addRepo(HostConfig(it)) }
|
repos.forEach { Kobalt.addRepo(HostConfig(it, createRepoName(it))) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildFileClasspath(vararg deps: String) {
|
fun buildFileClasspath(vararg deps: String) {
|
||||||
|
@ -115,7 +117,7 @@ fun authRepos(vararg repos : HostConfig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun authRepo(init: HostConfig.() -> Unit) = HostConfig().apply { init() }
|
fun authRepo(init: HostConfig.() -> Unit) = HostConfig(name = "").apply { init() }
|
||||||
|
|
||||||
@Directive
|
@Directive
|
||||||
fun glob(g: String) : IFileSpec.GlobSpec = IFileSpec.GlobSpec(g)
|
fun glob(g: String) : IFileSpec.GlobSpec = IFileSpec.GlobSpec(g)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue