ai.digital.integration.server.common.util.GitUtil.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of integration-server-gradle-plugin Show documentation
Show all versions of integration-server-gradle-plugin Show documentation
The easy way to get custom setup for Deploy up and running
package ai.digital.integration.server.common.util
import java.nio.file.Path
import java.nio.file.Paths
class GitUtil {
companion object {
fun checkout(repo: String, destinationPath: Path, branch: String? = null): Path {
val dest = Paths.get(destinationPath.toAbsolutePath().toString(), repo)
val branchClone = if (branch != null) "-b $branch" else ""
ProcessUtil.executeCommand(
"rm -fr \"${dest.toAbsolutePath()}\"; git clone [email protected]:xebialabs/$repo.git \"${dest.toAbsolutePath()}\" $branchClone")
return dest
}
}
}