КОМАНДИ

ДОПОМОГА

MAD приймає список слів. Цей список слів складається з спеціальних слів, відомих як роздільники, або команди. Слова між командами – це аргументи для найближчої команди зліва.

MAD Manage Dependencies 5.4-14-g7810b8d invoke = mad | mad list list = [] | command [options] list command = app [zero|nitro] <name> | deps | clean | compile | strip | bundle [beam|script] <name> | man | get <repo> | up [name] | start | stop | attach | repl | static <min>
  • mad — Головний модуль MAD
  • mad_local — MAD POSIX Profile

APP

Створює нову програму із заздалегідь визначеного шаблону прикладу. MAD містить два вбудованих приклади програм: zero та nitro. Нижче наведено приклад програми zero:

$ mad app zero sample OK

sample.app.src

{application, sample, [{description, "sample application"}, {vsn, "0.8.0"}, {registered, []}, {applications, [kernel,stdlib]}, {mod, { sample, []}}, {env, []}]}.

sample.erl

-module(sample). -compile(export_all). -behaviour(application). -behaviour(supervisor). -export([start/2, stop/1, init/1]). start(_, _) -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). stop(_) -> ok. init([]) -> {ok, { {one_for_one, 5, 10}, []} }.

DEPS

$ cd sample $ cat rebar.config {sub_dirs,["apps"]}. {deps_dir,"deps"}. {deps, [ {erlydtl,".*", {git, "git://github.com/voxoz/erlydtl", [] }}, {cowboy, ".*", {git, "git://github.com/voxoz/cowboy", [] }}, {gproc, ".*", {git, "git://github.com/voxoz/gproc", [] }}, {fs, ".*", {git, "git://github.com/synrc/fs", {tag, "4.10"} }}, {sh, ".*", {git, "git://github.com/synrc/sh", {tag, "2.10"} }}, {mad, ".*", {git, "git://github.com/synrc/mad", {tag, "4.10"} }}, {active, ".*", {git, "git://github.com/synrc/active", {tag, "4.10"} }}, {nitro, ".*", {git, "git://github.com/synrc/nitro", {tag, "3.10"} }}, {n2o, ".*", {git, "git://github.com/synrc/n2o", {tag, "5.10"} }} ]}
$ mad deps ==> dependency: "git://github.com/voxoz/erlydtl" tag: [] ==> dependency: "git://github.com/voxoz/cowlib" tag: [] ==> dependency: "git://github.com/voxoz/ranch" tag: [] ==> dependency: "git://github.com/voxoz/gproc" tag: [] ==> dependency: "git://github.com/synrc/fs" tag: {tag,"4.10"} ==> dependency: "git://github.com/synrc/sh" tag: {tag,"2.10"} ==> dependency: "git://github.com/synrc/mad" tag: {tag,"4.10"} ==> dependency: "git://github.com/synrc/active" tag: {tag,"4.10"} ==> dependency: "git://github.com/synrc/nitro" tag: {tag,"3.10"} ==> dependency: "git://github.com/synrc/n2o" tag: {tag,"5.10"} OK

GET

$ mad get kvx ==> dependency: "https://github.com/synrc/kvx" tag: [] OK

UP

$ mad up OK

CLEAN

$ mad clean OK

START

$ mad start Scripting: "/Users/maxim/depot/synrc/mad/mad" OK

ATTACH

$ $(mad attach) Attaching to . (^D to exit) 1>

STOP

$ eval $(mad stop) Attaching to . (^D to exit) [EOF]

COMPILE

$ mad compile Writing /apps/sample/ebin/sample.app OK

PLAN

$ mad plan OK

STRIP

$ mad strip OK

BUNDLE

$ mad bundle script sample OK
$ mad bundle beam sample OK

REPL

$ mad repl $ open http://127.0.0.1:8001/app/index.htm

Статті