Ectomancer.Installer.ConfigUpdater (Ectomancer v1.2.1)

Copy Markdown View Source

Updates project configuration files for Ectomancer integration.

Handles:

  • Adding dependency to mix.exs
  • Adding repo config to config/config.exs
  • Adding Plug route to router file

Summary

Functions

Updates config/config.exs with Ectomancer repo configuration.

Updates all necessary configuration files for Ectomancer.

Updates mix.exs to add Ectomancer dependency.

Updates router file with Ectomancer Plug route.

Functions

update_config_exs(path)

@spec update_config_exs(String.t()) :: {:ok, String.t()} | :not_modified | :error

Updates config/config.exs with Ectomancer repo configuration.

update_files(opts \\ [])

@spec update_files(keyword()) :: map()

Updates all necessary configuration files for Ectomancer.

Arguments

  • opts - Keyword list with options:
    • :mix_path - Path to mix.exs (default: "mix.exs")
    • :config_path - Path to config/config.exs (default: "config/config.exs")
    • :router_path - Path to router file (auto-detected)

Returns

Map with status of each update: %{

mix_exs: {:ok, "added dependency"} | :not_modified | :error,
config_exs: {:ok, "added config"} | :not_modified | :error,
router_exs: {:ok, "added route"} | :not_modified | :error

}

update_mix_exs(path)

@spec update_mix_exs(String.t()) :: {:ok, String.t()} | :not_modified | :error

Updates mix.exs to add Ectomancer dependency.

update_router_exs(path)

@spec update_router_exs(String.t()) :: {:ok, String.t()} | :not_modified | :error

Updates router file with Ectomancer Plug route.