Projects
Kolab:Winterfell
erlang-rebar
0001-Don-t-load-templates-from-the-bundle.patch
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Don-t-load-templates-from-the-bundle.patch of Package erlang-rebar
From fe3b26384e237d067c601fbc29377a2b83d79c33 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> Date: Mon, 18 May 2015 11:45:03 +0200 Subject: [PATCH 1/7] Don't load templates from the bundle --- src/rebar_templater.erl | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index 085ac1c..efee394 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -205,27 +205,11 @@ create1(Config, TemplateId) -> execute_template(Files, FinalTemplate, Type, Template, Context, Force, []). find_templates(Config) -> - %% Load a list of all the files in the escript -- cache them since - %% we'll potentially need to walk it several times over the course of - %% a run. - Files = cache_escript_files(Config), - %% Build a list of available templates AvailTemplates = find_disk_templates(Config) - ++ find_escript_templates(Files), - - {AvailTemplates, Files}. + ++ find_escript_templates(), -%% -%% Scan the current escript for available files -%% -cache_escript_files(Config) -> - {ok, Files} = rebar_utils:escript_foldl( - fun(Name, _, GetBin, Acc) -> - [{Name, GetBin()} | Acc] - end, - [], rebar_config:get_xconf(Config, escript)), - Files. + {AvailTemplates, []}. template_id(Config) -> case rebar_config:get_global(Config, template, undefined) of @@ -235,10 +219,8 @@ template_id(Config) -> TemplateId end. -find_escript_templates(Files) -> - [{escript, Name} - || {Name, _Bin} <- Files, - re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match]. +find_escript_templates() -> + [{file, Name} || Name <- rebar_utils:find_files(code:priv_dir(rebar) ++ "/templates", ?TEMPLATE_RE)]. find_disk_templates(Config) -> OtherTemplates = find_other_templates(Config), @@ -269,10 +251,7 @@ select_template([{Type, Avail} | Rest], Template) -> %% %% Read the contents of a file from the appropriate source %% -load_file(Files, escript, Name) -> - {Name, Bin} = lists:keyfind(Name, 1, Files), - Bin; -load_file(_Files, file, Name) -> +load_file(_Files, _, Name) -> {ok, Bin} = file:read_file(Name), Bin. -- 2.5.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.