summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--priv/templates/plugin.erl.dtl29
-rw-r--r--priv/templates/plugin.template7
-rw-r--r--priv/templates/plugin_README.md.dtl14
-rw-r--r--src/rebar_core.erl3
-rw-r--r--src/rebar_templater.erl2
5 files changed, 54 insertions, 1 deletions
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}}
diff --git a/src/rebar_core.erl b/src/rebar_core.erl
index cb021e3..ce3816d 100644
--- a/src/rebar_core.erl
+++ b/src/rebar_core.erl
@@ -35,7 +35,8 @@ process_command(State, Command) ->
LibDirs = rebar_state:get(State, lib_dirs, ?DEFAULT_LIB_DIRS),
DepsDir = rebar_state:get(State, deps_dir, ?DEFAULT_DEPS_DIRS),
_UpdatedCodePaths = update_code_path([DepsDir | LibDirs]),
- rebar_prv_install_deps:setup_env(State),
+
+ %% ? rebar_prv_install_deps:setup_env(State),
TargetProviders = rebar_provider:get_target_providers(Command, State),
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index a795b66..048991b 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -47,6 +47,8 @@ new(app, DirName, State) ->
create1(State, DirName, "otp_app");
new(lib, DirName, State) ->
create1(State, DirName, "otp_lib");
+new(plugin, DirName, State) ->
+ create1(State, DirName, "plugin");
new(rel, DirName, State) ->
create1(State, DirName, "otp_rel").