BigBrother

Elixir library capable of watching and recompiling/reloading files at runtime. This is an alternative to Phoenix.CodeReloader for projects that don't use phoenix as their application.

Installation

Add :big_brother to the list of dependencies in mix.exs:

def deps do
  [
    {:big_brother_ex, "~> 0.1", only: [:dev]}
  ]
end

Configuration

You can configure the dependency by adding to config/dev.exs :

config :big_brother_ex, :reload_config,
  reloader: BigBrother.FS.Reloader,
  debounce: 1000,
  patterns: [
    ~r"lib/.*(ex)$"
  ]

Where the options are:

Starting the reloader

If your application was generated with a supervisor (by passing --sup to mix new) you will have a lib/my_app/application.ex file containing the application start callback that defines and starts your supervisor. You just need to edit the start/2 function to start the server as a supervisor on your application's supervisor:

def start(_type, _args) do
  children = [
    BigBrother.ReloadServer,
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end

Dependencies

  1. Big Brother first of all depends on Mix for both recompilation and relative paths, the library will not work without mix.

  2. Native binaries for FS library watch events :

Umbrella projects

The library supports umbrella projects. All that is required to make it work is to add the dependency and configuration to one of the projects.

TODO