Getting Started
Project Setup
To use ExRerun with your projects, edit your mix.exs file and add it as a
dependency.
defp deps do
[{:ex_rerun, "~> 0.3", only: :dev}]
end
What is ExRerun
ExRerun is a package that is monitors your Elixir, and other source files, while
you are develop your application and then reruns a set of mix tasks whenever a
source file is added, deleted, or changed.
Configuration
It is possible to configure ex_rerun using the following parameters:
Note: the example below shows the default values.
config :ex_rerun,
scan_interval: 4000,
silent: false,
file_types: [".ex", ".exs", ".eex", ".json"],
paths: ["lib", "priv"],
ignore_pattern: nil,
tasks: [:elixir]
where:
scan_intervalspecifies the number of ms to wait between rerun checks,silenttoggles whether to print the output of thetasksregistered, every timeex_rerunruns,file_typeslists which file types that will trigger a rerun when changed,pathslists which folders to monitor,ignore_patternspecifies a regular expression, e.g.~r{\.?#(.)}, matching files that should to be ignored even if they have a file type included infile_types, andtasksenumerates the mix tasks to run each time a code modification occurs, possible built-in values are::elixir,:test,:escript, where:elixirrecompiles Elixir source code (same asMix.Tasks.Compile.Elixir),:testreruns any mix tests in the project (same asMix.Tasks.Test), andescriptrebuilds a escript file (same asMix.Tasks.Escript.Build).
Furthermore, tasks can also include custom mix tasks. For example, the hex
package elm_compile defines the
Mix.Tasks.Compile.Elm task which allows mix to also compile Elm files in a mix
project. An example project config using ex_rerun and elm_compile might look
like so:
config :ex_rerun,
file_types: [".elm", ".ex", ".exs", ".eex", ".json"],
paths: ["lib", "priv", "web"],
ignore_pattern: ~r{\.?#(.)},
tasks: [:elixir, Mix.Tasks.Compile.Elm]
Another example of a custom mix task could be to generate API documentation for
a project based on a set of RAML files.