setup.tex 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 \
  17. && cd mad \
  18. && make
  19. # cat Makefile
  20. default:
  21. ./mad cle dep com bun mad
  22. \end{lstlisting}
  23. \vspace{1\baselineskip}
  24. Note that mad uses mad to build mad. It's mad.
  25. \subsection{Creating a sample N2O project}
  26. mad also comes with N2O templates. So you can bootstrap a N2O-based site
  27. just having a single copy of mad binary.
  28. \vspace{1\baselineskip}
  29. \begin{lstlisting}
  30. # mad app sample
  31. # cd sample
  32. # mad deps compile plan bundle sample
  33. \end{lstlisting}
  34. \vspace{1\baselineskip}
  35. After that you can just run escript web\_app under Windows, Linux and
  36. Mac and open \footahref{http://localhost:8000}{http://localhost:8000}.
  37. \vspace{1\baselineskip}
  38. \begin{lstlisting}
  39. C:\> escript sample
  40. Applications: [kernel,stdlib,crypto,cowlib,ranch,
  41. cowboy,compiler,syntax_tools,
  42. erlydtl,gproc,xmerl,n2o,sample,
  43. fs,active,mad,sh]
  44. Configuration: [{n2o,[{port,8000},
  45. {route,routes}]},
  46. {kvs,[{dba,store_mnesia},
  47. {schema,[kvs_user,
  48. kvs_acl,
  49. kvs_feed,
  50. kvs_subscription]}]}]
  51. Erlang/OTP 17 [erts-6.0] [64-bit] [smp:4:4]
  52. [async-threads:10] [kernel-poll:false]
  53. Eshell V6.0 (abort with ^G)
  54. 1>
  55. \end{lstlisting}
  56. \vspace{1\baselineskip}