diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-02-06 09:39:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-06 09:39:13 -0500 |
commit | 4730440dfe52453f281d467a830e23fffd1e3ab4 (patch) | |
tree | 574593e4d17b9b73a884088c6a3ce40575a0811e /src | |
parent | b6bd27f2ffbe8c802d54b77371d3f0828eb9d471 (diff) | |
parent | 59a7bb51652598c456bf72409083261b988b84aa (diff) |
Merge pull request #1473 from ferd/global-plugin-tpl-support
Add support for global plugin-defined templates
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_templater.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index 9b33ec5..1c28788 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -334,8 +334,19 @@ find_plugin_templates(State) -> || App <- rebar_state:all_plugin_deps(State), Priv <- [rebar_app_info:priv_dir(App)], Priv =/= undefined, + File <- rebar_utils:find_files(Priv, ?TEMPLATE_RE)] + ++ %% and add global plugins too + [{plugin, File} + || PSource <- rebar_state:get(State, {plugins, global}, []), + Plugin <- [plugin_provider(PSource)], + is_atom(Plugin), + Priv <- [code:priv_dir(Plugin)], + Priv =/= undefined, File <- rebar_utils:find_files(Priv, ?TEMPLATE_RE)]. +plugin_provider(P) when is_atom(P) -> P; +plugin_provider(T) when is_tuple(T) -> element(1, T). + %% Take an existing list of templates and tag them by name the way %% the user would enter it from the CLI tag_names(List) -> |