GitClient

class GitClient: Any

Provides functionality related with GitHub repositories (for example, pulling the contents of a repository).

Fields

Name Description
val LOG: LoggerFactory.getLogger(this.javaClass.name)
val githubSshUrlRegex: """git@github.com:(.+)/(.+).git""".toRegex()

Constructors

Name Description
constructor()

Provides functionality related with GitHub repositories (for example, pulling the contents of a repository).

Methods

clone

fun clone(uri: String, directory: File, privateKey: ByteArray?): Git

Clones the Git repository identifyed by uri.

Parameters

Name Description
uri: String
directory: File
privateKey: ByteArray?

ReturnValue

Name Description
Git

a Git

pull

fun pull(localRepository: File, privateKey: ByteArray?): Git

Pulls code from the Git repository identified by localRepository.

Parameters

Name Description
localRepository: File
privateKey: ByteArray?

ReturnValue

Name Description
Git

a Git

generateKeyPair

fun generateKeyPair(): Pair<ByteArray, ByteArray>

Generates a pair of public/private keys.

ReturnValue

Name Description
Pair<ByteArray, ByteArray>

a Pair with two ByteArray

getLastCommitInfo

fun getLastCommitInfo(git: Git): CommitInfo?

Returns information about the last commit that is available in a GitHub repository.

Parameters

Name Description
git: Git

ReturnValue

Name Description
CommitInfo?

a CommitInfo

checkValidSSHGithubURL

fun checkValidSSHGithubURL(gitRepositoryUrl: String): Boolean

Parameters

Name Description
gitRepositoryUrl: String

ReturnValue

Name Description
Boolean

convertSSHGithubURLtoHttpURL

fun convertSSHGithubURLtoHttpURL(gitRepositoryUrl: String): String

Parameters

Name Description
gitRepositoryUrl: String

ReturnValue

Name Description
String

getGitRepoInfo

fun getGitRepoInfo(gitRepositoryUrl: String): Pair<String, String>

Parameters

Name Description
gitRepositoryUrl: String

ReturnValue

Name Description
Pair<String, String>

getHistory

fun getHistory(localRepository: File): List<CommitInfo>

Returns the history of a Git repository.

Parameters

Name Description
localRepository: File

ReturnValue

Name Description
List<CommitInfo>

a List of CommitInfo