mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 03:00:17 +00:00
Add list-deps command
This commit is contained in:
parent
bd1475d8e3
commit
85eb2957c3
1 changed files with 21 additions and 1 deletions
|
@ -34,7 +34,8 @@
|
|||
'check-deps'/2,
|
||||
'get-deps'/2,
|
||||
'update-deps'/2,
|
||||
'delete-deps'/2]).
|
||||
'delete-deps'/2,
|
||||
'list-deps'/2]).
|
||||
|
||||
|
||||
-record(dep, { dir,
|
||||
|
@ -139,6 +140,18 @@ compile(Config, AppFile) ->
|
|||
lists:prefix(DepsDir, D#dep.dir)],
|
||||
ok.
|
||||
|
||||
'list-deps'(Config, _) ->
|
||||
Deps = rebar_config:get_local(Config, deps, []),
|
||||
case find_deps(find, Deps) of
|
||||
{AvailDeps, []} ->
|
||||
lists:foreach(fun(Dep) ->
|
||||
?CONSOLE("~s\n", [print_source(Dep#dep.source)])
|
||||
end, AvailDeps),
|
||||
ok;
|
||||
{_, MissingDeps} ->
|
||||
?ABORT("Missing dependencies: ~p\n", [MissingDeps])
|
||||
end.
|
||||
|
||||
|
||||
%% ===================================================================
|
||||
%% Internal functions
|
||||
|
@ -449,3 +462,10 @@ has_vcs_dir(svn, Dir) ->
|
|||
orelse filelib:is_dir(filename:join(Dir, "_svn"));
|
||||
has_vcs_dir(_, _) ->
|
||||
true.
|
||||
|
||||
print_source({git, Url}) -> ?FMT("BRANCH ~s ~s", ["HEAD", Url]);
|
||||
print_source({git, Url, ""}) -> ?FMT("BRANCH ~s ~s", ["HEAD", Url]);
|
||||
print_source({git, Url, {branch, Branch}}) -> ?FMT("BRANCH ~s ~s", [Branch, Url]);
|
||||
print_source({git, Url, {tag, Tag}}) -> ?FMT("TAG ~s ~s", [Tag, Url]);
|
||||
print_source({_, Url, Rev}) -> ?FMT("REV ~s ~s", [Rev, Url]).
|
||||
|
||||
|
|
Loading…
Reference in a new issue