rebar_resource_v2 behaviour (rebar v0.0.0+build.5492.ref67808dff)

View Source

Summary

Types

location/0

-type location() :: string().

ref/0

-type ref() :: any().

resource/0

-type resource() ::
          #resource{type :: atom(),
                    module :: module(),
                    state :: term(),
                    implementation :: rebar_resource | rebar_resource_v2}.

resource_state/0

-type resource_state() :: term().

source/0

-type source() ::
          {type(), location(), ref()} |
          {type(), location(), ref(), binary()} |
          {type(), location(), ref(), binary(), binary()}.

type/0

-type type() :: atom().

Callbacks

download/4

-callback download(file:filename_all(), rebar_app_info:t(), rebar_state:t(), resource_state()) ->
                      ok | {error, any()}.

init/2

-callback init(type(), rebar_state:t()) -> {ok, resource()}.

lock/2

-callback lock(rebar_app_info:t(), resource_state()) -> source().

make_vsn/2

-callback make_vsn(rebar_app_info:t(), resource_state()) -> {plain, string()} | {error, string()}.

needs_update/2

-callback needs_update(rebar_app_info:t(), resource_state()) -> boolean().

Functions

download(TmpDir, AppInfo, State)

find_resource_state(Type, Resources)

format_error(_)

format_source(AppInfo)

lock(AppInfo, State)

make_vsn(AppInfo, Vsn, State)

needs_update(AppInfo, State)

new(Type, Module, State)

-spec new(type(), module(), term()) -> resource().