Browse Source

raw revision for cowboy 1.0.1, more precise 'deps' option recognition

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

BIN
mad


+ 8 - 9
src/mad_deps.erl

@@ -17,12 +17,9 @@ fetch(Cwd, Config, ConfigFile, [H|T]) when is_tuple(H) =:= false -> fetch(Cwd, C
 fetch(Cwd, Config, ConfigFile, [H|T]) ->
     {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"}
+                         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),
@@ -32,6 +29,9 @@ fetch(Cwd, Config, ConfigFile, [H|T]) ->
     end,
     fetch(Cwd, Config, ConfigFile, T).
 
+git_clone(Uri,Fast,TrunkPath,Rev) ->
+    {["git clone ",Fast,Uri," ",TrunkPath," && cd ",TrunkPath," && git checkout \"",Rev,"\"" ],Rev}.
+
 fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
 
     TrunkPath = case Cache of
@@ -47,9 +47,8 @@ fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
                     _  -> "" end,
 
     {R,Co1} = case Co of
-        {_,Rev} ->
-            {["git clone ",Fast,Uri," ",TrunkPath," && cd ",TrunkPath,
-             " && git checkout \"",Rev,"\"" ],Rev};
+        X when is_list(X) -> git_clone(Uri,Fast,TrunkPath,X);
+        {_,Rev} -> git_clone(Uri,Fast,TrunkPath,Rev);
         Master -> {["git clone ",Fast,Uri," ",TrunkPath],lists:concat([Master])} end,
 
     os:cmd(R),

+ 2 - 1
src/mad_utils.erl

@@ -69,7 +69,8 @@ atomize("com"++_) -> compile;
 atomize("rep"++_) -> repl;
 atomize("up")     -> up;
 atomize("bun"++_) -> bundle;
-atomize("dep"++_) -> deps;
+atomize("dep")    -> deps;
+atomize("deps")   -> deps;
 atomize("pla"++_) -> plan;
 atomize("app"++_) -> app;
 atomize("lib"++_) -> lib;