setup.tex 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. \section{Setup}
  2. \subsection{Installing Binary}
  3. Fresh version of mad included as a binary in its primary github repository:
  4. \vspace{1\baselineskip}
  5. \begin{lstlisting}
  6. # curl -fsSL https://raw.github.com/synrc/mad/master/mad > mad\\
  7. && chmod +x mad \\
  8. && sudo cp /usr/local/bin
  9. \end{lstlisting}
  10. \vspace{1\baselineskip}
  11. Or you may want to add mad to your PATH.
  12. \subsection{Compiling Sources}
  13. If you want you can compile mad by yourself:
  14. \vspace{1\baselineskip}
  15. \begin{lstlisting}
  16. # git clone http://github.com/synrc/mad && cd mad
  17. # make
  18. \end{lstlisting}
  19. \vspace{1\baselineskip}
  20. Note that mad uses mad to build mad. It's mad.
  21. \subsection{Creating a sample N2O project}
  22. mad also comes with N2O templates. So you can bootstrap a N2O-based site
  23. just having a single copy of mad binary.
  24. \vspace{1\baselineskip}
  25. \begin{lstlisting}
  26. # mad app sample
  27. # cd sample
  28. # mad deps compile plan bundle web_app
  29. \end{lstlisting}
  30. \vspace{1\baselineskip}
  31. After that you can just run escript web_app under Windows, Linux and
  32. Mac and open \footahref{http://localhost:8000}{http://localhost:8000}.
  33. \vspace{1\baselineskip}
  34. \begin{lstlisting}
  35. C:\> escript web_app
  36. Applications: [kernel,stdlib,crypto,cowlib,ranch,cowboy,compiler,syntax_tools,
  37. erlydtl,gproc,xmerl,n2o,n2o_sample,fs,active,mad,sh]
  38. Configuration: [{n2o,[{port,8000},{route,routes}]},
  39. {kvs,[{dba,store_mnesia},
  40. {schema,[kvs_user,kvs_acl,kvs_feed,kvs_subscription]}]}]
  41. Erlang/OTP 17 [erts-6.0] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
  42. Eshell V6.0 (abort with ^G)
  43. 1>
  44. \end{lstlisting}
  45. \vspace{1\baselineskip}