ru.astrainteractive.gradleplugin.property.mapping.DeveloperMapper.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of convention Show documentation
Show all versions of convention Show documentation
GradlePlugin for my kotlin projects
package ru.astrainteractive.gradleplugin.property.mapping
import org.gradle.api.GradleException
import ru.astrainteractive.gradleplugin.model.Developer
object DeveloperMapper {
fun parseDeveloper(value: String): Developer {
val items: List = value.split("|").map(String::trim)
if (items.size != 3) {
throw GradleException(
"Developer profile should have 3 parts with | delimiter. " +
"For example: makeevrserg|Makeev Roman|[email protected]"
)
}
return Developer(
id = items[0],
name = items[1],
email = items[2]
)
}
fun parseDevelopers(value: String): List {
return value.split(",").map(::parseDeveloper)
}
}