Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: gar1t/e2v2
base: fb1fa9ade1
...
head fork: gar1t/e2v2
compare: 5ddafd1ff6
  • 2 commits
  • 17 files changed
  • 0 commit comments
  • 1 contributor
45 Makefile
View
@@ -36,36 +36,25 @@ else
erl -pa ebin $(wildcard deps/*/ebin) -s $(start) -s e2_reloader
endif
-appid=""
+env-appid:
+ @if [ -z "${appid}" ]; then \
+ echo "ERROR: appid is required"; exit 1; fi
-var-appid:
-ifeq ($(appid), "")
- @echo "ERROR: appid is required"
- @exit 1
-endif
-
-appdir=""
+env-appdir:
+ @if [ -z "${appdir}" ]; then \
+ echo "ERROR: appdir is required"; exit 1; fi
-var-appdir:
-ifeq ($(appdir), "")
- @echo "ERROR: appdir is required"
- @exit 1
-endif
+env-module:
+ @if [ -z "${module}" ]; then \
+ echo "ERROR: module is required"; exit 1; fi
-module=""
-var-module:
-ifeq ($(module), "")
- @echo "ERROR: module is required"
- @exit 1
-endif
+new-project: env-appid env-appdir
+ @rebar create template=e2app appid=${appid} dest="${appdir}"
-new-project: var-appid var-appdir
- rebar create template=e2app appid=$(appid) dest="$(appdir)"
+new-service: env-module
+ rebar create template=e2service module=${module} dest="$${appdir-.}"
+ @echo "TODO: Add ${module} to a supervisor hierarchy (e.g. *_app file)"
-new-service: var-module
-ifeq ($(appdir), "")
- rebar create template=e2service module=$(module) dest="."
-else
- rebar create template=e2service module=$(module) dest="$(appdir)"
-endif
- @echo "TODO: Add $(module) to a supervisor hierarchy (e.g. *_app file)"
+new-task: env-module
+ @rebar create template=e2task module=${module} dest="$${appdir-.}"
+ @echo "TODO: Add ${module}_sup to a supervisor hierarchy (e.g. *_app file)"
15 priv/templates/e2app.template
View
@@ -1,11 +1,12 @@
%% -*- erlang -*-
{variables, [{appid, ""}, {dest, ""}, {version, "1"}]}.
{dir, "{{dest}}"}.
-{template, "e2app_skel/src/e2app.app.src", "{{dest}}/src/{{appid}}.app.src"}.
-{template, "e2app_skel/src/e2app_app.erl", "{{dest}}/src/{{appid}}_app.erl"}.
-{file, "e2app_skel/.gitignore", "{{dest}}/.gitignore"}.
-{file, "e2app_skel/Makefile", "{{dest}}/Makefile"}.
-{file, "e2app_skel/src/Makefile", "{{dest}}/src/Makefile"}.
-{file, "e2app_skel/rebar.config", "{{dest}}/rebar.config"}.
-{file, "e2app_skel/rebar", "{{dest}}/rebar"}.
+{template, "e2app/src/e2app.app.src", "{{dest}}/src/{{appid}}.app.src"}.
+{template, "e2app/src/e2app_app.erl", "{{dest}}/src/{{appid}}_app.erl"}.
+{template, "e2app/src/e2app.erl", "{{dest}}/src/{{appid}}.erl"}.
+{file, "e2app/.gitignore", "{{dest}}/.gitignore"}.
+{file, "e2app/Makefile", "{{dest}}/Makefile"}.
+{file, "e2app/src/Makefile", "{{dest}}/src/Makefile"}.
+{file, "e2app/rebar.config", "{{dest}}/rebar.config"}.
+{file, "e2app/rebar", "{{dest}}/rebar"}.
{chmod, 8#755, "{{dest}}/rebar"}.
0  priv/templates/e2app_skel/.gitignore → priv/templates/e2app/.gitignore
View
File renamed without changes
0  priv/templates/e2app_skel/Makefile → priv/templates/e2app/Makefile
View
File renamed without changes
0  priv/templates/e2app_skel/priv/www/index.html → priv/templates/e2app/priv/www/index.html
View
File renamed without changes
0  priv/templates/e2app_skel/rebar → priv/templates/e2app/rebar
View
File renamed without changes
0  priv/templates/e2app_skel/rebar.config → priv/templates/e2app/rebar.config
View
File renamed without changes
0  priv/templates/e2app_skel/src/Makefile → priv/templates/e2app/src/Makefile
View
File renamed without changes
0  priv/templates/e2app_skel/src/e2app.app.src → priv/templates/e2app/src/e2app.app.src
View
File renamed without changes
13 priv/templates/e2app_skel/src/e2app.erl → priv/templates/e2app/src/e2app.erl
View
@@ -1,15 +1,10 @@
-module({{appid}}).
--behavior(e2_application).
-
--export([init/0]).
+-export([start/0]).
%%%===================================================================
-%%% e2_application callbacks
+%%% Public API
%%%===================================================================
-init() ->
- %% TODO: List top-level services and supervisors
- %%
- %%
- [].
+start() ->
+ e2_application:start_with_dependencies({{appid}}).
2  priv/templates/e2app_skel/src/e2app_app.erl → priv/templates/e2app/src/e2app_app.erl
View
@@ -9,5 +9,5 @@
%%%===================================================================
init() ->
- e2_log:info("TODO: configure top-level processes for your app"),
+ e2_log:info("TODO: configure top-level processes for your app~n"),
{ok, []}.
2  priv/templates/e2service.template
View
@@ -1,3 +1,3 @@
%% -*- erlang -*-
{variables, [{module, ""}, {dest, ""}]}.
-{template, "e2modules/e2service.erl", "{{dest}}/src/{{module}}.erl"}.
+{template, "modules/e2service.erl", "{{dest}}/src/{{module}}.erl"}.
4 priv/templates/e2task.template
View
@@ -0,0 +1,4 @@
+%% -*- erlang -*-
+{variables, [{module, ""}, {task_module, "{{module}}"}, {dest, ""}]}.
+{template, "modules/e2task.erl", "{{dest}}/src/{{module}}.erl"}.
+{template, "modules/e2task_sup.erl", "{{dest}}/src/{{module}}_sup.erl"}.
0  priv/templates/e2modules/e2service.erl → priv/templates/modules/e2service.erl
View
File renamed without changes
25 priv/templates/modules/e2task.erl
View
@@ -0,0 +1,25 @@
+-module({{module}}).
+
+-behavior(e2_task).
+
+-export([start_link/0]).
+
+-export([handle_task/1]).
+
+%%%===================================================================
+%%% Public API
+%%%===================================================================
+
+start_link() ->
+ e2_task:start_link(?MODULE).
+
+%%%===================================================================
+%%% Service callbacks
+%%%===================================================================
+
+handle_task([]) ->
+ {stop, normal}.
+
+%%%===================================================================
+%%% Internal functions
+%%%===================================================================
15 priv/templates/modules/e2task_sup.erl
View
@@ -0,0 +1,15 @@
+-module({{task_module}}_sup).
+
+-behavior(e2_task_supervisor).
+
+-export([start_link/0, start_task/0]).
+
+%%%===================================================================
+%%% Public API
+%%%===================================================================
+
+start_link() ->
+ e2_task_supervisor:start_link(?MODULE, {{task_module}}, [registered]).
+
+start_{{task_module}}() ->
+ e2_task_supervisor:start_task(?MODULE, []).
2  src/e2_application_sup.erl
View
@@ -18,7 +18,7 @@ init([AppMod, BaseOptions]) ->
{ok, e2_supervisor:supervisor_spec(Children, BaseOptions)};
{ok, Children, Options} ->
{ok, e2_supervisor:supervisor_spec(
- Children, [Options|BaseOptions])};
+ Children, Options ++ BaseOptions)};
ignore ->
ignore;
Other ->

No commit comments for this range

Something went wrong with that request. Please try again.