Packages

Configuration and infrastructure as code in Elixir

Current section

Files

Jump to
railyard lib railyard_distillery plugin.ex
Raw

lib/railyard_distillery/plugin.ex

defmodule Railyard.Distillery.Plugin do
@moduledoc """
Provides a distillery plugin for adding config management lifecycle commands to the
distillery build, and optionally for uploading packages to a file host like S3.
"""
use Mix.Releases.Plugin
def before_assembly(%Release{} = release, _opts) do
# Add the custom `railyard` command here
info("This is executed just prior to assembling the release")
# or nil
release |> IO.inspect()
end
def after_package(%Release{} = release, _opts) do
# Upload the package to S3 here
info("This is executed just after packaging the release")
# or nil
release
end
# Unused plugin hooks
def after_assembly(%Release{} = release, _opts), do: release
def before_package(%Release{} = release, _opts), do: release
def after_cleanup(_args, _opts), do: :ok
end