瀏覽代碼

Merge pull request #21 from tsloughter/master

update provider template for changes to format_error/1
pull/28/head
Fred Hebert 10 年之前
父節點
當前提交
8792c54883
共有 4 個檔案被更改,包括 8 行新增11 行删除
  1. +0
    -2
      doc/plugins.md
  2. +1
    -0
      priv/templates/gitignore.dtl
  3. +7
    -9
      priv/templates/plugin.erl.dtl
  4. +0
    -0
      src/rebar.hrl

+ 0
- 2
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]).

+ 1
- 0
priv/templates/gitignore.dtl 查看文件

@ -1,3 +1,4 @@
.rebar3
_*
.eunit
*.o

+ 7
- 9
priv/templates/plugin.erl.dtl 查看文件

@ -1,11 +1,9 @@
-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(PROVIDER, {{name}}).
-define(DEPS, [app_discovery]).
%% ===================================================================
@ -14,10 +12,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 +29,5 @@ do(State) ->
{ok, State}.
-spec format_error(any()) -> iolist().
format_error(Reason, State) ->
format_error(Reason) ->
io_lib:format("~p", [Reason]).

include/rebar.hrl → src/rebar.hrl 查看文件


Loading…
取消
儲存