summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Smith <dizzyd@dizzyd.com>2010-08-28 08:04:47 -0600
committerDave Smith <dizzyd@dizzyd.com>2010-08-28 08:04:47 -0600
commitb32eeeafb7f5cb90a5c73a541e55b62556efee80 (patch)
treee0c4da52208d61814cfa1c719044995cc4650ac1 /src
parentf76ca38e95cee08ff80d3308ae4e08d0c4f4388f (diff)
Add support for specifying template directory on the command line
Diffstat (limited to 'src')
-rw-r--r--src/rebar_templater.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index e338455..e27c203 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -146,10 +146,19 @@ find_escript_templates() ->
re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match].
find_disk_templates() ->
+ OtherTemplates = find_other_templates(),
HomeFiles = rebar_utils:find_files(filename:join(os:getenv("HOME"),
".rebar/templates"), ?TEMPLATE_RE),
LocalFiles = rebar_utils:find_files(".", ?TEMPLATE_RE),
- [{file, F} || F <- HomeFiles++LocalFiles].
+ [{file, F} || F <- OtherTemplates ++ HomeFiles ++ LocalFiles].
+
+find_other_templates() ->
+ case rebar_config:get_global(template_dir, undefined) of
+ undefined ->
+ [];
+ TemplateDir ->
+ rebar_utils:find_files(TemplateDir, ?TEMPLATE_RE)
+ end.
select_template([], Template) ->
?ABORT("Template ~s not found.\n", [Template]);