Gogs (gogs v0.1.0)
Documentation for Gogs.
This package is an Elixir interface to our Gogs Server.
It contains all functions we need to create repositories,
clone, add data to files, commit, push and diff.
Some of these functions use Git and others use the REST API.
We would obviously prefer if everything was one or the other,
but sadly, some things cannot be done via Git or REST
so we have adopted a "hybrid" approach.
The functions in this file are defined in the order that we are using them. So they tell a story. If you are reading this and prefer to order them alphabetically or some other way, please share by opening an issue: github.com/dwyl/gogs/issues
Link to this section Summary
Functions
clone/1 clones a remote git repository based on git_repo_url
returns the path of the local copy of the repository.
inject_poison/0 injects a TestDouble of HTTPoison in Test
so that we don't have duplicate mock in consuming apps.
see: github.com/dwyl/elixir-auth-google/issues/35
make_url/2 constructs the URL based on the supplied git url and TCP port.
If the port is set it will be a custom Gogs instance.
parse_body_response/1 parses the response returned by the Gogs Server
so your app can use the resulting JSON.
post/2 accepts two arguments: url and params.
remote_repo_create/3 accepts two arguments: org_name, repo_name & private.
It creates a repo on the remote Gogs instance as defined
by the environment variable GOGS_URL.
For convenience it assumes that you only have one Gogs instance.
If you have more or different requirements, please share!
returns the remote url for cloning
Link to this section Functions
clone(git_repo_url)
clone/1 clones a remote git repository based on git_repo_url
returns the path of the local copy of the repository.
get_repo_name_from_url(url)
inject_poison()
inject_poison/0 injects a TestDouble of HTTPoison in Test
so that we don't have duplicate mock in consuming apps.
see: github.com/dwyl/elixir-auth-google/issues/35
local_repo_path(repo)
make_url(git_url, port \\ 0)
make_url/2 constructs the URL based on the supplied git url and TCP port.
If the port is set it will be a custom Gogs instance.
examples
Examples
iex> Gogs.make_url("gogs-server.fly.dev", "10022") "ssh://git@gogs-server.fly.dev:10022/"
iex> Gogs.make_url("github.com") "git@github.com:"
parse_body_response(arg)
parse_body_response/1 parses the response returned by the Gogs Server
so your app can use the resulting JSON.
post(url, params \\ %{})
post/2 accepts two arguments: url and params.
remote_repo_create(org_name, repo_name, private \\ false)
remote_repo_create/3 accepts two arguments: org_name, repo_name & private.
It creates a repo on the remote Gogs instance as defined
by the environment variable GOGS_URL.
For convenience it assumes that you only have one Gogs instance.
If you have more or different requirements, please share!
remote_url(base_url, org, repo)
returns the remote url for cloning