Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, 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
View
45 Makefile
@@ -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)"
View
15 priv/templates/e2app.template
@@ -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"}.
View
0  priv/templates/e2app_skel/.gitignore → priv/templates/e2app/.gitignore
File renamed without changes
View
0  priv/templates/e2app_skel/Makefile → priv/templates/e2app/Makefile
File renamed without changes
View
0  .../templates/e2app_skel/priv/www/index.html → priv/templates/e2app/priv/www/index.html
File renamed without changes
View
0  priv/templates/e2app_skel/rebar → priv/templates/e2app/rebar
File renamed without changes
View
0  priv/templates/e2app_skel/rebar.config → priv/templates/e2app/rebar.config
File renamed without changes
View
0  priv/templates/e2app_skel/src/Makefile → priv/templates/e2app/src/Makefile
File renamed without changes
View
0  priv/templates/e2app_skel/src/e2app.app.src → priv/templates/e2app/src/e2app.app.src
File renamed without changes
View
13 priv/templates/e2app_skel/src/e2app.erl → priv/templates/e2app/src/e2app.erl
@@ -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}}).
View
2  priv/templates/e2app_skel/src/e2app_app.erl → priv/templates/e2app/src/e2app_app.erl
@@ -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, []}.
View
2  priv/templates/e2service.template
@@ -1,3 +1,3 @@
%% -*- erlang -*-
{variables, [{module, ""}, {dest, ""}]}.
-{template, "e2modules/e2service.erl", "{{dest}}/src/{{module}}.erl"}.
+{template, "modules/e2service.erl", "{{dest}}/src/{{module}}.erl"}.
View
4 priv/templates/e2task.template
@@ -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"}.
View
0  priv/templates/e2modules/e2service.erl → priv/templates/modules/e2service.erl
File renamed without changes
View
25 priv/templates/modules/e2task.erl
@@ -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
+%%%===================================================================
View
15 priv/templates/modules/e2task_sup.erl
@@ -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, []).
View
2  src/e2_application_sup.erl
@@ -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.