From 8e859ba91fd0fa1b0b278e4e19743a9c2faf5832 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 16 Mar 2011 17:37:22 +0000 Subject: [PATCH] add poke_twice, appup, bump version to 2 --- .gitignore | 1 - apps/dummy_app/ebin/dummy_app.appup | 10 ++++++++++ apps/dummy_app/src/dummy_app.app.src | 2 +- apps/dummy_app/src/dummy_app_server.erl | 15 +++++++++++++-- rel/reltool.config | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 apps/dummy_app/ebin/dummy_app.appup diff --git a/.gitignore b/.gitignore index 585b34f..3594e15 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -ebin *.beam *~ diff --git a/apps/dummy_app/ebin/dummy_app.appup b/apps/dummy_app/ebin/dummy_app.appup new file mode 100644 index 0000000..f9ea3f2 --- /dev/null +++ b/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} + ]}] +}. diff --git a/apps/dummy_app/src/dummy_app.app.src b/apps/dummy_app/src/dummy_app.app.src index 7d8c7aa..2fe9fb5 100644 --- a/apps/dummy_app/src/dummy_app.app.src +++ b/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, diff --git a/apps/dummy_app/src/dummy_app_server.erl b/apps/dummy_app/src/dummy_app_server.erl index 5b6050e..54a77d3 100644 --- a/apps/dummy_app/src/dummy_app_server.erl +++ b/apps/dummy_app/src/dummy_app_server.erl @@ -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, @@ -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). @@ -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}, @@ -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 diff --git a/rel/reltool.config b/rel/reltool.config index e241b10..28f1012 100644 --- a/rel/reltool.config +++ b/rel/reltool.config @@ -1,6 +1,6 @@ {sys, [ {lib_dirs, ["../apps"]}, - {rel, "dummy", "1", + {rel, "dummy", "2", [ kernel, stdlib,