mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
Add support for specifying template directory on the command line
This commit is contained in:
parent
f76ca38e95
commit
b32eeeafb7
1 changed files with 10 additions and 1 deletions
|
@ -146,10 +146,19 @@ find_escript_templates() ->
|
||||||
re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match].
|
re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match].
|
||||||
|
|
||||||
find_disk_templates() ->
|
find_disk_templates() ->
|
||||||
|
OtherTemplates = find_other_templates(),
|
||||||
HomeFiles = rebar_utils:find_files(filename:join(os:getenv("HOME"),
|
HomeFiles = rebar_utils:find_files(filename:join(os:getenv("HOME"),
|
||||||
".rebar/templates"), ?TEMPLATE_RE),
|
".rebar/templates"), ?TEMPLATE_RE),
|
||||||
LocalFiles = rebar_utils:find_files(".", ?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) ->
|
select_template([], Template) ->
|
||||||
?ABORT("Template ~s not found.\n", [Template]);
|
?ABORT("Template ~s not found.\n", [Template]);
|
||||||
|
|
Loading…
Reference in a new issue