Rename files to fit project
This commit is contained in:
parent
0d6d7d6e96
commit
ac1eb372a4
6 changed files with 19 additions and 19 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Triggerer
|
# GitLabPushTriggerer
|
||||||
|
|
||||||
Triggerer is a small application that triggers execution of scripts when given endpoints are hit
|
GitLabPushTriggerer is a small application that triggers execution of scripts when given endpoints are hit
|
||||||
with GET requests. It contains no permissions handling, no authentication, no request limiting. So
|
with GET requests. It contains no permissions handling, no authentication, no request limiting. So
|
||||||
these must be handled in some other way, like with an Nginx reverse proxy.
|
these must be handled in some other way, like with an Nginx reverse proxy.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Triggerer.Router do
|
defmodule GitLabPushTriggerer.Router do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Router dispatching requests to the correct handlers.
|
Router dispatching requests to the correct handlers.
|
||||||
"""
|
"""
|
||||||
|
@ -13,7 +13,7 @@ defmodule Triggerer.Router do
|
||||||
|
|
||||||
paths =
|
paths =
|
||||||
quote do
|
quote do
|
||||||
Triggerer.get_envs()
|
GitLabPushTriggerer.get_envs()
|
||||||
end
|
end
|
||||||
|
|
||||||
match "/:path" do
|
match "/:path" do
|
||||||
|
@ -22,7 +22,7 @@ defmodule Triggerer.Router do
|
||||||
route_not_found(conn)
|
route_not_found(conn)
|
||||||
|
|
||||||
script ->
|
script ->
|
||||||
case Triggerer.run(script) do
|
case GitLabPushTriggerer.run(script) do
|
||||||
:ok ->
|
:ok ->
|
||||||
send_resp(conn, 200, "OK")
|
send_resp(conn, 200, "OK")
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Triggerer do
|
defmodule GitLabPushTriggerer do
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -9,13 +9,13 @@ defmodule Triggerer do
|
||||||
|
|
||||||
In these examples, sample env is given as argument. If no argument is given, system env is used.
|
In these examples, sample env is given as argument. If no argument is given, system env is used.
|
||||||
|
|
||||||
iex> Triggerer.get_envs(%{"TRIGGERER_FOO" => "./test.sh"})
|
iex> GitLabPushTriggerer.get_envs(%{"TRIGGERER_FOO" => "./test.sh"})
|
||||||
%{"foo" => "./test.sh"}
|
%{"foo" => "./test.sh"}
|
||||||
|
|
||||||
iex> Triggerer.get_envs(%{})
|
iex> GitLabPushTriggerer.get_envs(%{})
|
||||||
%{}
|
%{}
|
||||||
|
|
||||||
iex> Triggerer.get_envs(%{"WRONG_FORMAT" => "no", "TRIGGERER_BAR_" => "baz", "TRIGGERER_" => "no", "TRIGGERER_GO_WILD" => "/bin/true"})
|
iex> GitLabPushTriggerer.get_envs(%{"WRONG_FORMAT" => "no", "TRIGGERER_BAR_" => "baz", "TRIGGERER_" => "no", "TRIGGERER_GO_WILD" => "/bin/true"})
|
||||||
%{"bar-" => "baz", "go-wild" => "/bin/true"}
|
%{"bar-" => "baz", "go-wild" => "/bin/true"}
|
||||||
"""
|
"""
|
||||||
@spec get_envs(%{optional(String.t()) => String.t()}) :: map
|
@spec get_envs(%{optional(String.t()) => String.t()}) :: map
|
||||||
|
@ -40,13 +40,13 @@ defmodule Triggerer do
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
iex> Triggerer.transform_path("YKSI_KAKSI")
|
iex> GitLabPushTriggerer.transform_path("YKSI_KAKSI")
|
||||||
"yksi-kaksi"
|
"yksi-kaksi"
|
||||||
|
|
||||||
iex> Triggerer.transform_path("FOO")
|
iex> GitLabPushTriggerer.transform_path("FOO")
|
||||||
"foo"
|
"foo"
|
||||||
|
|
||||||
iex> Triggerer.transform_path("ÄNKYRÄ_KÖNKYRÄ_")
|
iex> GitLabPushTriggerer.transform_path("ÄNKYRÄ_KÖNKYRÄ_")
|
||||||
"änkyrä-könkyrä-"
|
"änkyrä-könkyrä-"
|
||||||
"""
|
"""
|
||||||
@spec transform_path(String.t()) :: String.t()
|
@spec transform_path(String.t()) :: String.t()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Triggerer.Application do
|
defmodule GitLabPushTriggerer.Application do
|
||||||
# See https://hexdocs.pm/elixir/Application.html
|
# See https://hexdocs.pm/elixir/Application.html
|
||||||
# for more information on OTP Applications
|
# for more information on OTP Applications
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
@ -16,7 +16,7 @@ defmodule Triggerer.Application do
|
||||||
children = [
|
children = [
|
||||||
Plug.Adapters.Cowboy.child_spec(
|
Plug.Adapters.Cowboy.child_spec(
|
||||||
:http,
|
:http,
|
||||||
Triggerer.Router,
|
GitLabPushTriggerer.Router,
|
||||||
[],
|
[],
|
||||||
port: port
|
port: port
|
||||||
)
|
)
|
||||||
|
@ -24,7 +24,7 @@ defmodule Triggerer.Application do
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
opts = [strategy: :one_for_one, name: Triggerer.Supervisor]
|
opts = [strategy: :one_for_one, name: GitLabPushTriggerer.Supervisor]
|
||||||
Supervisor.start_link(children, opts)
|
Supervisor.start_link(children, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
4
mix.exs
4
mix.exs
|
@ -1,4 +1,4 @@
|
||||||
defmodule Triggerer.MixProject do
|
defmodule GitLabPushTriggerer.MixProject do
|
||||||
use Mix.Project
|
use Mix.Project
|
||||||
|
|
||||||
def project do
|
def project do
|
||||||
|
@ -15,7 +15,7 @@ defmodule Triggerer.MixProject do
|
||||||
def application do
|
def application do
|
||||||
[
|
[
|
||||||
extra_applications: [:logger],
|
extra_applications: [:logger],
|
||||||
mod: {Triggerer.Application, []}
|
mod: {GitLabPushTriggerer.Application, []}
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule TriggererTest do
|
defmodule GitLabPushTriggererTest do
|
||||||
use ExUnit.Case
|
use ExUnit.Case
|
||||||
doctest Triggerer
|
doctest GitLabPushTriggerer
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue