diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_deps.erl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 01cfad3..fe73ca5 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -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]). + |