Forecastle (forecastle v1.0.0)

Copy Markdown View Source

Build-time integration for Castle-managed Elixir releases.

steps/1 adds Forecastle's hooks to a Mix release. Most projects call it through Castle.customize/1.

Summary

Functions

Generates this release's relup, from the :upgrade_from release option.

Refuses a build whose :upgrade_from is not the one pre_assemble/1 resolved.

Functions

generate_relup(release)

@spec generate_relup(Mix.Release.t()) :: Mix.Release.t()

Generates this release's relup, from the :upgrade_from release option.

steps/1 places generation after release customisation and immediately before :tar. An explicitly placed generator keeps its position. A project with a custom packaging step must place generation after all release changes and immediately before packaging.

:upgrade_from is a list of rel:, tar: or ref: baseline specs. The function generates both upgrade and downgrade directions for each baseline with the auto strategy. See Forecastle.Baseline for the grammar.

Omitting :upgrade_from skips generation. An empty value, a project-root relup supplied with the option, or a change after pre_assemble/1 is an error. Use mix castle.relup for separate directions or the --hot and --restart strategies.

post_assemble(release)

pre_assemble(release)

refuse_late_upgrade_from(release)

@spec refuse_late_upgrade_from(Mix.Release.t()) :: Mix.Release.t()

Refuses a build whose :upgrade_from is not the one pre_assemble/1 resolved.

steps/1 places this check after all project steps. generate_relup/1 also checks before using the option. Define or compute baselines in mix.exs, or in a step before :assemble, so pre_assemble/1 can resolve them.

The function also rejects a release that names baselines after losing the record left by pre_assemble/1. A custom step should update the option list it receives instead of replacing the list.

steps(tasks \\ [:assemble, :tar])