View Source Igniter (igniter v0.3.2)
Tools for generating and patching code into an Elixir project.
Summary
Functions
Adds an issue to the issues list. Any issues will prevent writing and be displayed to the user.
Adds a task to the tasks list. Tasks will be run after all changes have been commited
Adds a warning to the warnings list. Warnings will not prevent writing, but will be displayed to the user.
Applies the current changes to the mix.exs
in the Igniter and fetches dependencies.
Stores the key/value pair in igniter.assigns
Finds the Igniter.Mix.Task
task by name and composes it (calls its igniter/2
) into the current igniter.
If the task doesn't exist, a fallback implementation may be provided as the last argument.
Creates a new elixir file in the project with the provided string contents. Adds an error if it already exists.
Creates the given file in the project with the provided string contents, or updates it with a function of type zipper_updater()
if it already exists.
Executes or dry-runs a given Igniter.
Returns whether the current Igniter has pending changes.
This function stores in the igniter if its been run before, so it is only run once, which is expensive.
Includes the given elixir file in the project, expecting it to exist. Does nothing if its already been added.
Includes the given file in the project, expecting it to exist. Does nothing if its already been added.
Includes all files matching the given glob, expecting them all (for now) to be elixir files.
Includes or creates the given file in the project with the provided contents. Does nothing if its already been added.
Returns a new igniter
Updates the source code of the given elixir file
Updates a given file's Rewrite.Source
Updates all files matching the given glob with the given zipper function.
Types
@type zipper_updater() :: (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | {:error, String.t() | [String.t()]})
Functions
Adds an issue to the issues list. Any issues will prevent writing and be displayed to the user.
Adds a task to the tasks list. Tasks will be run after all changes have been commited
Adds a warning to the warnings list. Warnings will not prevent writing, but will be displayed to the user.
Applies the current changes to the mix.exs
in the Igniter and fetches dependencies.
Returns the remaining changes in the Igniter if successful.
Options
:error_on_abort?
- Iftrue
, raises an error if the user aborts the operation. Returns the original igniter if not.:yes
- Iftrue
, automatically applies the changes without prompting the user.
Stores the key/value pair in igniter.assigns
Finds the Igniter.Mix.Task
task by name and composes it (calls its igniter/2
) into the current igniter.
If the task doesn't exist, a fallback implementation may be provided as the last argument.
Creates a new elixir file in the project with the provided string contents. Adds an error if it already exists.
@spec create_or_update_elixir_file(t(), Path.t(), String.t(), zipper_updater()) :: t()
Creates the given file in the project with the provided string contents, or updates it with a function of type zipper_updater()
if it already exists.
Executes or dry-runs a given Igniter.
Returns whether the current Igniter has pending changes.
This function stores in the igniter if its been run before, so it is only run once, which is expensive.
Includes the given elixir file in the project, expecting it to exist. Does nothing if its already been added.
Includes the given file in the project, expecting it to exist. Does nothing if its already been added.
Includes all files matching the given glob, expecting them all (for now) to be elixir files.
Includes or creates the given file in the project with the provided contents. Does nothing if its already been added.
@spec new() :: t()
Returns a new igniter
@spec update_elixir_file(t(), Path.t(), zipper_updater()) :: t()
Updates the source code of the given elixir file
@spec update_file(t(), Path.t(), (Rewrite.Source.t() -> Rewrite.Source.t())) :: t()
Updates a given file's Rewrite.Source
@spec update_glob( t(), Path.t() | GlobEx.t(), zipper_updater() ) :: t()
Updates all files matching the given glob with the given zipper function.
Adds any new files matching that glob to the igniter first.