summaryrefslogtreecommitdiff
path: root/src/rebar_prv_release.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_prv_release.erl')
-rw-r--r--src/rebar_prv_release.erl40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/rebar_prv_release.erl b/src/rebar_prv_release.erl
index 4203c3a..572f909 100644
--- a/src/rebar_prv_release.erl
+++ b/src/rebar_prv_release.erl
@@ -3,10 +3,11 @@
-module(rebar_prv_release).
--behaviour(rebar_provider).
+-behaviour(provider).
-export([init/1,
- do/1]).
+ do/1,
+ format_error/2]).
-include("rebar.hrl").
@@ -19,17 +20,28 @@
-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 release",
- short_desc = "Build release of project.",
- desc = "",
- opts = []}),
+ State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
+ {module, ?MODULE},
+ {bare, false},
+ {deps, ?DEPS},
+ {example, "rebar release"},
+ {short_desc, "Build release of project."},
+ {desc, ""},
+ {opts, relx:opt_spec_list()}])),
{ok, State1}.
--spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error().
-do(Config) ->
- relx:main("release"),
- {ok, Config}.
+-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
+do(State) ->
+ Options = rebar_state:command_args(State),
+ AllOptions = string:join(["release" | Options], " "),
+ case rebar_state:get(State, relx, []) of
+ [] ->
+ relx:main(AllOptions);
+ Config ->
+ relx:main([{config, Config}], AllOptions)
+ end,
+ {ok, State}.
+
+-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}.
+format_error(Reason, State) ->
+ {io_lib:format("~p", [Reason]), State}.