diff options
author | Dave Smith <dizzyd@dizzyd.com> | 2010-02-20 20:15:07 -0700 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2010-02-20 20:15:07 -0700 |
commit | 28d3b756416922d2e38d08e5360b55bebc3e62bf (patch) | |
tree | fd64d378c5705e65acc6d9e4b0d0456d15cbff9e /src | |
parent | 496851cefd64d23445535e7bc8c519eaab739ac0 (diff) |
Fix bug in templater where escript was not found in subdirs were specified in rebar.config; minor formatting cleanups
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_core.erl | 5 | ||||
-rw-r--r-- | src/rebar_templater.erl | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/rebar_core.erl b/src/rebar_core.erl index 1cefe84..7cf0c7a 100644 --- a/src/rebar_core.erl +++ b/src/rebar_core.erl @@ -64,6 +64,11 @@ run(RawArgs) -> %% Convert command strings to atoms 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 process_dir(rebar_utils:get_cwd(), rebar_config:new(), CommandAtoms). diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index ebb3085..c4217cd 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -72,8 +72,9 @@ create(_Config, _) -> case parse_vars(Vars, dict:new()) of {error, Entry} -> Context0 = undefined, - ?ABORT("Failed while processing variables from template ~p. Variable definitions " - "must follow form of [{atom(), term()}]. Failed at: ~p\n", + ?ABORT("Failed while processing variables from template ~p." + "Variable definitions must follow form of " + "[{atom(), term()}]. Failed at: ~p\n", [template_id(), Entry]); Context0 -> ok @@ -110,7 +111,7 @@ create(_Config, _) -> %% cache_escript_files() -> {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). @@ -127,7 +128,8 @@ find_escript_templates() -> re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match]. 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), [{file, F} || F <- HomeFiles++LocalFiles]. |