BlogEngine.IgniterGen (blog_engine v0.1.0)

Copy Markdown View Source

Argument parsing, validation, and file helpers shared by the BlogEngine generators.

Summary

Functions

Returns whether ast contains an alias statement anywhere.

Creates each generated file that is missing and leaves identical files untouched.

Parses generator flags against a task's Igniter.Mix.Task.Info schema.

Keeps generated paths where the generator wrote them when Igniter moves files.

Returns the current content Igniter holds for path, or nil when it holds none.

Raises unless every listed option holds an Elixir module name.

Functions

contains_alias?(ast)

@spec contains_alias?(Macro.t()) :: boolean()

Returns whether ast contains an alias statement anywhere.

create_files(igniter, files)

@spec create_files(Igniter.t(), [{String.t(), String.t()}]) :: Igniter.t()

Creates each generated file that is missing and leaves identical files untouched.

parse_argv(argv, info, validate!)

@spec parse_argv([String.t()], Igniter.Mix.Task.Info.t(), (keyword() -> any())) ::
  Igniter.Mix.Task.Args.t()

Parses generator flags against a task's Igniter.Mix.Task.Info schema.

Applies the task's option defaults, hands the result to validate!, and raises on positional arguments or unknown options.

preserve_generated_paths(files, igniter)

@spec preserve_generated_paths([{String.t(), String.t()}], Igniter.t()) :: Igniter.t()

Keeps generated paths where the generator wrote them when Igniter moves files.

source_content(igniter, path)

@spec source_content(Igniter.t(), String.t()) :: String.t() | nil

Returns the current content Igniter holds for path, or nil when it holds none.

validate_module_options!(options, keys)

@spec validate_module_options!(
  keyword(),
  [atom()]
) :: :ok

Raises unless every listed option holds an Elixir module name.