Lettuce (lettuce v0.2.0)
Lettuce is a generic server process that checks the files within an elixir
project that has lettuce as a dependency and then runs iex -S mix
. It
initialises the state of the generic server with the .ex
files inside lib
and their last modified time. By default lib
is used but you may specify which
folders you want to be watched.
configuration-example
Configuration example
use Mix.Config
config :lettuce, folders_to_watch: ["apps"]
...
You can also change the refresh time to control how often the project files will be checked.
use Mix.Config
config :lettuce, refresh_time: 1500
...
Even though the start_link
will throw an error if the Mix.env
equals to
:dev
it is recommended to explicitly select the extra applications by
environment in the mix file.
...
def application do
[
extra_applications: extra_applications(Mix.env(), [:logger, ...])
]
end
defp extra_applications(:dev, default), do: default ++ [:lettuce]
defp extra_applications(_, default), do: default
...
mix-compiler-task-options
Mix compiler task options
You might send special parameters to the compiler task that lettuce runs. This is not required. In your project of parameters in config.exs:
config :lettuce,
folders_to_watch: ["lib"],
compiler_opts: [
"--ignore-module-conflict",
"--verbose"
]
For the available options check the Mix.Tasks.Compile.Elixir docs.
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Link to this section Types
file_last_modified()
@type file_last_modified() :: {String.t(), File.erlang_time()}
Link to this section Functions
child_spec(init_arg)
Returns a specification to start this module under a supervisor.
See Supervisor
.