Finds the cookbooks available to the current project.
Discovery is a convention lookup, not a scan. For each dependency app (and
the current project), composer checks whether Composer.<App> is loaded
and defines a cookbook. A dependency that ships lib/composer/<app>.ex is
found with no configuration.
The cookbooks, in order:
core, composer's built-in cookbook, always- the current project's own cookbook, if it defines one
- every dependency's cookbook
local, the user's config directory (seeComposer.Local)
The virtual hex cookbook is not listed; Composer.Resolver knows it.
Limiting cookbooks
The host app can allow or deny package cookbooks by name. core and
local are always available.
# config/config.exs
config :composer, cookbooks: [except: [:some_cookbook]]
config :composer, cookbooks: [only: [:composer_lab]]Dependencies must be compiled before discovery, which is why composer's
tasks run mix compile first; an uncompiled dependency's cookbook is not
loaded and so not found.
Summary
Functions
@spec cookbooks(keyword()) :: {:ok, [Composer.Cookbook.t()]} | {:error, term()}
Returns the available cookbooks.
Options
:config- the local config directory (-c):local- include thelocalcookbook (defaulttrue):apps- the apps to look in, instead of the project and its deps:modules- extra cookbook modules to include, for tests:filter-[only: names, except: names], instead of the app config
@spec own([Composer.Cookbook.t()]) :: Composer.Cookbook.t() | nil
The current project's own cookbook, if it defines one.