Namdak Tonpa 10 years ago
parent
commit
9fc62973d4
3 changed files with 8 additions and 6 deletions
  1. BIN
      mad
  2. 3 6
      src/mad_deps.erl
  3. 5 0
      src/mad_utils.erl

BIN
mad


+ 3 - 6
src/mad_deps.erl

@@ -6,10 +6,7 @@ pull(Config,F) ->
     io:format("==> up: ~p~n", [F]),
     {_,Status,Message} = sh:run(io_lib:format("git -C ~p pull",[F])),
     case Status of
-         0 -> case mad_utils:get_value(verbose, Config, 0) of
-                   0 -> skip;
-                   _ -> io:format("~s",[binary_to_list(Message)])
-              end, false;
+         0 -> mad_utils:verbose(Config,Message), false;
          _ -> case binary:match(Message,[<<"Aborting">>,<<"timed out">>]) of
                    nomatch -> false;
                    _ -> io:format("~s",[binary_to_list(Message)]), true end end.
@@ -42,7 +39,7 @@ fetch(Cwd, Config, ConfigFile, [H|T]) ->
 
 git_clone(Uri,Fast,TrunkPath,Rev) when Rev == "head" orelse Rev == "HEAD" orelse Rev == "master" ->
     {["git clone ",Fast,Uri," ",TrunkPath],Rev};
-git_clone(Uri,Fast,TrunkPath,Rev) ->
+git_clone(Uri,_Fast,TrunkPath,Rev) ->
     {["git clone ",Uri," ",TrunkPath," && cd ",TrunkPath," && git checkout \"",Rev,"\"" ],Rev}.
 
 fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
@@ -62,7 +59,7 @@ fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
         {_,Rev} -> git_clone(Uri,Fast,TrunkPath,Rev);
         Master  -> git_clone(Uri,Fast,TrunkPath,Master) end,
 
-    %io:format("Fetch: ~s~n",[R]),
+    io:format("Fetch: ~s~n",[R]),
 
     FetchStatus = case filelib:is_dir(TrunkPath) of
                        true -> {skip,0,list_to_binary("Directory "++TrunkPath++" exists.")};

+ 5 - 0
src/mad_utils.erl

@@ -99,5 +99,10 @@ fold_params(Params) ->
            E -> {[E|Current],Result} end
       end, {[],[]}, Atomized).
 
+verbose(Config,Message) ->
+    case mad_utils:get_value(verbose, Config, 0) of
+         0 -> skip;
+         _ -> io:format("~s",[binary_to_list(Message)]) end.
+
 compile(_,_,_,_,_) -> false.