diff options
author | omarkj <omarkj@gmail.com> | 2014-11-03 13:58:58 -0800 |
---|---|---|
committer | omarkj <omarkj@gmail.com> | 2014-11-03 13:58:58 -0800 |
commit | a1d030c9649526422f58e0fb5dae9d33564b395a (patch) | |
tree | feb95f0fec3421ed876e1802584430e18e29f73f /src/rebar_prv_tar.erl | |
parent | 58f4019fa62a73e335967870f6605182d7386830 (diff) | |
parent | a3ec3a3424dd47e9687d0d2960ef2d3cba6a8f5c (diff) |
add help
Diffstat (limited to 'src/rebar_prv_tar.erl')
-rw-r--r-- | src/rebar_prv_tar.erl | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/rebar_prv_tar.erl b/src/rebar_prv_tar.erl index 7f5ab4f..04a1b33 100644 --- a/src/rebar_prv_tar.erl +++ b/src/rebar_prv_tar.erl @@ -3,10 +3,11 @@ -module(rebar_prv_tar). --behaviour(rebar_provider). +-behaviour(provider). -export([init/1, - do/1]). + do/1, + format_error/2]). -include("rebar.hrl"). @@ -19,17 +20,26 @@ -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. init(State) -> - State1 = rebar_state:add_provider(State, #provider{name = ?PROVIDER, - provider_impl = ?MODULE, - bare = false, - deps = ?DEPS, - example = "rebar tar", - short_desc = "Tar archive of release built of project.", - desc = "", - opts = []}), + State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, + {module, ?MODULE}, + {bare, false}, + {deps, ?DEPS}, + {example, "rebar tar"}, + {short_desc, "Tar archive of release built of project."}, + {desc, ""}, + {opts, []}])), {ok, State1}. --spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error(). -do(Config) -> - relx:main("release tar"), - {ok, Config}. +-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. +do(State) -> + case rebar_state:get(State, relx, []) of + [] -> + relx:main(["release tar"]); + Config -> + relx:main([{config, Config}], ["release tar"]) + end, + {ok, State}. + +-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}. +format_error(Reason, State) -> + {io_lib:format("~p", [Reason]), State}. |