Browse Source

simplify mad up

Namdak Tonpa 10 years ago
parent
commit
dc994c8be7
2 changed files with 7 additions and 7 deletions
  1. BIN
      mad
  2. 7 7
      src/mad_deps.erl

BIN
mad


+ 7 - 7
src/mad_deps.erl

@@ -3,19 +3,19 @@
 -compile(export_all).
 -compile(export_all).
 
 
 pull(F) ->
 pull(F) ->
+    io:format("==> up: ~p~n", [F]),
     {_,Status,Message} = sh:run(io_lib:format("git -C ~p pull",[F])),
     {_,Status,Message} = sh:run(io_lib:format("git -C ~p pull",[F])),
     case Status of
     case Status of
          _ -> case binary:match(Message,[<<"Aborting">>,<<"timed out">>]) of
          _ -> case binary:match(Message,[<<"Aborting">>,<<"timed out">>]) of
-                   nomatch -> ok;
-                   _ -> io:format("~s",[binary_to_list(Message)]), error end;
-         0 -> ok end.
+                   nomatch -> false;
+                   _ -> io:format("~s",[binary_to_list(Message)]), true end;
+         0 -> false end.
 
 
 up(Params) ->
 up(Params) ->
     List = case Params of
     List = case Params of
-                [] -> [ F || F<- mad_repl:wildcards(["deps/*"]), filelib:is_dir(F) ];
-                Apps -> [ "deps/"++A || A <- Apps ] end,
-    lists:any(fun(X) -> X == error end,
-      [pull(".")] ++ [ begin io:format("==> up: ~p~n", [F]), pull(F) end || F <- List ]).
+                [] -> [ F || F <- mad_repl:wildcards(["deps/*"]), filelib:is_dir(F) ];
+                Apps -> [ "deps/" ++ A || A <- Apps ] end ++ ["."],
+    lists:any(fun(X) -> X end, [ pull(F) || F <- List ]).
 
 
 fetch(_, _Config, _, []) -> ok;
 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);