Modkit (modkit v0.10.0)

Copy Markdown View Source

Loads the modkit configuration of a Mix project.

The Mix tasks mix mod.relocate and mix mod.new call load_current_project/0 to know where the module files of the project belong. The returned project map contains the OTP application name, the mount built from the :modkit configuration (see Modkit.Mount), and the application directory.

Summary

Functions

Loads the project map of the current Mix project.

Builds a project map from a Mix project configuration.

Functions

load_current_project()

Loads the project map of the current Mix project.

The default root module is derived from the project module in mix.exs, so MyApp.MixProject gives MyApp. See load_project/3 for the contents of the project map.

load_project(default_root, config, opts \\ [])

Builds a project map from a Mix project configuration.

Accepts the root module used for the default mount points, a project configuration such as returned by Mix.Project.config/0, and options. Returns a map with the following keys:

  • :otp_app - the :app value of the configuration.
  • :mount - a Modkit.Mount struct built from the :mount entry of the :modkit configuration. When that entry is missing, the root module is mounted on the application code directory (as in {MyApp, "lib/my_app"}), the web module is mounted next to it with the :phoenix flavor (as in {MyAppWeb, "lib/my_app_web"}), and Mix.Tasks is mounted on lib/mix/tasks with the :mix_task flavor.
  • :app_dir - the application directory.

Options

  • :app_dir - the application directory to use in the project map. Defaults to the current working directory.