Akd v0.2.1 Akd.Generator.Hook View Source

This module handles the generation of custom hooks which use Akd.Hook. This can either directly be called, or called through a mix task, mix akd.gen.hook.

This class uses EEx and Mix.Generator to fetch file contents from an eex template and populate the interpolated fields, writing it to the speficied file.

Usage:

The following call creates a file hook.ex at location path/to/file/hook.ex

Akd.Generator.Hook.gen(["hook.ex"], path: "path/to/file")

Link to this section Summary

Functions

This is the callback implementation for gen/2

Link to this section Functions

Link to this function gen(list, opts) View Source
gen(list(), Keyword.t()) :: :ok | {:error, String.t()}

This is the callback implementation for gen/2.

This function takes in a list of inputs and a list of options and generates a module that uses Akd.Hook at the specified path with the specified name.

The first element of the input is expected to be the name of the file.

The path can be sent to the opts.

If no path is sent, it defaults to lib/

Examples:

  Akd.Generator.Hook.gen(["hook.ex"], [path: "some/path"])