mix composer.gen.cookbook (composer v0.2.0)

Copy Markdown View Source

Scaffolds the current project's cookbook:

lib/composer/<app>.ex                 # the cookbook module
lib/composer/<app>/steps/.gitkeep
lib/composer/<app>/recipes/app.exs    # the recipe app/default
lib/composer/<app>/manifest.exs

Usage

mix composer.gen.cookbook
mix composer.gen.cookbook --bundled

Bundling with a framework

A framework that ships a cookbook alongside its own code, with composer as an optional dependency, passes --bundled. The cookbook module is then wrapped in if Code.ensure_loaded?(Composer) do ... end, so it compiles to nothing - and costs nothing - when composer is absent. Steps generated later with mix composer.gen.step get the same guard. Use it too when composer is a dev-only dependency of an app.

Options

  • --bundled - guard the cookbook so it compiles without composer