diff options
author | Dave Smith <dizzyd@dizzyd.com> | 2010-06-11 10:03:41 -0600 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2010-06-11 10:03:41 -0600 |
commit | 8f9300124e05133deb991ff72b8f17e4c3d8714c (patch) | |
tree | 7737083a7eb5e179975ff9581c2ba86e1879c82b /src | |
parent | 6efd2516ce6b6d5ed2560e2ac28864a45472d85f (diff) |
Make delete-deps a bit smarter
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_deps.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 5833f29..08f2f54 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -106,7 +106,12 @@ compile(Config, AppFile) -> ok. 'delete-deps'(Config, _) -> - rebar_file_utils:rm_rf(get_deps_dir()). + %% Delete all the available deps, if any + Deps = rebar_config:get_local(Config, deps, []), + {AvailableDeps, _} = find_deps(Deps), + [delete_dep(D) || D <- AvailableDeps], + ok. + %% =================================================================== @@ -158,6 +163,15 @@ find_deps([Other | _Rest], _Acc) -> [Other, rebar_utils:get_cwd()]). +delete_dep(D) -> + case filelib:is_dir(D#dep.dir) of + true -> + ?INFO("Deleting dependency: ~s\n", [D#dep.dir]), + rebar_file_utils:rm_rf(D#dep.dir); + false -> + ok + end. + require_source_engine(Source) -> case source_engine_avail(Source) of true -> |