Browse Source

Merge branch 'master' of github.com:synrc/mad

Namdak Tonpa 10 years ago
parent
commit
277c37410e
4 changed files with 152 additions and 15 deletions
  1. 14 0
      README.md
  2. 64 2
      doc/bundles.tex
  3. 70 0
      doc/config.tex
  4. 4 13
      doc/index.tex

+ 14 - 0
README.md

@@ -49,6 +49,20 @@ without Erlang prerequisite.
 
 Note: [relx](https://github.com/erlware/relx) must be installed
 
+Support
+-------
+* [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/5HT/n2o?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+* IRC Channel #n2o on FreeNode 24/7
+
+Documentation
+-------
+
+If you are new or need to determine whether the MAD architecture and
+philosophy is a fit for your project
+
+* Official MAD brochure [HTML](http://synrc.com/apps/mad/) and
+                        [PDF](https://synrc.com/apps/mad/doc/book.pdf)
+
 Credits
 -------
 

+ 64 - 2
doc/bundles.tex

@@ -1,5 +1,22 @@
 \section{Bundles}
 
+
+
+\subsection{Apps Ordering}
+
+Before starting an application which could be
+packed within three forms: Single-File Bundle, Release or OTP.MK Folder.
+
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    # mad plan
+    Ordered: [kernel,stdlib,mnesia,kvs,crypto,cowlib,ranch,
+              cowboy,compiler,syntax_tools,erlydtl,gproc,
+              xmerl,n2o,n2o_sample,fs,active,mad,rest,sh]
+\end{lstlisting}
+\vspace{1\baselineskip}
+
 \subsection{Single-File Bundles with MAD}
 
 The key feature of mad is ability to create single-file bundled web sites.
@@ -15,9 +32,54 @@ N2O also comes with custom cowboy static handler that is able to
 read static files from this cached ETS filesystem.
 Also bundle are compatible with active online realoading and recompilation.
 
-E.g. you main create
+E.g. you main create a single file site with:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    # mad bundle app_name
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+app\_name shoul be the same as a valid Erlang module, with app\_module:main/1
+function defined, which will boot up the bundle. This function could be like that:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+     -module(app_name).
+
+     main(Params) -> 
+          RebarConfig = [],
+          mad_repl:main(Params,RebarConfig).
+\end{lstlisting}
+\vspace{1\baselineskip}
 
 \subsection{Releases with RELX}
 
-\subsection{Re with OTP.MK}
+As you may know you can create OTP releases with
+reltool (rebar generate) or systools (relx). mad currently
+creates releases with relx but is going to do it independently soon.
+Now it can only order applications.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    # mad release
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+\subsection{Folders with OTP.MK}
+
+OTP.MK is a tiny 50 lines Makefile that allows to start your set
+of application using run\_erl and to\_erl tools from OTP distribution.
+We use that way in poduction. This is the best option also in
+development mode because all directory structure is open and mutable,
+so you can reload modified files and perform recompilation on the fly.
+
+It uses the original code to fast resolve dependencies into the right
+boot sequence to start.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    # make console
+\end{lstlisting}
+\vspace{1\baselineskip}
 

+ 70 - 0
doc/config.tex

@@ -0,0 +1,70 @@
+\section{Configuration File}
+
+\subsection{rebar.config}
+
+mad uses {\bf rebar.config} filename to load mad configuration.
+Despite mad is no fully rebar compatible (e.g. it can't uses
+rebar plugins, ports compilation is rather different, etc),
+it uses its name to achive certail level of compatibility.
+
+\subsection{deps}
+
+deps is the core option of mad. It says which OTP applications
+shold be used and where they could be found. Yoy may also specify
+versions. Here is simpliest example:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}[caption=deps Option]
+    {deps, [
+             {kvs,   ".*", {git,"git://github.com/synrc/kvs"}},
+             {forms, ".*", {git,"git://github.com/spawnproc/forms"}}
+    ]}.
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+\subsection{deps\_dir}
+
+To specify where deps should be stored after fetching inside
+your application you use deps\_dir option:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}[caption=deps\_dir Option]
+    {deps_dir, "deps"}.
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+\subsection{sub\_dirs}
+
+If your application consist of more than one src
+directory, you may specify all of the sub-applications.
+Each sub-application should be valid OTP application
+with its own rebar.config configuration file.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    {sub_dirs,["apps"]}.
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+\subsection{lib\_dirs}
+
+To use include directive across your sub-applications
+you should specify the {\bf lib\_dirs} directories
+which will be settled as include directories during compilation.
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    {lib_dirs,["apps"]}.
+\end{lstlisting}
+\vspace{1\baselineskip}
+
+E.g. you have my\_app and my\_server applications
+inside apps directory and you including HRL file
+from my\_server application from ap\_app application:
+
+\vspace{1\baselineskip}
+\begin{lstlisting}
+    -module(my_app).
+    -include_lib("my_server/include/my_server.hrl").
+\end{lstlisting}
+\vspace{1\baselineskip}

+ 4 - 13
doc/index.tex

@@ -67,22 +67,13 @@ Synrc mad has a simple interface as follows:
 It seems to us more natural, you can specify random
 commands set with different specifiers (options).
 
-\subsection{Single-File Bundling}
+\subsection{Several Types of Packaging}
 
 The key feature of mad is ability to create single-file bundled web sites.
 Thus making dream to boot simpler than node.js come true.
 This target escript is ready to run on Windows, Linux and Mac.
 
-To make this possible we implemented a zip filesytem inside escript.
-mad packages priv directories along with ebin and configs.
-You can redefine each file in zip fs inside target
-escript by creation the copy with same path locally near escript.
-After launch all files are copied to ETS.
-N2O also comes with custom cowboy static handler that is able to
-read static files from this cached ETS filesystem.
-Also bundle are compatible with active online realoading and recompilation.
-
-\subsection{Deploy}
+\subsection{Deployment Options}
 
 mad is also supposed to be a deploy tool with ability to
 deploy not only to our resources like Erlang on Xen, Voxoz (LXC/Xen) but
@@ -93,14 +84,14 @@ also to Heroku and others.
 mad supports rebar umbrella project structure.
 Specifically two kinds of directory layouts:
 
-\subsection{Apps Ordering}
+\subsection{Fast Apps Ordering}
 
 As you may know you can create OTP releases with
 reltool (rebar generate) or systools (relx). mad currently
 creates releases with relx but is going to do it independently soon.
 Now it can only order applications.
 
-\subsection{Size}
+\subsection{Tiny Size}
 
 And the good part: