Namdak Tonpa 6 лет назад
Родитель
Сommit
256c6806b1
6 измененных файлов с 184 добавлено и 2 удалено
  1. 1 1
      include/mad.hrl
  2. 6 0
      index.html
  3. BIN
      mad
  4. 91 0
      man/mad.htm
  5. 84 0
      man/mad_local.htm
  6. 2 1
      src/profile/mad_local.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"384338").
+-define(VERSION,"d05a37").

+ 6 - 0
index.html

@@ -66,6 +66,12 @@
            | bundle [beam|script] <name> | get <repo> | up [name]
            | start | stop | attach | repl | static [watch|min]
         </code></figure>
+        <div>
+        <ul>
+            <li><b><a href="man/mad.htm">mad</a></b> &mdash; MAD Main Module</li>
+            <li><b><a href="man/mad_local.htm">mad_local</a></b> &mdash; MAD POSIX Profile</li>
+        </ul>
+        </div>
     </section>
     <section>
         <a name=docs><h3>APP</h3></a>


+ 91 - 0
man/mad.htm

@@ -0,0 +1,91 @@
+<html>
+
+<head>
+    <meta charset="utf-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="description" content="" />
+    <meta name="author" content="Maxim Sokhatsky" />
+    <title>MAD</title>
+    <link rel="stylesheet" href="https://synrc.space/synrc.css" />
+</head>
+
+<body>
+
+<nav>
+    <a href='https://synrc.space/'>SYNRC</a>
+    <a href='https://n2o.space'>N2O ECO</a>
+    <a href='https://mad.n2o.space'>MAD</a>
+</nav>
+
+<header>
+    <a href="../index.html"><img src="https://n2o.space/img/Synrc Neo.svg"></a>
+    <h1>MAD</h1>
+</header>
+
+<main>
+    <section>
+
+<h3>INTRO</h3>
+
+   <p>MAD module provides user level interface for console commands.</p>
+
+        <p><blockquote><p><ul>
+            <li><b><a href="#main">main/1</a></b> &mdash; IO parameters.</li>
+            <li><b><a href="#help">help/0</a></b> &mdash; Display help.</li>
+            <li><b><a href="#profile">profile/0</a></b> &mdash; Current MAD profile.</li>
+            <li><b><a href="#atomize">atomize/1</a></b> &mdash; Commands mappings.</li>
+        </ul></p></blockquote></p>
+
+    </section>
+    <section>
+
+<h3>PROFILE</h3>
+
+<p>Each MAD profile must imeplent exposed API:</p>
+
+    <figure><code>
+ -define(MAD,[compile/1,app/1,get/1,release/1,resolve/1,clean/1,
+              start/1,attach/1,stop/1,sh/1,deps/1,up/1,fetch/1,
+              static/1,eunit/1,strip/1]).
+    </code></figure>
+
+    </section>
+    <section>
+        <h3>LOOP</h3>
+        <figure><code>
+ main(Params) ->
+
+   { Invalid, Valid } = lists:foldr(
+        fun (X,{C,R}) when is_atom(X) -> {[],[{X,C}|R]};
+                            (X,{C,R}) -> {[X|C],R} end,
+             {[],[]}, lists:map(fun atomize/1, Params)),
+
+   halt(return(
+     lists:any(fun({error,X}) -> mad:info("~s~n",[X]), true;
+                          (_) -> false end,
+     lists:flatten([
+     lists:foldl(
+     fun ({Fun,Arg},ErrAcc) ->
+         mad_hooks:run_hooks(pre, Fun),
+         Errors = errors((profile()):Fun(Arg)),
+         mad_hooks:run_hooks(post, Fun),
+         Errors ++ ErrAcc
+     end, [], Valid)])))).
+        </code></figure>
+    </section>
+    <section>
+
+<p>This module may refer to:
+<a href="mad_local.htm"><b>mad_local</b></a>.
+</p>
+
+    </section>
+</main>
+
+<footer>
+    2005&mdash;2018 &copy; Synrc Research Center
+</footer>
+
+</body>
+</html>

+ 84 - 0
man/mad_local.htm

@@ -0,0 +1,84 @@
+<html>
+
+<head>
+    <meta charset="utf-8" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="description" content="" />
+    <meta name="author" content="Maxim Sokhatsky" />
+    <title>MAD LOCAL</title>
+    <link rel="stylesheet" href="https://synrc.space/synrc.css" />
+</head>
+
+<body>
+
+<nav>
+    <a href='https://synrc.space/'>SYNRC</a>
+    <a href='https://n2o.space'>N2O ECO</a>
+    <a href='https://mad.n2o.space'>MAD</a>
+</nav>
+
+<header>
+    <a href="../index.html"><img src="https://n2o.space/img/Synrc Neo.svg"></a>
+    <h1>LOCAL</h1>
+</header>
+
+<main>
+    <section>
+
+<h3>INTRO</h3>
+
+   <p>MAD LOCAL profile implement MAD profile backend interface
+      for POSIX environment and developer's purposes.</p>
+
+    </section>
+    <section>
+
+<h3>PROFILE</h3>
+
+<p>In sys.config you should specify kvs backend and list of modules
+   containing <b>metainfo/0</b> exported function.</p>
+
+    <figure><code>
+ application:get_env(mad,profile,mad_local).
+    </code></figure>
+
+    <figure><code>
+ -module(mad_local).
+ -include("mad.hrl").
+ -export(?MAD).
+
+ compile(Params)   -> mad_compile:compile(Params).
+ app(Params)       -> mad_static:app(Params).
+ get(Params)       -> mad_git:get_repo(Params).
+ release(Params)   -> mad_release:release(Params).
+ resolve(Params)   -> mad_resolve:main(Params).
+ clean(Params)     -> mad_run:clean(Params).
+ start(Params)     -> mad_run:start(Params).
+ attach(Params)    -> mad_run:attach(Params).
+ stop(Params)      -> mad_run:stop(Params).
+ sh(Params)        -> mad_repl:sh(Params).
+ deps(Params)      -> mad_git:deps(Params).
+ up(Params)        -> mad_git:up(Params).
+ fetch(Params)     -> mad_git:fetch(Params).
+ static(Params)    -> mad_static:main([],Params).
+ eunit(Params)     -> mad_eunit:main_test(Params).
+ strip(Params)     -> mad_strip:main(Params).
+    </code></figure>
+
+    </section>
+    <section>
+
+<p>This module may refer to:
+<a href="mad_git.htm"><b>mad_git</b></a>.
+</p>
+
+    </section>
+</main>
+
+<footer>
+    2005&mdash;2018 &copy; Synrc Research Center
+</footer>
+
+</body>
+</html>

+ 2 - 1
src/profile/mad_local.erl

@@ -1,5 +1,6 @@
 -module(mad_local).
--compile(export_all).
+-include("api.hrl").
+-export(?MAD).
 
 compile(Params)   -> mad_compile:compile(Params).
 app(Params)       -> mad_static:app(Params).