mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
Fix bug in templater where escript was not found in subdirs were specified in rebar.config; minor formatting cleanups
This commit is contained in:
parent
496851cefd
commit
28d3b75641
2 changed files with 11 additions and 4 deletions
|
@ -64,6 +64,11 @@ run(RawArgs) ->
|
||||||
%% Convert command strings to atoms
|
%% Convert command strings to atoms
|
||||||
CommandAtoms = [list_to_atom(C) || C <- Commands],
|
CommandAtoms = [list_to_atom(C) || C <- Commands],
|
||||||
|
|
||||||
|
%% Determine the location of the rebar executable; important for pulling
|
||||||
|
%% resources out of the escript
|
||||||
|
rebar_config:set_global(escript, filename:absname(escript:script_name())),
|
||||||
|
?DEBUG("Rebar location: ~p\n", [rebar_config:get_global(escript, undefined)]),
|
||||||
|
|
||||||
%% Load rebar.config, if it exists
|
%% Load rebar.config, if it exists
|
||||||
process_dir(rebar_utils:get_cwd(), rebar_config:new(), CommandAtoms).
|
process_dir(rebar_utils:get_cwd(), rebar_config:new(), CommandAtoms).
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,9 @@ create(_Config, _) ->
|
||||||
case parse_vars(Vars, dict:new()) of
|
case parse_vars(Vars, dict:new()) of
|
||||||
{error, Entry} ->
|
{error, Entry} ->
|
||||||
Context0 = undefined,
|
Context0 = undefined,
|
||||||
?ABORT("Failed while processing variables from template ~p. Variable definitions "
|
?ABORT("Failed while processing variables from template ~p."
|
||||||
"must follow form of [{atom(), term()}]. Failed at: ~p\n",
|
"Variable definitions must follow form of "
|
||||||
|
"[{atom(), term()}]. Failed at: ~p\n",
|
||||||
[template_id(), Entry]);
|
[template_id(), Entry]);
|
||||||
Context0 ->
|
Context0 ->
|
||||||
ok
|
ok
|
||||||
|
@ -110,7 +111,7 @@ create(_Config, _) ->
|
||||||
%%
|
%%
|
||||||
cache_escript_files() ->
|
cache_escript_files() ->
|
||||||
{ok, Files} = escript:foldl(fun(Name, _, GetBin, Acc) -> [{Name, GetBin()} | Acc] end,
|
{ok, Files} = escript:foldl(fun(Name, _, GetBin, Acc) -> [{Name, GetBin()} | Acc] end,
|
||||||
[], escript:script_name()),
|
[], rebar_config:get_global(escript, undefined)),
|
||||||
erlang:put(escript_files, Files).
|
erlang:put(escript_files, Files).
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +128,8 @@ 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() ->
|
||||||
HomeFiles = rebar_utils:find_files(filename:join(os:getenv("HOME"), ".rebar/templates"), ?TEMPLATE_RE),
|
HomeFiles = rebar_utils:find_files(filename:join(os:getenv("HOME"),
|
||||||
|
".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 <- HomeFiles++LocalFiles].
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue