summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rebar_ct.erl2
-rw-r--r--src/rebar_erlc_compiler.erl10
-rw-r--r--src/rebar_templater.erl21
-rw-r--r--src/rebar_upgrade.erl22
4 files changed, 47 insertions, 8 deletions
diff --git a/src/rebar_ct.erl b/src/rebar_ct.erl
index 04b2a51..74ae618 100644
--- a/src/rebar_ct.erl
+++ b/src/rebar_ct.erl
@@ -149,7 +149,7 @@ check_fail_log(Config, RawLog, Command, Result) ->
check_log(Config,RawLog,Fun) ->
{ok, Msg} =
- rebar_utils:sh("grep -e 'TEST COMPLETE' -e '{error,make_failed}' "
+ rebar_utils:sh("grep -e \"TEST COMPLETE\" -e \"{error,make_failed}\" "
++ RawLog, [{use_stdout, false}]),
MakeFailed = string:str(Msg, "{error,make_failed}") =/= 0,
RunFailed = string:str(Msg, ", 0 failed") =:= 0,
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index caef0d2..4157ba4 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -34,6 +34,7 @@
info/2]).
-include("rebar.hrl").
+-include_lib("stdlib/include/erl_compile.hrl").
%% ===================================================================
%% Public API
@@ -401,7 +402,14 @@ compile_mib(Source, Target, Config) ->
case snmpc:compile(Source, Opts) of
{ok, _} ->
Mib = filename:rootname(Target),
- ok = snmpc:mib_to_hrl(Mib),
+ MibToHrlOpts =
+ case proplists:get_value(verbosity, Opts, undefined) of
+ undefined ->
+ #options{specific = []};
+ Verbosity ->
+ #options{specific = [{verbosity, Verbosity}]}
+ end,
+ ok = snmpc:mib_to_hrl(Mib, Mib, MibToHrlOpts),
Hrl_filename = Mib ++ ".hrl",
rebar_file_utils:mv(Hrl_filename, "include"),
ok;
diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl
index e997975..b8f7087 100644
--- a/src/rebar_templater.erl
+++ b/src/rebar_templater.erl
@@ -347,6 +347,10 @@ write_file(Output, Data, Force) ->
{error, exists}
end.
+prepend_instructions(Instructions, Rest) when is_list(Instructions) ->
+ Instructions ++ Rest;
+prepend_instructions(Instruction, Rest) ->
+ [Instruction|Rest].
%%
%% Execute each instruction in a template definition file.
@@ -364,6 +368,23 @@ execute_template(_Files, [], _TemplateType, _TemplateName,
?ERROR("One or more files already exist on disk and "
"were not generated:~n~s~s", [Msg , Help])
end;
+execute_template(Files, [{'if', Cond, True} | Rest], TemplateType,
+ TemplateName, Context, Force, ExistingFiles) ->
+ execute_template(Files, [{'if', Cond, True, []}|Rest], TemplateType,
+ TemplateName, Context, Force, ExistingFiles);
+execute_template(Files, [{'if', Cond, True, False} | Rest], TemplateType,
+ TemplateName, Context, Force, ExistingFiles) ->
+ Instructions = case dict:find(Cond, Context) of
+ {ok, true} ->
+ True;
+ {ok, "true"} ->
+ True;
+ _ ->
+ False
+ end,
+ execute_template(Files, prepend_instructions(Instructions, Rest),
+ TemplateType, TemplateName, Context, Force,
+ ExistingFiles);
execute_template(Files, [{template, Input, Output} | Rest], TemplateType,
TemplateName, Context, Force, ExistingFiles) ->
InputName = filename:join(filename:dirname(TemplateName), Input),
diff --git a/src/rebar_upgrade.erl b/src/rebar_upgrade.erl
index d18603c..1441c5a 100644
--- a/src/rebar_upgrade.erl
+++ b/src/rebar_upgrade.erl
@@ -184,13 +184,23 @@ boot_files(TargetDir, Ver, Name) ->
filename:join([TargetDir, "releases", Ver, "start_clean.boot"]),
filename:join([".", ?TMP, "releases", Ver, "start_clean.boot"])),
- {ok, _} = file:copy(
- filename:join([TargetDir, "releases", Ver, "sys.config"]),
- filename:join([".", ?TMP, "releases", Ver, "sys.config"])),
+ SysConfig = filename:join([TargetDir, "releases", Ver, "sys.config"]),
+ case filelib:is_regular(SysConfig) of
+ true ->
+ {ok, _} = file:copy(
+ SysConfig,
+ filename:join([".", ?TMP, "releases", Ver, "sys.config"]));
+ false -> ok
+ end,
- {ok, _} = file:copy(
- filename:join([TargetDir, "releases", Ver, "vm.args"]),
- filename:join([".", ?TMP, "releases", Ver, "vm.args"])).
+ VmArgs = filename:join([TargetDir, "releases", Ver, "vm.args"]),
+ case filelib:is_regular(VmArgs) of
+ true ->
+ {ok, _} = file:copy(
+ VmArgs,
+ filename:join([".", ?TMP, "releases", Ver, "vm.args"]));
+ false -> {ok, 0}
+ end.
make_tar(NameVer, NewVer, NewName) ->
Filename = NameVer ++ ".tar.gz",