From e5717547d518aa70ae299f1a1c11b962f0f85e8e Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 23 Nov 2014 15:04:09 -0600 Subject: update provider template for changes to format_error/1 --- priv/templates/plugin.erl.dtl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/priv/templates/plugin.erl.dtl b/priv/templates/plugin.erl.dtl index e525ab3..49c3974 100644 --- a/priv/templates/plugin.erl.dtl +++ b/priv/templates/plugin.erl.dtl @@ -1,12 +1,12 @@ -module({{name}}). -behaviour(provider). --export([init/1, do/1, format_error/2]). +-export([init/1, do/1, format_error/1]). -include_lib("rebar3/include/rebar.hrl"). --define(PROVIDER, todo). --define(DEPS, [app_discovery]). +-define(PROVIDER, {{name}}). +-define(DEPS, []). %% =================================================================== %% Public API @@ -14,10 +14,10 @@ -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. init(State) -> Provider = providers:create([ - {name, ?PROVIDER}, % The 'user friendly' name of the task - {module, ?MODULE}, % The module implementation of the task - {bare, true}, % The task can be run by the user, always true - {deps, ?DEPS}, % The list of dependencies + {name, ?PROVIDER}, % The 'user friendly' name of the task + {module, ?MODULE}, % The module implementation of the task + {bare, true}, % The task can be run by the user, always true + {deps, ?DEPS}, % The list of dependencies {example, "rebar {{name}}"}, % How to use the plugin {opts, []}, % list of options understood by the plugin {short_desc, "{{desc}}"}, @@ -31,5 +31,5 @@ do(State) -> {ok, State}. -spec format_error(any()) -> iolist(). -format_error(Reason, State) -> +format_error(Reason) -> io_lib:format("~p", [Reason]). -- cgit v1.1 From 4002e571418b7f793b395a76ea88080acfb1a640 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 23 Nov 2014 15:07:26 -0600 Subject: add .rebar3 to gitignore --- priv/templates/gitignore.dtl | 1 + 1 file changed, 1 insertion(+) diff --git a/priv/templates/gitignore.dtl b/priv/templates/gitignore.dtl index 9e09bf1..40a1d4f 100644 --- a/priv/templates/gitignore.dtl +++ b/priv/templates/gitignore.dtl @@ -1,3 +1,4 @@ +.rebar3 _* .eunit *.o -- cgit v1.1 From 6914429bc6e35fe5f30dc83fcc32e2f724c8be81 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 23 Nov 2014 15:08:17 -0600 Subject: remove include of rebar header from plugin template --- priv/templates/plugin.erl.dtl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/priv/templates/plugin.erl.dtl b/priv/templates/plugin.erl.dtl index 49c3974..d3528c0 100644 --- a/priv/templates/plugin.erl.dtl +++ b/priv/templates/plugin.erl.dtl @@ -3,10 +3,8 @@ -export([init/1, do/1, format_error/1]). --include_lib("rebar3/include/rebar.hrl"). - -define(PROVIDER, {{name}}). --define(DEPS, []). +-define(DEPS, [app_discovery]). %% =================================================================== %% Public API -- cgit v1.1 From 2e0ea8f8d27db2cabe5958f0c01ef66940b5ccc3 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 23 Nov 2014 15:11:22 -0600 Subject: update plugins doc to remove include of rebar header --- doc/plugins.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/plugins.md b/doc/plugins.md index 5ba8e65..ae43355 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -75,8 +75,6 @@ Open up the `src/provider_todo.erl` file and make sure you have the following sk -export([init/1, do/1, format_error/1]). --include_lib("rebar3/include/rebar.hrl"). - -define(PROVIDER, todo). -define(DEPS, [app_discovery]). -- cgit v1.1 From 414621fb82b796aa6c4f329958694a2c3faa5116 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sun, 23 Nov 2014 15:13:53 -0600 Subject: move rebar.hrl to src to keep private, not for use in plugins --- include/rebar.hrl | 45 --------------------------------------------- src/rebar.hrl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 include/rebar.hrl create mode 100644 src/rebar.hrl diff --git a/include/rebar.hrl b/include/rebar.hrl deleted file mode 100644 index 794d738..0000000 --- a/include/rebar.hrl +++ /dev/null @@ -1,45 +0,0 @@ -%% TODO: rename FAIL to ABORT once we require at least R13B04 for -%% building rebar. Macros with different arity were not supported by the -%% compiler before 13B04. --define(FAIL, rebar_utils:abort()). --define(ABORT(Str, Args), rebar_utils:abort(Str, Args)). - --define(CONSOLE(Str, Args), io:format(Str++"~n", Args)). - --define(DEBUG(Str, Args), rebar_log:log(debug, Str, Args)). --define(INFO(Str, Args), rebar_log:log(info, Str, Args)). --define(WARN(Str, Args), rebar_log:log(warn, Str, Args)). --define(ERROR(Str, Args), rebar_log:log(error, Str, Args)). - --define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))). - --define(DEFAULT_BASE_DIR, ""). --define(DEFAULT_LIB_DIRS, ["_checkouts", "apps", "lib", "."]). --define(DEFAULT_DEPS_DIR, "_deps"). --define(DEFAULT_PLUGINS_DIR, "_plugins"). --define(DEFAULT_TEST_DEPS_DIR, "_tdeps"). --define(DEFAULT_CONFIG_FILE, "rebar.config"). --define(LOCK_FILE, "rebar.lock"). --define(CONFIG_DIR, ".rebar3"). - --ifdef(namespaced_types). --type rebar_dict() :: dict:dict(). --else. --type rebar_dict() :: dict(). --endif. - --ifdef(namespaced_types). --type rebar_digraph() :: digraph:graph(). --else. --type rebar_digraph() :: digraph(). --endif. - --define(GRAPH_VSN, 2). --type v() :: {digraph:vertex(), term()} | 'false'. --type e() :: {digraph:vertex(), digraph:vertex()}. --type graph() :: {list(v()), list(e())}. --record(graph, - { - vsn = ?GRAPH_VSN :: pos_integer(), - info = {[], []} :: graph() - }). diff --git a/src/rebar.hrl b/src/rebar.hrl new file mode 100644 index 0000000..794d738 --- /dev/null +++ b/src/rebar.hrl @@ -0,0 +1,45 @@ +%% TODO: rename FAIL to ABORT once we require at least R13B04 for +%% building rebar. Macros with different arity were not supported by the +%% compiler before 13B04. +-define(FAIL, rebar_utils:abort()). +-define(ABORT(Str, Args), rebar_utils:abort(Str, Args)). + +-define(CONSOLE(Str, Args), io:format(Str++"~n", Args)). + +-define(DEBUG(Str, Args), rebar_log:log(debug, Str, Args)). +-define(INFO(Str, Args), rebar_log:log(info, Str, Args)). +-define(WARN(Str, Args), rebar_log:log(warn, Str, Args)). +-define(ERROR(Str, Args), rebar_log:log(error, Str, Args)). + +-define(FMT(Str, Args), lists:flatten(io_lib:format(Str, Args))). + +-define(DEFAULT_BASE_DIR, ""). +-define(DEFAULT_LIB_DIRS, ["_checkouts", "apps", "lib", "."]). +-define(DEFAULT_DEPS_DIR, "_deps"). +-define(DEFAULT_PLUGINS_DIR, "_plugins"). +-define(DEFAULT_TEST_DEPS_DIR, "_tdeps"). +-define(DEFAULT_CONFIG_FILE, "rebar.config"). +-define(LOCK_FILE, "rebar.lock"). +-define(CONFIG_DIR, ".rebar3"). + +-ifdef(namespaced_types). +-type rebar_dict() :: dict:dict(). +-else. +-type rebar_dict() :: dict(). +-endif. + +-ifdef(namespaced_types). +-type rebar_digraph() :: digraph:graph(). +-else. +-type rebar_digraph() :: digraph(). +-endif. + +-define(GRAPH_VSN, 2). +-type v() :: {digraph:vertex(), term()} | 'false'. +-type e() :: {digraph:vertex(), digraph:vertex()}. +-type graph() :: {list(v()), list(e())}. +-record(graph, + { + vsn = ?GRAPH_VSN :: pos_integer(), + info = {[], []} :: graph() + }). -- cgit v1.1