mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 07:57: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
|
||||
}
|
||||
|
||||
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) {
|
||||
fun hasAuth() : Boolean {
|
||||
return (! username.isNullOrBlank()) && (! password.isNullOrBlank())
|
||||
|
@ -95,8 +95,10 @@ fun repos(vararg repos : String) {
|
|||
newRepos(*repos)
|
||||
}
|
||||
|
||||
fun createRepoName(url: String) = url.replace("/", "_").replace("\\", "_").replace(":", "_")
|
||||
|
||||
fun newRepos(vararg repos: String) {
|
||||
repos.forEach { Kobalt.addRepo(HostConfig(it)) }
|
||||
repos.forEach { Kobalt.addRepo(HostConfig(it, createRepoName(it))) }
|
||||
}
|
||||
|
||||
fun buildFileClasspath(vararg deps: String) {
|
||||
|
@ -115,7 +117,7 @@ fun authRepos(vararg repos : HostConfig) {
|
|||
}
|
||||
|
||||
@Directive
|
||||
fun authRepo(init: HostConfig.() -> Unit) = HostConfig().apply { init() }
|
||||
fun authRepo(init: HostConfig.() -> Unit) = HostConfig(name = "").apply { init() }
|
||||
|
||||
@Directive
|
||||
fun glob(g: String) : IFileSpec.GlobSpec = IFileSpec.GlobSpec(g)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue