Mate.Pipeline (Mate v0.1.5) View Source
This module keeps track of the build and deploy pipelines.
It will use the given steps
from your Mate.Config
to either build or deploy
your application on the specified servers. The default steps will attempt to sniff
whether or not you are in need of the assets pipeline, which uses npm
by default.
The pipeline can be updated with custom steps using the configuration file .mate.exs
,
for example you can add a custom step module with the Mate.Pipeline.Step
behaviour.
config :mate,
steps: fn steps, pipeline ->
pipeline.insert_before(steps, Mate.Step.CleanBuild, CustomStep)
end,
defmodule CustomStep do
use Mate.Pipeline.Step
@impl true
def run(session) do
IO.puts("Execute my custom code")
{:ok, session}
end
end
You can also use useful commands like local_cmd/2
, local_cmd/3
,
local_script/2
, remote_cmd/2
, remote_cmd/3
, remote_script/2
,
copy_from/3
and copy_to/3
to interact with the local machine or with
the build server in various ways.
Link to this section Summary
Functions
Returns list of default build steps.
Inserts a custom step in the given steps after a specific spec.
Inserts a custom step in the given steps before a specific spec.
Create a new Pipeline struct with default build steps
Create a new Pipeline struct with custom steps
Removes a specific step from the given steps.
Replaces a specific step with a custom step in the given steps
Runs all steps within a given session for the given context, using the driver from your configuration file. For build context it will use the build_server and for deploy context it will run on all deploy servers.
Run a specific step within the current session.
Link to this section Types
Link to this section Functions
Specs
default_steps() :: steps()
Returns list of default build steps.
Specs
Inserts a custom step in the given steps after a specific spec.
Example:
pipeline.insert_after(steps, Mate.Step.CleanBuild, CustomStep)
Specs
Inserts a custom step in the given steps before a specific spec.
Example:
pipeline.insert_before(steps, Mate.Step.CleanBuild, CustomStep)
Specs
new() :: t()
Create a new Pipeline struct with default build steps
Specs
Create a new Pipeline struct with custom steps
Specs
Removes a specific step from the given steps.
Example:
pipeline.remove(steps, Mate.Step.CleanBuild)
Specs
Replaces a specific step with a custom step in the given steps
Example:
pipeline.replace(steps, Mate.Step.CleanBuild, CustomStep)
Specs
run(session :: Mate.Session.t()) :: {:ok, Mate.Session.t()} | {:error, any()}
Runs all steps within a given session for the given context, using the driver from your configuration file. For build context it will use the build_server and for deploy context it will run on all deploy servers.
Specs
run_step(session :: Mate.Session.t(), step :: step()) :: Mate.Session.t()
run_step(steps :: steps(), sessions :: [Mate.Session.t()]) :: {:ok, Mate.Session.t()} | {:error, any()}
Run a specific step within the current session.