Namdak Tonpa 9 лет назад
Родитель
Сommit
cd4b5932e4
8 измененных файлов с 61 добавлено и 43 удалено
  1. 41 20
      doc/commands.tex
  2. 0 4
      doc/setup.tex
  3. 1 1
      include/mad.hrl
  4. BIN
      mad
  5. 15 15
      src/mad.erl
  6. 2 1
      src/mad_plan.erl
  7. 1 1
      src/mad_utils.erl
  8. 1 1
      src/packaging/mad_release.erl

+ 41 - 20
doc/commands.tex

@@ -4,12 +4,14 @@ Synrc mad has a simple interface as follows:
 
 \vspace{1\baselineskip}
 \begin{lstlisting}
+  MAD Container Tool version b547fa
   BNF:
-      invoke := mad params
-      params := [] | run params
-         run := command [ options ]
-     command := app | lib | deps | compile | bundle
-                start | stop | repl
+      invoke = mad params
+      params = [] | run params
+         run = command [ options ]
+     command = app     | deps  | clean | compile | up
+             | release [ beam  | ling  | script  | runc | depot ]
+             | deploy  | start | stop  | attach  | sh
 \end{lstlisting}
 \vspace{1\baselineskip}
 
@@ -32,29 +34,48 @@ In rebar-like managers we are selecting deps from rebar.config:
 Performs compilation of all known compilations backends in complilation profile of mad:
 \vspace{1\baselineskip}
 \begin{lstlisting}
-    1. mad_app — app.src erlang templating.
-    2. mad_dtl — DTL compiler.
-    3. mad_erl — BEAM compiler.
-    4. mad_port — for gcc cland and other native compilation.
-    5. mad_script — .script file used in projects like gproc.
-    6. mad_yecc/mad_leex — DSL language parser compilers.
-    7. mad_upl — UPL compiler.
+    app — app.src erlang templating
+    dtl — DTL compiler
+    erl — BEAM compiler
+    c/c++ — for gcc cland and other native compilation
+    script — .script file used in projects like gproc
+    yrl/xrl — DSL language parser compilers
+    upl — UPL compiler
 \end{lstlisting}
 \vspace{1\baselineskip}
 
-\subsection{pla}
-Taking all dependecies and resolve boot sequence according to dependecy order. Storing this value in .applist.
+\subsection{release, rel}
+Taking all dependecies and resolve boot sequence according to dependecy order.
+Storing this value in .applist. If release type is not defined ({\bf beam} in following example),
+then {\bf script} release will be taken as a default.
 \vspace{1\baselineskip}
 \begin{lstlisting}
-  Ordered: [kernel,stdlib,fs,ranch,crypto,compiler,syntax_tools,
-            gproc,cowlib,cowboy,n2o,sample,active,erlydtl,jsone,
-            mad,nitro,sh]
+    $ mad release beam sample
+    Ordered: [kernel,stdlib,fs,ranch,crypto,compiler,syntax_tools,
+              gproc,cowlib,cowboy,n2o,sample,active,erlydtl,jsone,
+              mad,nitro,sh]
+    *WARNING* : Missing application sasl. Can not upgrade with this release
+    sample.boot: ok
+    OK:  "sample"
+
+    $ mad rel mad
+    Ordered: [kernel,stdlib,inets,sh,mad]
+    OK:  "mad"
 \end{lstlisting}
 \vspace{1\baselineskip}
 
-\subsection{repl}
+MAD supports several releasing backends:
 
-\subsection{bundle}
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    script — script bundles, like mad itself
+    beam — ERTS releases with systools
+    ling — LING portable unikernels
+    runc — Docker-compatible containers
+    depot — releases from binary repositories
+\end{lstlisting}
+\vspace{1\baselineskip}
 
-\subsection{app}
+\subsection{sh}
 
+Start REPL shell session.

+ 0 - 4
doc/setup.tex

@@ -23,10 +23,6 @@ If you want you can compile mad by yourself:
     # git clone http://github.com/synrc/mad \
              && cd mad \
              && make
-
-    # cat Makefile
-      default:
-          ./mad cle dep com bun mad
 \end{lstlisting}
 \vspace{1\baselineskip}
 

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"b547fa").
+-define(VERSION,"ed24a9").


+ 15 - 15
src/mad.erl

@@ -14,18 +14,6 @@ main(Params)      ->
         fun ({Name,Par},Errors) when length(Errors) > 0 -> [{error,Errors}];
             ({Name,Par},Errors) -> lists:flatten([errors((profile()):Name(Par))|Errors]) end, [], FP)))).
 
-help(Reason,D)    -> help(io_lib:format("~s ~p", [Reason, D])).
-help(Msg)         -> help().
-help()            -> info("MAD Container Tool version ~s~n",[?VERSION]),
-                     info("BNF: ~n"),
-                     info("    invoke := mad params~n"),
-                     info("    params := [] | run params ~n"),
-                     info("       run := command [ options ]~n"),
-                     info("   command := app [ sample ] | deps | clean  | compile | up |~n"),
-                     info("              release [ beam | ling | runc   | depot   | script ] |~n"),
-                     info("              deploy | start | stop | attach | sh ~n"),
-                     return(false).
-
 deps(Params)      -> mad_deps:deps(Params).
 compile(Params)   -> mad_compile:compile(Params).
 app(Params)       -> mad_static:app(Params).
@@ -43,9 +31,9 @@ unknown(Other)    -> info("Unknown: ~p~n",[Other]), help().
 
 errors(false)     -> [];
 errors(true)      -> {error,unknown};
-errors({ok,L})    -> info("OK:  ~p~n",[L]), [];
-errors({error,L}) -> info("ERR: ~p~n",[L]), {error,L};
-errors(X)         -> info("ERR: ~p~n",[X]), {error,X}.
+errors({ok,L})    -> info("OK:  ~tp~n",[L]), [];
+errors({error,L}) -> info("ERR: ~tp~n",[L]), {error,L};
+errors(X)         -> info("ERR: ~tp~n",[X]), {error,X}.
 
 return(true)      -> 1;
 return(false)     -> 0;
@@ -53,3 +41,15 @@ return(X)         -> X.
 
 info(Format)      -> io:format(lists:concat([Format,"\r"])).
 info(Format,Args) -> io:format(lists:concat([Format,"\r"]),Args).
+
+help(Reason,D)    -> help(io_lib:format("~s ~p", [Reason, D])).
+help(Msg)         -> help().
+help()            -> info("MAD Container Tool version ~s~n",[?VERSION]),
+                     info("BNF: ~n"),
+                     info("    invoke = mad params~n"),
+                     info("    params = [] | run params ~n"),
+                     info("       run = command [ options ]~n"),
+                     info("   command = app     | deps  | clean | compile | up~n"),
+                     info("           | release [ beam  | ling  | script  | runc | depot ]~n"),
+                     info("           | deploy  | start | stop  | attach  | sh ~n"),
+                     return(false).

+ 2 - 1
src/mad_plan.erl

@@ -45,5 +45,6 @@ system_deps(A) ->
 
 main(_) ->
     case orderapps() of
-         {ok,Ordered}   -> file:write_file(".applist",io_lib:format("~w",[Ordered])), {ok,Ordered};
+         {ok,Ordered}   -> mad:info("Ordered: ~p~n",[Ordered]),
+                           file:write_file(".applist",io_lib:format("~w",[Ordered])), {ok,Ordered};
          {error,Reason} -> {error,Reason} end.

+ 1 - 1
src/mad_utils.erl

@@ -16,7 +16,7 @@ atomize("sto"++_) -> stop;
 atomize("att"++_) -> attach;
 atomize("sh")     -> sh;
 atomize("static") -> static;
-atomize("pla"++_) -> plan;
+atomize("pla"++_) -> release;
 atomize(Else)     -> Else.
 
 cwd() -> {ok, Cwd} = file:get_cwd(), Cwd.

+ 1 - 1
src/packaging/mad_release.erl

@@ -15,7 +15,7 @@ atomlist(TARGETS) ->
     string:join(lists:map(fun(X) -> atom_to_list(X) end,TARGETS),",").
 
 depot_release(Name) ->
-    mad_plan:main(),
+    mad_plan:main([]),
     TARGETS   = [beam,ling],
     HOSTS     = [mac,bsd,windows],
     Depot     = "/Users/5HT/depot/synrc/synrc.com/apps/",