Skip to content

Commit

Permalink
add poke_twice, appup, bump version to 2
Browse files Browse the repository at this point in the history
  • Loading branch information
RJ committed Mar 16, 2011
1 parent 24d4af9 commit 8e859ba
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,3 +1,2 @@
ebin
*.beam
*~
10 changes: 10 additions & 0 deletions apps/dummy_app/ebin/dummy_app.appup
@@ -0,0 +1,10 @@
{"2",
%% Upgrade instructions from 1 to 2
[{"1", [
{load_module, dummy_app_server}
]}],
%% Downgrade instructions from 2 to 1
[{"1",[
{load_module, dummy_app_server}
]}]
}.
2 changes: 1 addition & 1 deletion apps/dummy_app/src/dummy_app.app.src
@@ -1,7 +1,7 @@
{application, dummy_app,
[
{description, "Dummy project to test release process"},
{vsn, "1"},
{vsn, "2"},
{registered, []},
{applications, [
kernel,
Expand Down
15 changes: 13 additions & 2 deletions apps/dummy_app/src/dummy_app_server.erl
Expand Up @@ -3,7 +3,7 @@
-behaviour(gen_server).

%% API
-export([start_link/0, poke/0, num_pokes/0]).
-export([start_link/0, poke/0, num_pokes/0, poke_twice/0]).

%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
Expand All @@ -18,6 +18,9 @@ start_link() ->
poke() ->
gen_server:call(?MODULE, poke).

poke_twice() ->
gen_server:call(?MODULE, poke_twice).

num_pokes() ->
gen_server:call(?MODULE, num_pokes).

Expand All @@ -29,6 +32,12 @@ init([]) ->
handle_call(num_pokes, _From, State = #state{ num_pokes = PokeCount }) ->
{reply, PokeCount, State};

handle_call(poke_twice, _From, State) ->
NewPokeCount = State#state.num_pokes + 2,
NewState = State#state{num_pokes = NewPokeCount},
Reply = {ok, NewPokeCount},
{reply, Reply, NewState};

handle_call(poke, _From, State) ->
NewPokeCount = State#state.num_pokes + 1,
NewState = State#state{num_pokes = NewPokeCount},
Expand All @@ -44,7 +53,9 @@ handle_info(_Info, State) ->
terminate(_Reason, _State) ->
ok.

code_change(_OldVsn, State, _Extra) ->
code_change(OldVsn, State, Extra) ->
error_logger:info_msg("code_change, oldvsn:~p state:~p extra:~p~n",
[OldVsn, State, Extra]),
{ok, State}.

%%% Internal functions
2 changes: 1 addition & 1 deletion rel/reltool.config
@@ -1,6 +1,6 @@
{sys, [
{lib_dirs, ["../apps"]},
{rel, "dummy", "1",
{rel, "dummy", "2",
[
kernel,
stdlib,
Expand Down

0 comments on commit 8e859ba

Please sign in to comment.