diff options
-rw-r--r-- | src/rebar_app_utils.erl | 2 | ||||
-rw-r--r-- | src/rebar_file_utils.erl | 4 | ||||
-rw-r--r-- | src/rebar_prv_deps_tree.erl | 29 |
3 files changed, 21 insertions, 14 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index 88b75ac..a7c78f5 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -165,7 +165,7 @@ dep_to_app(Parent, DepsDir, Name, Vsn, Source, IsLock, State) -> Dir = ec_cnv:to_list(filename:join(DepsDir, Name)), case rebar_app_info:discover(Dir) of {ok, App} -> - {ok, App}; + {ok, rebar_app_info:parent(App, Parent)}; not_found -> rebar_app_info:new(Parent, Name, Vsn, Dir, []) end diff --git a/src/rebar_file_utils.erl b/src/rebar_file_utils.erl index 2f39b96..732d83f 100644 --- a/src/rebar_file_utils.erl +++ b/src/rebar_file_utils.erl @@ -201,9 +201,9 @@ write_file_if_contents_differ(Filename, Bytes) -> {ok, ToWrite} -> ok; {ok, _} -> - file:write_file(Filename, ToWrite); + file:write_file(Filename, ToWrite, [raw]); {error, _} -> - file:write_file(Filename, ToWrite) + file:write_file(Filename, ToWrite, [raw]) end. %% returns an os appropriate tmpdir given a path diff --git a/src/rebar_prv_deps_tree.erl b/src/rebar_prv_deps_tree.erl index d429c52..5986521 100644 --- a/src/rebar_prv_deps_tree.erl +++ b/src/rebar_prv_deps_tree.erl @@ -49,26 +49,33 @@ print_deps_tree(SrcDeps, Verbose, State) -> ProjectAppNames = [{rebar_app_info:name(App) ,rebar_app_info:original_vsn(App) ,project} || App <- rebar_state:project_apps(State)], + io:setopts([{encoding, unicode}]), case dict:find(root, D) of {ok, Children} -> - print_children(-1, lists:keysort(1, Children++ProjectAppNames), D, Verbose); + print_children("", lists:keysort(1, Children++ProjectAppNames), D, Verbose); error -> - print_children(-1, lists:keysort(1, ProjectAppNames), D, Verbose) - end. + print_children("", lists:keysort(1, ProjectAppNames), D, Verbose) + end, + io:setopts([{encoding, latin1}]). print_children(_, [], _, _) -> ok; -print_children(Indent, [{Name, Vsn, Source} | Rest], Dict, Verbose) -> - - [io:format("| ") || _ <- lists:seq(0, Indent, 2)], - io:format("|- "), - io:format("~s-~s (~s)~n", [Name, Vsn, type(Source, Verbose)]), +print_children(Prefix, [{Name, Vsn, Source} | Rest], Dict, Verbose) -> + Prefix1 = case Rest of + [] -> + io:format("~ts└─ ", [Prefix]), + [Prefix, " "]; + _ -> + io:format("~ts├─ ", [Prefix]), + [Prefix, "│ "] + end, + io:format("~ts─~ts (~ts)~n", [Name, Vsn, type(Source, Verbose)]), case dict:find(Name, Dict) of {ok, Children} -> - print_children(Indent+2, lists:keysort(1, Children), Dict, Verbose), - print_children(Indent, Rest, Dict, Verbose); + print_children(Prefix1, lists:keysort(1, Children), Dict, Verbose), + print_children(Prefix, Rest, Dict, Verbose); error -> - print_children(Indent, Rest, Dict, Verbose) + print_children(Prefix, Rest, Dict, Verbose) end. type(project, _) -> |