From 989a1bfe8d991846f81331a94eb65ffc10883cf5 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 20 Sep 2014 08:20:05 -0500 Subject: add plugin template --- priv/templates/plugin.erl.dtl | 29 +++++++++++++++++++++++++++++ priv/templates/plugin.template | 7 +++++++ priv/templates/plugin_README.md.dtl | 14 ++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 priv/templates/plugin.erl.dtl create mode 100644 priv/templates/plugin.template create mode 100644 priv/templates/plugin_README.md.dtl (limited to 'priv') diff --git a/priv/templates/plugin.erl.dtl b/priv/templates/plugin.erl.dtl new file mode 100644 index 0000000..3f8c9cd --- /dev/null +++ b/priv/templates/plugin.erl.dtl @@ -0,0 +1,29 @@ +-module({{appid}}). + +-behaviour(rebar_provider). + +-export([init/1, + do/1]). + +-define(PROVIDER, {{appid}}). +-define(DEPS, []). + +%% =================================================================== +%% Public API +%% =================================================================== + +-spec init(rebar_state:t()) -> {ok, rebar_state:t()}. +init(State) -> + State1 = rebar_state:(State, rebar_provider:create([{name, ?PROVIDER}, + {provider_impl, ?MODULE}, + {bare, false}, + {deps, ?DEPS}, + {example, "rebar {{appid}}"}, + {short_desc, "{{appid}} plugin."}, + {desc, ""}, + {opts, []}])), + {ok, State1}. + +-spec do(rebar_state:t()) -> {ok, rebar_state:t()}. +do(State) -> + {ok, State}. diff --git a/priv/templates/plugin.template b/priv/templates/plugin.template new file mode 100644 index 0000000..bc44863 --- /dev/null +++ b/priv/templates/plugin.template @@ -0,0 +1,7 @@ +{variables, []}. +{template, "plugin.erl", "src/{{appid}}.erl"}. +{template, "otp_lib.app.src", "src/{{appid}}.app.src"}. +{template, "rebar.config", "rebar.config"}. +{template, "gitignore", ".gitignore"}. +{template, "LICENSE", "LICENSE"}. +{template, "plugin_README.md", "README.md"}. diff --git a/priv/templates/plugin_README.md.dtl b/priv/templates/plugin_README.md.dtl new file mode 100644 index 0000000..19990f5 --- /dev/null +++ b/priv/templates/plugin_README.md.dtl @@ -0,0 +1,14 @@ +{{appid}} +===== + +Rebar3 plugin + +Build +----- + + $ rebar3 compile + +Use +--- + + $ rebar3 {{appid}} -- cgit v1.1