-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update all sub-modules to be name-spaced Gogs.ModuleName as per Libra…
…ry guidelines #36
- Loading branch information
Showing
10 changed files
with
62 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule GogsHelpers do | ||
defmodule Gogs.Helpers do | ||
@moduledoc """ | ||
Helper functions that can be unit tested independently of the main functions. | ||
If you spot any way to make these better, please share: | ||
|
@@ -14,7 +14,7 @@ defmodule GogsHelpers do | |
`api_base_url/0` returns the `Gogs` Server REST API url for API requests. | ||
## Examples | ||
iex> GogsHelpers.api_base_url() | ||
iex> Gogs.Helpers.api_base_url() | ||
"https://gogs-server.fly.dev/api/v1/" | ||
""" | ||
@spec api_base_url() :: String.t() | ||
|
@@ -27,10 +27,10 @@ defmodule GogsHelpers do | |
If the `port` is set it will be a custom Gogs instance. | ||
## Examples | ||
iex> GogsHelpers.make_url("gogs-server.fly.dev", "10022") | ||
iex> Gogs.Helpers.make_url("gogs-server.fly.dev", "10022") | ||
"ssh://[email protected]:10022/" | ||
iex> GogsHelpers.make_url("github.com") | ||
iex> Gogs.Helpers.make_url("github.com") | ||
"[email protected]:" | ||
""" | ||
|
@@ -54,7 +54,7 @@ defmodule GogsHelpers do | |
def remote_url_ssh(org, repo) do | ||
url = Envar.get("GOGS_URL") | ||
port = Envar.get("GOGS_SSH_PORT") | ||
git_url = GogsHelpers.make_url(url, port) | ||
git_url = Gogs.Helpers.make_url(url, port) | ||
remote_url(git_url, org, repo) | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
defmodule GogsHelpersTest do | ||
defmodule Gogs.HelpersTest do | ||
use ExUnit.Case, async: true | ||
doctest GogsHelpers | ||
doctest Gogs.Helpers | ||
|
||
test "GogsHelpers.api_base_url/0 returns the API URL for the Gogs Server" do | ||
assert GogsHelpers.api_base_url() == "https://gogs-server.fly.dev/api/v1/" | ||
test "Gogs.Helpers.api_base_url/0 returns the API URL for the Gogs Server" do | ||
assert Gogs.Helpers.api_base_url() == "https://gogs-server.fly.dev/api/v1/" | ||
end | ||
|
||
test "temp_dir/1 returns cwd if no dir supplied" do | ||
dir = Envar.get("GITHUB_WORKSPACE", "tmp") | ||
assert GogsHelpers.temp_dir(dir) == dir | ||
assert Gogs.Helpers.temp_dir(dir) == dir | ||
end | ||
|
||
test "make_url/2 (without port) returns a valid GitHub Base URL" do | ||
url = "github.com" | ||
git_url = GogsHelpers.make_url(url) | ||
git_url = Gogs.Helpers.make_url(url) | ||
assert git_url == "[email protected]:" | ||
end | ||
|
||
test "make_url/2 returns a valid Gogs (Fly.io) Base URL" do | ||
git_url = GogsHelpers.make_url("gogs-server.fly.dev", "10022") | ||
git_url = Gogs.Helpers.make_url("gogs-server.fly.dev", "10022") | ||
assert git_url == "ssh://[email protected]:10022/" | ||
end | ||
|
||
test "remote_url/3 returns a valid Gogs (Fly.io) remote URL" do | ||
git_url = GogsHelpers.make_url("gogs-server.fly.dev", "10022") | ||
remote_url = GogsHelpers.remote_url(git_url, "nelsonic", "public-repo") | ||
git_url = Gogs.Helpers.make_url("gogs-server.fly.dev", "10022") | ||
remote_url = Gogs.Helpers.remote_url(git_url, "nelsonic", "public-repo") | ||
assert remote_url == "ssh://[email protected]:10022/nelsonic/public-repo.git" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters