From c54d496030273cb2a896c047d33e25ba047fbbc0 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 21 Nov 2014 10:11:13 -0500 Subject: [PATCH] Additional fixes and modification - Updating documentation to be more accurate - Style fixes - More precise error messages --- src/rebar_rel_utils.erl | 10 +++++----- test/upgrade_project/README.md | 11 ++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/rebar_rel_utils.erl b/src/rebar_rel_utils.erl index 7b08d54..068fa1c 100644 --- a/src/rebar_rel_utils.erl +++ b/src/rebar_rel_utils.erl @@ -111,13 +111,13 @@ get_rel_file_path(Name, Path) -> get_rel_file_path(Name, Path, PVer). get_rel_file_path(Name, Path, Version) -> - Dir = filename:join([Path, "releases", Version]), + Dir = filename:join([Path, "releases", Version]), Path1 = filename:join([Dir, Name ++ "_" ++ Version ++".rel"]), Path2 = filename:join([Dir, Name ++ ".rel"]), case {filelib:is_file(Path1), filelib:is_file(Path2)} of {true, _} -> Path1; {_, true} -> Path2; - _ -> ?ABORT("can not find .rel file for version ~p", [Version]) + _ -> ?ABORT("can not find .rel file for version ~p~n", [Version]) end. %% Get the previous release path from a global variable @@ -138,7 +138,7 @@ load_config(Config, ReltoolFile) -> {ok, Terms} -> expand_version(Config, Terms, filename:dirname(ReltoolFile)); Other -> - ?ABORT("Failed to load expected config from ~s: ~p\n", + ?ABORT("Failed to load expected config from ~s: ~p~n", [ReltoolFile, Other]) end. @@ -151,7 +151,7 @@ get_sys_tuple(ReltoolConfig) -> {sys, _} = SysTuple -> SysTuple; false -> - ?ABORT("Failed to find {sys, [...]} tuple in reltool.config.", []) + ?ABORT("Failed to find {sys, [...]} tuple in reltool.config~n", []) end. %% @@ -265,5 +265,5 @@ get_permanent_version(Path) -> " "), Version; {error, enoent} -> - ?ABORT("start_erl.data is missing", []) + ?ABORT("~s is missing~n", [DataFile]) end. diff --git a/test/upgrade_project/README.md b/test/upgrade_project/README.md index a644b21..d0d4a4b 100644 --- a/test/upgrade_project/README.md +++ b/test/upgrade_project/README.md @@ -1,7 +1,9 @@ #### Building version 0.1 rebar compile + cd rel rebar generate - mv rel/dummy rel/dummy_0.1 + mv dummy dummy_0.1 + cd .. rebar clean # start the release: cd rel/dummy_0.1 @@ -20,15 +22,17 @@ $EDITOR rel/reltool.config rebar compile + cd rel rebar generate # previous_release path is relative to your rel directory rebar generate-appups previous_release=dummy_0.1 rebar generate-upgrade previous_release=dummy_0.1 - tar -zvtf rel/dummy_0.2.tar.gz + tar -zvtf dummy_0.2.tar.gz + mv dummy dummy_0.2 #### Deploying with release_handler - mv rel/dummy_0.2.tar.gz rel/dummy_0.1/releases/ + mv dummy_0.2.tar.gz dummy_0.1/releases/ # Now use release_handler in the running erlang console for the deploy: @@ -43,3 +47,4 @@ rm -r rel/dummy # Now repeat steps in 'Building version 0.2' and 'Deploying with release_handler' + # while replacing '0.2' by '0.3' and '0.1' by '0.2'.