This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
mix test # run all tests
mix test test/ui_test.exs # run a single test file
mix coveralls # test with coverage
mix dialyzer # type checking
mix credo # code lintingBootleg is an Elixir deployment automation library. It exposes a macro-based DSL (Bootleg.DSL) that users use in their config/deploy.exs files to describe build/deploy pipelines.
-
Bootleg.Config.Agent— a namedAgentprocess that holds all runtime state: roles, config key/values, and hook registrations. It starts automatically on first access and launches a monitor process that purges dynamically-compiled task/callback modules when the agent dies. -
Bootleg.Tasks— loads built-in task files (lib/bootleg/tasks/**/*.exs) viaCode.eval_file/1, then loads third-party task modules (anyElixir.Bootleg.Tasks.*module on the code path with aload/0), then evaluatesconfig/deploy.exsand the env-specificconfig/deploy/<env>.exs. -
Bootleg.DSL— the macro layer.task/2,before_task/2,after_task/2, andinvoke/1compile anonymous task bodies into dynamically-named modules (Elixir.Bootleg.DynamicTasks.*/Elixir.Bootleg.DynamicCallbacks.*) and register them in the agent.invoke/1runs before-hooks → task module → after-hooks in sequence. -
Bootleg.SSH— wrapsSSHKit(Erlang:ssh) to open connections, run commands viarun!/2, and transfer files viaupload/3/download/3. SSH options flow from role options throughssh_host_options/1; theidentity:option is converted to anSSHClientKeyAPIkey callback. -
Built-in tasks (
lib/bootleg/tasks/) — plain.exsfiles thatuse Bootleg.DSLand define the standard tasks::builddispatches to:remote_build(default),:local_build, or:docker_buildbased on thebuild_typeconfig key;:deployuploads/copies the tarball to:approle hosts and unpacks it;:start/:stop/:restart/:pingrunbin/<app>commands on:apphosts. -
Mix tasks (
lib/mix/tasks/) — thin wrappers (use Bootleg.MixTask, :<task_name>) that parse an optional env argument, set the env on the agent, then callinvoke/1.
%Bootleg.Role{}— name, user, list of%Bootleg.Host{}, keyword options. Roles are stored in the agent under:roles.%Bootleg.Host{}— wraps an%SSHKit.Host{}plus per-host options.- Config is a flat keyword list stored under
:configin the agent;config/2merges into it.
- Third-party packages can add tasks by defining a module named
Elixir.Bootleg.Tasks.<Name>with aload/0that callsConfig.load/1on their own.exsfile. - Users override built-in tasks with
task :name, override: true do ... endor install hooks withbefore_task/after_task.
config/deploy.exs → config/deploy/<env>.exs (e.g. config/deploy/production.exs)
Both files use use Bootleg.DSL. The env defaults to :production; pass an env name as the first argument to any mix task (e.g. mix bootleg.build staging) to change it.