couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [18/50] rebar commit: updated refs/heads/import to e9f62c4
Date Mon, 01 Jun 2015 20:42:12 GMT
Add gen_event template


Project: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/commit/c9a301d0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/tree/c9a301d0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-rebar/diff/c9a301d0

Branch: refs/heads/import
Commit: c9a301d04c09f27714c838f74cf275b893184dc3
Parents: 29a16cb
Author: Antonio Murdaca <me@runcom.ninja>
Authored: Sun Jun 15 14:16:57 2014 +0200
Committer: Antonio Murdaca <me@runcom.ninja>
Committed: Sun Jun 15 14:18:00 2014 +0200

----------------------------------------------------------------------
 priv/templates/simpleevent.erl      | 60 ++++++++++++++++++++++++++++++++
 priv/templates/simpleevent.template |  2 ++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/c9a301d0/priv/templates/simpleevent.erl
----------------------------------------------------------------------
diff --git a/priv/templates/simpleevent.erl b/priv/templates/simpleevent.erl
new file mode 100644
index 0000000..1d529a3
--- /dev/null
+++ b/priv/templates/simpleevent.erl
@@ -0,0 +1,60 @@
+-module({{eventid}}).
+-behaviour(gen_event).
+
+%% ------------------------------------------------------------------
+%% API Function Exports
+%% ------------------------------------------------------------------
+
+-export([start_link/0,
+         add_handler/2]).
+
+%% ------------------------------------------------------------------
+%% gen_event Function Exports
+%% ------------------------------------------------------------------
+
+-export([init/1,
+         handle_event/2,
+         handle_call/2,
+         handle_info/2,
+         terminate/2,
+         code_change/3]).
+
+-record(state, {}).
+
+%% ------------------------------------------------------------------
+%% API Function Definitions
+%% ------------------------------------------------------------------
+
+start_link() ->
+    gen_event:start_link({local, ?MODULE}).
+
+add_handler(Handler, Args) ->
+    gen_event:add_handler(?MODULE, Handler, Args).
+
+%% ------------------------------------------------------------------
+%% gen_event Function Definitions
+%% ------------------------------------------------------------------
+
+init([]) ->
+    {ok, #state{}}.
+
+handle_event(_Event, State) ->
+    {ok, State}.
+
+handle_call(_Request, State) ->
+    Reply = ok,
+    {ok, Reply, State}.
+
+handle_info(_Info, State) ->
+    {ok, State}.
+
+terminate(_Reason, _State) ->
+    ok.
+
+code_change(_OldVsn, State, _Extra) ->
+    {ok, State}.
+
+%% ------------------------------------------------------------------
+%% Internal Function Definitions
+%% ------------------------------------------------------------------
+

http://git-wip-us.apache.org/repos/asf/couchdb-rebar/blob/c9a301d0/priv/templates/simpleevent.template
----------------------------------------------------------------------
diff --git a/priv/templates/simpleevent.template b/priv/templates/simpleevent.template
new file mode 100644
index 0000000..68f3894
--- /dev/null
+++ b/priv/templates/simpleevent.template
@@ -0,0 +1,2 @@
+{variables, [{eventid, "myevent"}]}.
+{template, "simpleevent.erl", "src/{{eventid}}.erl"}.


Mime
View raw message