Mix.Generator
Conveniences for working with paths and generating content.
All of those functions are verbose, in the sense they log
the action to be performed via Mix.shell.
Summary
| create_directory(path) | Creates a directory if one does not exist yet |
| create_file(path, contents) | Creates a file with the given contents. If the file already exists, asks for user confirmation |
| embed_template(name, contents) | Embed a template given by |
| embed_text(name, contents) | Embeds a text given by |
| from_file(path) | Reads the content from a file relative to the current file and not relative to the cwd. Useful when used with embed macros: |
Functions
Macros
Embed a template given by contents into the current module.
It will define a private function with the name followed by
_template that expects assigns as arguments.
This function must be invoked passing a keyword list.
Each key in the keyword list can be accessed in the
template using the @ macro.
For more information, check EEx.SmartEngine.
Embeds a text given by contents into the current module.
It will define a private function with the name followed by
_text that expects no argument.