OpenAperture.Builder.GitRepo

This module represents a Git repository, and is used to track the local repository’s path, the remote repository’s URL, and the current branch/tag/commit.

Summary↑

get_github_repo_url(relative_repo)

Given a [user|org]/project_name string, builds a GitHub URL. Prepends OAuth access credentials to the URL (if configured for the application.)

get_github_url()

Retrieves the base GitHub URL, including an OAuth credential if one is set in the application’s configuration

get_project_name(repo_url)

Extracts the project name from a GitHub repo URL

resolve_github_repo_url(raw_url)

Given a A url (absolute, [user|org]/project_name, or [user|org]/project_name.git), builds a GitHub URL. Prepends OAuth access credentials to the URL (if configured for the application.)

Types ↑

t :: %OpenAperture.Builder.GitRepo{local_repo_path: String.t, remote_url: String.t, branch: String.t}

Functions

get_github_repo_url(relative_repo)

Specs:

Given a [user|org]/project_name string, builds a GitHub URL. Prepends OAuth access credentials to the URL (if configured for the application.)

Examples

iex> OpenAperture.Builder.GitRepo.get_github_repo_url(“test_user/test_project”) “https://github.com/test_user/test_project.git“

get_github_url()

Specs:

Retrieves the base GitHub URL, including an OAuth credential if one is set in the application’s configuration.

get_project_name(repo_url)

Specs:

Extracts the project name from a GitHub repo URL.

Examples

iex> OpenAperture.Builder.GitRepo.get_project_name(“https://github.com/test_user/test_project“) “test_project”

resolve_github_repo_url(raw_url)

Specs:

Given a A url (absolute, [user|org]/project_name, or [user|org]/project_name.git), builds a GitHub URL. Prepends OAuth access credentials to the URL (if configured for the application.)

Examples

iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“test_user/test_project”) “https://github.com/test_user/test_project.git“ iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“http://github.com/test_user/test_project“) “https://github.com/test_user/test_project.git“ iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“http://github.com/test_user/test_project.git“) “https://github.com/test_user/test_project.git“ iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“https://github.com/test_user/test_project“) “https://github.com/test_user/test_project.git“ iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“https://github.com/test_user/test_project.git“) “https://github.com/test_user/test_project.git“ iex> OpenAperture.Builder.GitRepo.resolve_github_repo_url(“git@github.com:test_user/test_project.git”) “git@github.com:test_user/test_project.git”