From 6356112cbbb32b09dd2f94ea856c3cbd32b1c085 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 21 Sep 2014 09:19:38 -0500 Subject: more dialyzer fun. no likey opaque types --- src/rebar_prv_shell.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/rebar_prv_shell.erl') diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index 80f6bcf..bf37ddf 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -45,16 +45,16 @@ -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 shell", - short_desc = "Run shell with project apps and deps in path.", - desc = info(), - opts = []}), + provider_impl = ?MODULE, + bare = false, + deps = ?DEPS, + example = "rebar shell", + short_desc = "Run shell with project apps and deps in path.", + desc = info(), + opts = []}), {ok, State1}. --spec do(rebar_state:t()) -> {ok, rebar_state:t()} | relx:error(). +-spec do(rebar_state:t()) -> {ok, rebar_state:t()}. do(Config) -> shell(), {ok, Config}. -- cgit v1.1 From e9a3396e56679a11ac1caa3b47f1f196f0307d72 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 27 Sep 2014 14:12:11 -0500 Subject: return error messages from providers --- src/rebar_prv_shell.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rebar_prv_shell.erl') diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index bf37ddf..4bd0886 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -54,7 +54,7 @@ init(State) -> opts = []}), {ok, State1}. --spec do(rebar_state:t()) -> {ok, rebar_state:t()}. +-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(Config) -> shell(), {ok, Config}. -- cgit v1.1 From b37a5ae611aaf6b84a046fbe716f40c2aa8c75d8 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Fri, 3 Oct 2014 06:33:33 -0500 Subject: move providers to separate app --- src/rebar_prv_shell.erl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/rebar_prv_shell.erl') diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index 4bd0886..e74486d 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -28,7 +28,7 @@ -module(rebar_prv_shell). -author("Kresten Krab Thorup "). --behaviour(rebar_provider). +-behaviour(provider). -export([init/1, do/1]). @@ -44,14 +44,14 @@ -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 shell", - short_desc = "Run shell with project apps and deps in path.", - desc = info(), - opts = []}), + State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER}, + {module, ?MODULE}, + {bare, false}, + {deps, ?DEPS}, + {example, "rebar shell"}, + {short_desc, "Run shell with project apps and deps in path."}, + {desc, info()}, + {opts, []}])), {ok, State1}. -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. -- cgit v1.1 From 1dce2d36cc75263db279abd7f282772ce0f0f3e6 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Wed, 22 Oct 2014 12:03:49 -0500 Subject: add format_error/2 provider callback to providers --- src/rebar_prv_shell.erl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/rebar_prv_shell.erl') diff --git a/src/rebar_prv_shell.erl b/src/rebar_prv_shell.erl index e74486d..24e357b 100644 --- a/src/rebar_prv_shell.erl +++ b/src/rebar_prv_shell.erl @@ -31,7 +31,8 @@ -behaviour(provider). -export([init/1, - do/1]). + do/1, + format_error/2]). -include("rebar.hrl"). @@ -59,6 +60,10 @@ do(Config) -> shell(), {ok, Config}. +-spec format_error(any(), rebar_state:t()) -> {iolist(), rebar_state:t()}. +format_error(Reason, State) -> + {io_lib:format("~p", [Reason]), State}. + %% NOTE: %% this is an attempt to replicate `erl -pa ./ebin -pa deps/*/ebin`. it is %% mostly successful but does stop and then restart the user io system to get -- cgit v1.1