|
@@ -5,31 +5,28 @@
|
|
We realized no matter how perfect your libraries are,
|
|
We realized no matter how perfect your libraries are,
|
|
the comfort and easy come mostly from developing tools.
|
|
the comfort and easy come mostly from developing tools.
|
|
Everything got started when Vladimir Kirillov decided to
|
|
Everything got started when Vladimir Kirillov decided to
|
|
-replace Rusty's SYNC beam reloader. As you know SYNC uses
|
|
|
|
-filesystem polling which is neither economic nor elegant. Also
|
|
|
|
-SYNC is able only to reload separate modules while
|
|
|
|
|
|
+replace Rusty's sync beam reloader. As you know sync uses
|
|
|
|
+filesystem polling which is neither energy-efficient nor elegant. Also
|
|
|
|
+sync is only able to recompile separate modules while
|
|
common use-case in N2O is to recompile DTL templates
|
|
common use-case in N2O is to recompile DTL templates
|
|
-and LESS/SCSS stylesheets. That is why we need to trigger
|
|
|
|
-the whole project recompilation. That's the story how ACTIVE
|
|
|
|
-has been emerged. Under the hood ACTIVE is a client subscriber
|
|
|
|
-of FS library, native async filesystem listener
|
|
|
|
-for Linux, Windows and Mac.
|
|
|
|
-
|
|
|
|
-De-facto standard in Erlang world is REBAR.
|
|
|
|
-We love REBAR interface despite its implementation.
|
|
|
|
-When we plugged REBAR to ACTIVE and then decided totally
|
|
|
|
-drop REBAR support and where switched to makefile
|
|
|
|
-based build tool OTP.MK. Becase the overall size
|
|
|
|
-of REBAR was bigger then whole our Web Stack.
|
|
|
|
|
|
+and LESS/SCSS stylesheets. That is why we need to recompile
|
|
|
|
+the whole project. That's the story how active emerged.
|
|
|
|
+Under the hood active is a client subscriber
|
|
|
|
+of fs library, native filesystem listener for Linux, Windows and Mac.
|
|
|
|
+
|
|
|
|
+De-facto standard in Erlang world is rebar.
|
|
|
|
+We love rebar interface despite its implementation.
|
|
|
|
+First we plugged rebar into active and then decided to drop its support.
|
|
|
|
+Later switched to Makefile-based build tool otp.mk.
|
|
And of course it is slow, especially in cold recompilation.
|
|
And of course it is slow, especially in cold recompilation.
|
|
It was designed to be a stand-alone tool, so it has some
|
|
It was designed to be a stand-alone tool, so it has some
|
|
glitches while using as embedded library.
|
|
glitches while using as embedded library.
|
|
|
|
|
|
-Our idea to build REBAR replacement was picked up by Sina Samavati,
|
|
|
|
-he implemented the first prototype called MAD. Initially MAD
|
|
|
|
-was able to compile DTL templated, YECC files, ESCRIPT (like
|
|
|
|
-bundled in GPROC), also it was support caching with side-effects.
|
|
|
|
-After month I continue the MAD fork with the same name.
|
|
|
|
|
|
+Our idea to build rebar replacement was picked up by Sina Samavati,
|
|
|
|
+he implemented the first prototype called mad. Initially mad
|
|
|
|
+was able to compile DTL templated, YECC files, escript (like
|
|
|
|
+bundled in gproc), also it was support caching with side-effects.
|
|
|
|
+After a month I forked mad and took over the development under the same name.
|
|
|
|
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
\begin{lstlisting}[caption=Example of building N2O sample]
|
|
\begin{lstlisting}[caption=Example of building N2O sample]
|
|
@@ -49,11 +46,11 @@ After month I continue the MAD fork with the same name.
|
|
|
|
|
|
\subsection{Introduction}
|
|
\subsection{Introduction}
|
|
|
|
|
|
-We was trying to made something minimalistic that fits out Web Stack.
|
|
|
|
|
|
+We were trying to make something minimalistic that fits out Web Stack.
|
|
Besides we wanted to use our knowledge of other build tools like lein, sbt etc.
|
|
Besides we wanted to use our knowledge of other build tools like lein, sbt etc.
|
|
-Also for sure we tried sinan, ebt, makefile based scripts.
|
|
|
|
|
|
+Also for sure we tried sinan, ebt, Makefile-based scripts.
|
|
|
|
|
|
-Synrc MAD has following commands DSL:
|
|
|
|
|
|
+Synrc mad has a simple interface as follows:
|
|
|
|
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
@@ -71,33 +68,33 @@ commands set with different specifiers (options).
|
|
|
|
|
|
\subsection{Single-File Bundling}
|
|
\subsection{Single-File Bundling}
|
|
|
|
|
|
-The key feature of MAD is ability to create single-file bundled web sites.
|
|
|
|
|
|
+The key feature of mad is ability to create single-file bundled web sites.
|
|
Thus making Joe's dream to boot like node.js come true.
|
|
Thus making Joe's dream to boot like node.js come true.
|
|
This target escript is ready to run on Windows, Linux and Mac.
|
|
This target escript is ready to run on Windows, Linux and Mac.
|
|
|
|
|
|
-To make this possible we implemented zip filesytem inside escript.
|
|
|
|
-MAD packages priv directories along with ebin and configs.
|
|
|
|
|
|
+To make this possible we implemented a zip filesytem inside escript.
|
|
|
|
+mad packages priv directories along with ebin and configs.
|
|
Also you can redefine each file in zip fs inside target
|
|
Also you can redefine each file in zip fs inside target
|
|
escript by creation the copy with same path locally near escript.
|
|
escript by creation the copy with same path locally near escript.
|
|
After launch all files copied to ETS.
|
|
After launch all files copied to ETS.
|
|
-N2O also comes with custom COWBOY static handler that is able to
|
|
|
|
|
|
+N2O also comes with custom cowboy static handler that is able to
|
|
read static files from this cached ETS filesystem.
|
|
read static files from this cached ETS filesystem.
|
|
-Also bundle are compatible with ACTIVE online realoading and recompilation.
|
|
|
|
|
|
+Also bundle are compatible with active online realoading and recompilation.
|
|
|
|
|
|
\subsection{Templates}
|
|
\subsection{Templates}
|
|
|
|
|
|
-MAD also come with N2O templates. So you can bootstrap N2O site
|
|
|
|
-just having a single copy of MAD.
|
|
|
|
|
|
+mad also come with N2O templates. So you can bootstrap a N2O-based site
|
|
|
|
+just having a single copy of mad.
|
|
|
|
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
- \$ mad app sample
|
|
|
|
- \$ cd sample
|
|
|
|
- \$ mad deps compile plan bundle web_app
|
|
|
|
|
|
+ $ mad app sample
|
|
|
|
+ $ cd sample
|
|
|
|
+ $ mad deps compile plan bundle web_app % \$
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
|
|
|
|
-After that just can run ./web_app under Windows, Linux and
|
|
|
|
|
|
+After that you can just run ./web_app under Windows, Linux and
|
|
Mac and open \footahref{http://localhost:8000}{http://localhost:8000}.
|
|
Mac and open \footahref{http://localhost:8000}{http://localhost:8000}.
|
|
|
|
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
@@ -117,13 +114,14 @@ Mac and open \footahref{http://localhost:8000}{http://localhost:8000}.
|
|
|
|
|
|
\subsection{Deploy}
|
|
\subsection{Deploy}
|
|
|
|
|
|
-MAD is also supposed to be also a deploy tool with ability to
|
|
|
|
-deploy not only to our resources like EoX, Voxoz (LXC/Xen) but
|
|
|
|
-also to Heroky and others.
|
|
|
|
|
|
+mad is also supposed to be also a deploy tool with ability to
|
|
|
|
+deploy not only to our resources like Erlang on Xen, Voxoz (LXC/Xen) but
|
|
|
|
+also to Heroku and others.
|
|
|
|
|
|
\subsection{OTP Compliant}
|
|
\subsection{OTP Compliant}
|
|
|
|
|
|
-MAD is respectful to OTP directories. It supports two kinds of directory layouts:
|
|
|
|
|
|
+mad supports rebar umbrella project structure.
|
|
|
|
+Specifically two kinds of directory layouts:
|
|
|
|
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
\begin{lstlisting}[caption=Solution]
|
|
\begin{lstlisting}[caption=Solution]
|
|
@@ -144,3 +142,7 @@ MAD is respectful to OTP directories. It supports two kinds of directory layouts
|
|
└── rebar.config
|
|
└── rebar.config
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
\vspace{1\baselineskip}
|
|
\vspace{1\baselineskip}
|
|
|
|
+
|
|
|
|
+Also you can create OTP releases with reltool, rebar configure or relx.
|
|
|
|
+Internally mad uses reltool to order your dependencies.
|
|
|
|
+
|