# `Forecastle.Appup.Draft`
[🔗](https://github.com/ausimian/forecastle/blob/1.0.0/lib/forecastle/appup/draft.ex#L1)

Drafts appup instructions for modules that changed between two builds.

The draft uses BEAM behaviour attributes to choose an instruction:

| Module | Instruction |
| --- | --- |
| Supervisor | `{:update, module, :supervisor}` |
| GenServer, `:gen_server`, `:gen_statem`, `:gen_event` or `:gen_fsm` | `{:update, module, {:advanced, []}}` |
| Other changed module | `{:load_module, module}` |
| Added module | `{:add_module, module}` |
| Removed module | `{:delete_module, module}` |

Supervisor classification takes precedence when a module declares several
behaviours. The draft comments on decisions that require review, including
the `Extra` value, missing `code_change` callbacks, changed behaviour roles,
unsupervised processes, child upgrades, module ordering, and modules absent
from the application's `.app` resource.

# `annotated`

```elixir
@type annotated() :: {tuple(), [binary()]}
```

An instruction and the comment lines rendered above it.

# `entry`

```elixir
@type entry() :: %{
  from_vsn: binary(),
  preamble: [binary()],
  instructions: [annotated()]
}
```

One from-version entry, ready to render.

`preamble` holds comments about the entry as a whole.

# `entry`

```elixir
@spec entry(binary(), Forecastle.Build.side(), Forecastle.Build.side()) :: entry()
```

Drafts one from-version entry from two application builds.

The result has instructions in a stable order, with review comments, for
changed, added and removed modules.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
