mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Apply Tidier suggestions
This commit is contained in:
parent
8eb1fc8308
commit
1e342faee8
5 changed files with 18 additions and 24 deletions
|
@ -324,17 +324,15 @@ is_command_name_sub_word_candidate(Command, Candidate) ->
|
|||
%% Allow for parts of commands to be abbreviated, i.e. create-app
|
||||
%% can be shortened to "create-a", "c-a" or "c-app" (but not
|
||||
%% "create-" since that would be ambiguous).
|
||||
CommandSubWords = re:split(Command, "-", [{return, list}]),
|
||||
CandidateSubWords = re:split(Candidate, "-", [{return, list}]),
|
||||
ReOpts = [{return, list}],
|
||||
CommandSubWords = re:split(Command, "-", ReOpts),
|
||||
CandidateSubWords = re:split(Candidate, "-", ReOpts),
|
||||
is_command_name_sub_word_candidate_aux(CommandSubWords, CandidateSubWords).
|
||||
|
||||
is_command_name_sub_word_candidate_aux([CmdSW | CmdSWs], [CandSW | CandSWs]) ->
|
||||
case lists:prefix(CmdSW, CandSW) of
|
||||
true ->
|
||||
is_command_name_sub_word_candidate_aux(CmdSWs, CandSWs);
|
||||
false ->
|
||||
false
|
||||
end;
|
||||
is_command_name_sub_word_candidate_aux([CmdSW | CmdSWs],
|
||||
[CandSW | CandSWs]) ->
|
||||
lists:prefix(CmdSW, CandSW) andalso
|
||||
is_command_name_sub_word_candidate_aux(CmdSWs, CandSWs);
|
||||
is_command_name_sub_word_candidate_aux([], []) ->
|
||||
true;
|
||||
is_command_name_sub_word_candidate_aux(_CmdSWs, _CandSWs) ->
|
||||
|
|
|
@ -63,9 +63,7 @@
|
|||
filename:join([NewName, "lib"]), "^.*.appup$"),
|
||||
|
||||
%% Convert the list of appup files into app names
|
||||
AppUpApps = lists:map(fun(File) ->
|
||||
file_to_name(File)
|
||||
end, NewAppUpFiles),
|
||||
AppUpApps = [file_to_name(File) || File <- NewAppUpFiles],
|
||||
|
||||
%% Create a list of apps that don't already have appups
|
||||
UpgradeApps = genappup_which_apps(Upgraded, AppUpApps),
|
||||
|
@ -115,7 +113,7 @@ upgraded_app(_, _, _) ->
|
|||
app_list_diff(List1, List2) ->
|
||||
List3 = lists:umerge(lists:sort(proplists:get_keys(List1)),
|
||||
lists:sort(proplists:get_keys(List2))),
|
||||
lists:subtract(List3, proplists:get_keys(List2)).
|
||||
List3 -- proplists:get_keys(List2).
|
||||
|
||||
file_to_name(File) ->
|
||||
filename:rootname(filename:basename(File)).
|
||||
|
@ -180,13 +178,10 @@ generate_instruction_advanced(Name, _, _) ->
|
|||
|
||||
get_behavior(List) ->
|
||||
Attributes = proplists:get_value(attributes, List),
|
||||
Behavior = case proplists:get_value(behavior, Attributes) of
|
||||
undefined ->
|
||||
proplists:get_value(behaviour, Attributes);
|
||||
Else ->
|
||||
Else
|
||||
end,
|
||||
Behavior.
|
||||
case proplists:get_value(behavior, Attributes) of
|
||||
undefined -> proplists:get_value(behaviour, Attributes);
|
||||
Else -> Else
|
||||
end.
|
||||
|
||||
is_code_change(List) ->
|
||||
Exports = proplists:get_value(exports, List),
|
||||
|
|
|
@ -362,7 +362,7 @@ os_env() ->
|
|||
Os = [list_to_tuple(re:split(S, "=", [{return, list}, {parts, 2}])) ||
|
||||
S <- os:getenv()],
|
||||
%% Drop variables without a name (win32)
|
||||
[{K, V} || {K, V} <- Os, K =/= []].
|
||||
[T1 || {K, _V} = T1 <- Os, K =/= []].
|
||||
|
||||
default_env() ->
|
||||
[
|
||||
|
|
|
@ -302,7 +302,7 @@ execute_overlay([{template_wildcard, Wildcard, OutDir} | Rest], Vars, BaseDir, T
|
|||
[{template, F, filename:join(OutDir, filename:basename(F))} | Acc0]
|
||||
end,
|
||||
NewInstrs = lists:foldl(Ifun, Rest, filelib:wildcard(Wildcard, BaseDir)),
|
||||
case length(NewInstrs) == length(Rest) of
|
||||
case length(NewInstrs) =:= length(Rest) of
|
||||
true ->
|
||||
?WARN("template_wildcard: ~s did not match any files!\n", [Wildcard]);
|
||||
false ->
|
||||
|
|
|
@ -81,7 +81,8 @@ run_checks(OldVerPath, ReltoolFile) ->
|
|||
true = rebar_utils:prop_check(filelib:is_dir(NamePath),
|
||||
"Release directory doesn't exist (~p)~n", [NamePath]),
|
||||
|
||||
{NewName, NewVer} = rebar_rel_utils:get_rel_release_info(Name, NamePath),
|
||||
{NewName, NewVer} = NewNameAndVer =
|
||||
rebar_rel_utils:get_rel_release_info(Name, NamePath),
|
||||
{OldName, OldVer} = rebar_rel_utils:get_rel_release_info(Name, OldVerPath),
|
||||
|
||||
true = rebar_utils:prop_check(NewName == OldName,
|
||||
|
@ -93,7 +94,7 @@ run_checks(OldVerPath, ReltoolFile) ->
|
|||
true = rebar_utils:prop_check(Ver == NewVer,
|
||||
"Reltool and .rel versions do not match~n", []),
|
||||
|
||||
{NewName, NewVer}.
|
||||
NewNameAndVer.
|
||||
|
||||
setup(OldVerPath, NewName, NewVer, NameVer) ->
|
||||
NewRelPath = filename:join([".", NewName]),
|
||||
|
|
Loading…
Reference in a new issue