Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 01a3561a7050b5e78d16c16395d6bd0a4f957163 0 parents
@nox nox authored
13 README.md
@@ -0,0 +1,13 @@
+[Rebar](https://github.com/basho/rebar) Templates
+=================================================
+
+Available templates
+-------------------
+
+ * Template `complexapp` is the same as rebar's own `simpleapp` template, but
+ [done right](http://ferd.ca/dev/rebar-releases-and-being-wrong.html).
+
+How to use these templates?
+---------------------------
+
+Clone this repository somewhere into `~/.rebar/templates`.
11 complexapp.template
@@ -0,0 +1,11 @@
+{variables, [
+ {appid, "myapp"},
+ {description, ""}
+]}.
+{template, "complexapp/rebar.config", "rebar.config"}.
+{template, "complexapp/complexapp.app.src",
+ "apps/{{appid}}/src/{{appid}}.app.src"}.
+{template, "complexapp/complexapp_app.erl",
+ "apps/{{appid}}/src/{{appid}}.erl"}.
+{template, "complexapp/complexapp_sup.erl",
+ "apps/{{appid}}/src/{{appid}}_sup.erl"}.
11 complexapp/complexapp.app.src
@@ -0,0 +1,11 @@
+{application, {{appid}}, [
+ {description, "{{description}}"},
+ {vsn, "0.1.0"},
+ {registered, []},
+ {applications, [
+ kernel,
+ stdlib
+ ]},
+ {mod, {{{appid}}, []},
+ {env, []}
+]}.
25 complexapp/complexapp_app.erl
@@ -0,0 +1,25 @@
+-module({{appid}}).
+-behaviour(application).
+
+%% Interface
+
+-export([start/0]).
+
+%% Application interface
+
+-export([start/2, stop/1]).
+
+%% Implementation
+
+start() ->
+ application:start(?MODULE).
+
+%% Application implementation
+
+%% @private
+start(_StartType, _StartArgs) ->
+ {{appid}}_sup:start_link().
+
+%% @private
+stop(_State) ->
+ ok.
22 complexapp/complexapp_sup.erl
@@ -0,0 +1,22 @@
+%% @private
+-module({{appid}}_sup).
+-behaviour(supervisor).
+
+%% Interface
+
+-export([start_link/0]).
+
+%% Supervisor interface
+
+-export([init/1]).
+
+%% Implementation
+
+start_link() ->
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
+
+%% Supervisor implementation
+
+init([]) ->
+ Restart = {one_for_one, 5, 10},
+ {ok, {Restart, []}}.
3  complexapp/rebar.config
@@ -0,0 +1,3 @@
+{sub_dirs, [
+ "apps/{{appid}}"
+]}.
Please sign in to comment.
Something went wrong with that request. Please try again.