Bootleg.Task behaviour (bootleg v0.13.0) View Source

Bootleg supports automatic discovery of tasks found in your dependencies, or your project itself.

To define a task that will automatically be loaded, define a new module in Bootleg.Tasks, and use Bootleg.Task, passing along a block containing Bootleg DSL commands. Tasks defined in this manner will be automatically loaded immediately after the core Bootleg tasks are loaded, and before config/deploy.exs. This is the recommended way to write tasks that you intend to share with others.

defmodule Bootleg.Tasks.Example do
  use Bootleg.Task do
    task :example do
      IO.puts "Hello!"
    end

    before_task :build, :example
  end
end

Technically speaking, any module in the namespace Bootleg.Tasks that exports a load/0 function will be discovered and executed by Bootleg automatically. This usage is not recommended unless you need to do work before use Bootleg.DSL.

defmodule Bootleg.Tasks.Other do
  use Bootleg.Task
  def load do

    task :other do
      IO.puts "World?"
    end
  end
end

These tasks can be packaged and distributed via hex packages, or you can make your own specific to your application.

Link to this section Summary

Callbacks

A task needs to implement load which receives no arguments. Return values are ignored.

Link to this section Callbacks

Specs

load() :: any()

A task needs to implement load which receives no arguments. Return values are ignored.

If you use the block version of use Bootleg.Task, this callback will be generated for you.