Browse Source

Don't need to parse dependency if already fetched

This is necessary for dependencies that don't specify where they should
be fetched.
Rudi Grinberg 10 years ago
parent
commit
afaf3edf53
1 changed files with 9 additions and 8 deletions
  1. 9 8
      src/mad_deps.erl

+ 9 - 8
src/mad_deps.erl

@@ -21,16 +21,17 @@ fetch(_, _Config, _, []) -> ok;
 fetch(Cwd, Config, ConfigFile, [H|T]) when is_tuple(H) =:= false -> fetch(Cwd, Config, ConfigFile, T);
 fetch(Cwd, Config, ConfigFile, [H|T]) when is_tuple(H) =:= false -> fetch(Cwd, Config, ConfigFile, T);
 fetch(Cwd, Config, ConfigFile, [H|T]) ->
 fetch(Cwd, Config, ConfigFile, [H|T]) ->
     {Name, Repo} = name_and_repo(H),
     {Name, Repo} = name_and_repo(H),
-    {Cmd, Uri, Co} = case Repo of
-                         V={_, _, _}          -> V;
-                         {_Cmd, _Url, _Co, _} -> {_Cmd, _Url, _Co};
-                         {_Cmd, _Url}         -> {_Cmd, _Url, "master"}
-                     end,
-    Cmd1 = atom_to_list(Cmd),
-    Cache = mad_utils:get_value(cache, Config, deps_fetch),
     case get(Name) of
     case get(Name) of
         fetched -> ok;
         fetched -> ok;
-        _ -> fetch_dep(Cwd, Config, ConfigFile, Name, Cmd1, Uri, Co, Cache)
+        _ ->
+            {Cmd, Uri, Co} = case Repo of
+                                 V={_, _, _}          -> V;
+                                 {_Cmd, _Url, _Co, _} -> {_Cmd, _Url, _Co};
+                                 {_Cmd, _Url}         -> {_Cmd, _Url, "master"}
+                             end,
+            Cmd1 = atom_to_list(Cmd),
+            Cache = mad_utils:get_value(cache, Config, deps_fetch),
+            fetch_dep(Cwd, Config, ConfigFile, Name, Cmd1, Uri, Co, Cache)
     end,
     end,
     fetch(Cwd, Config, ConfigFile, T).
     fetch(Cwd, Config, ConfigFile, T).