From 44a30ca52f3c74d19007fd0433f6192fa4ccca79 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 18 Dec 2015 22:44:20 -0500 Subject: Plugin templates enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets a plugin define templates to be loaded: $ rebar3 new ... proper (plugin): A basic PropEr suite for an OTP application ... $ rebar3 new help proper proper: plugin template (...) Description: A basic PropEr suite for an OTP application Variables: name="suite" (...) ... → rebar3 new proper fakesuite ===> Writing test/prop_fakesuite.erl In this case, proper is a fake template file I've put by hand in _build/default/plugins/rebar3_proper/priv//, meaning it will only work as far as it's called from the project's root. The priority order of plugins is now .config > plugin > built-in, such that someone could ensure plugins do not crush their own private templates, but also that custom or plugin templates do overtake built-in ones. It used to be Built-in > .config only. Templates are searched for recursively in the priv/ directory of plugins. --- src/rebar_prv_new.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rebar_prv_new.erl') diff --git a/src/rebar_prv_new.erl b/src/rebar_prv_new.erl index 71560d5..064315e 100644 --- a/src/rebar_prv_new.erl +++ b/src/rebar_prv_new.erl @@ -132,10 +132,13 @@ show_template({Name, Type, Location, Description, Vars}) -> format_vars(Vars)]). format_type(escript) -> "built-in"; +format_type(plugin) -> "plugin"; format_type(file) -> "custom". format_type(escript, _) -> "built-in template"; +format_type(plugin, Loc) -> + io_lib:format("plugin template (~s)", [Loc]); format_type(file, Loc) -> io_lib:format("custom template (~s)", [Loc]). -- cgit v1.1