diff options
author | Dave Smith <dizzyd@dizzyd.com> | 2010-01-07 22:18:55 -0700 |
---|---|---|
committer | Dave Smith <dizzyd@dizzyd.com> | 2010-01-07 22:18:55 -0700 |
commit | 2d9af6cf485466d1b4e81707a8bb3ad8ebcd238b (patch) | |
tree | f3fd554e0157cfdfd8d4536a29ac947e37021cf6 /priv/templates | |
parent | 3ed1b99438b3a0990f1f36d8aad69d7b82ccf663 (diff) |
Sketching out templating system
Diffstat (limited to 'priv/templates')
-rw-r--r-- | priv/templates/simpleapp.app | 15 | ||||
-rw-r--r-- | priv/templates/simpleapp.template | 3 | ||||
-rw-r--r-- | priv/templates/simpleapp_app.erl | 16 | ||||
-rw-r--r-- | priv/templates/simpleapp_sup.erl | 28 |
4 files changed, 62 insertions, 0 deletions
diff --git a/priv/templates/simpleapp.app b/priv/templates/simpleapp.app new file mode 100644 index 0000000..7638f51 --- /dev/null +++ b/priv/templates/simpleapp.app @@ -0,0 +1,15 @@ +{application, {{appid}}, + [ + {description, ""}, + {vsn, "1"}, + {modules, [ + {{appid}}_app, + {{appid}}_sup + ]}, + {registered, []}, + {applications, [ + kernel, + stdlib + ]}, + {env, []} + ]}. diff --git a/priv/templates/simpleapp.template b/priv/templates/simpleapp.template new file mode 100644 index 0000000..114e3bc --- /dev/null +++ b/priv/templates/simpleapp.template @@ -0,0 +1,3 @@ +{file, "simpleapp.app", "ebin/{{appid}}.app"}. +{file, "simpleapp_app.erl", "src/{{appid}}_app.erl"}. +{file, "simpleapp_sup.erl", "src/{{appid}}_sup.erl"}.
\ No newline at end of file diff --git a/priv/templates/simpleapp_app.erl b/priv/templates/simpleapp_app.erl new file mode 100644 index 0000000..1af863b --- /dev/null +++ b/priv/templates/simpleapp_app.erl @@ -0,0 +1,16 @@ +-module({{appid}}_app). + +-behaviour(application). + +%% Application callbacks +-export([start/2, stop/1]). + +%% =================================================================== +%% Application callbacks +%% =================================================================== + +start(_StartType, _StartArgs) -> + {{appid}}_sup:start_link(). + +stop(_State) -> + ok. diff --git a/priv/templates/simpleapp_sup.erl b/priv/templates/simpleapp_sup.erl new file mode 100644 index 0000000..1dc178d --- /dev/null +++ b/priv/templates/simpleapp_sup.erl @@ -0,0 +1,28 @@ + +-module({{appid}}_sup). + +-behaviour(supervisor). + +%% API +-export([start_link/0]). + +%% Supervisor callbacks +-export([init/1]). + +%% Helper macro for declaring children of supervisor +-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}). + +%% =================================================================== +%% API functions +%% =================================================================== + +start_link() -> + supervisor:start_link({local, ?MODULE}, ?MODULE, []). + +%% =================================================================== +%% Supervisor callbacks +%% =================================================================== + +init([]) -> + {ok, {one_for_one, 5, 10}, []}. + |