summaryrefslogtreecommitdiff
path: root/src/rebar_reltool.erl
diff options
context:
space:
mode:
authorjoewilliams <joe@joetify.com>2011-09-20 09:44:41 -0700
committerjoewilliams <joe@joetify.com>2011-09-20 09:44:41 -0700
commitcb5056b2e362aa0b1eb0ccfc6009613426682ed5 (patch)
treea1a7c429923bd139b27a64d4acdda069d92d38cc /src/rebar_reltool.erl
parent5998c6c721b22a9413c66f2b2b034f9d5bd5bb3d (diff)
downloadrebar-cb5056b2e362aa0b1eb0ccfc6009613426682ed5.tar.gz
Get rid of app.config
app.config has been a long standing erroneous file in rebar. Erlang/OTP documentation suggests a sys.config file instead. This file is stored in the releases/VSN directory. This does a few things but most importantly it ensures your config (contained in the application environment) survives a hot upgrade. It also has the advantage of allowing the configuration of the application to be versioned along side the application code. This patch flips rebar to use sys.config rather than app.config. Additionally it makes this flip to vm.args as well, making them versioned just like sys.config. This patch also includes runner script changes to support the old etc/app.config config file location and support for Windows. Thanks to mokele for the initial work and kick in the pants to make this finially happen.
Diffstat (limited to 'src/rebar_reltool.erl')
-rw-r--r--src/rebar_reltool.erl23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/rebar_reltool.erl b/src/rebar_reltool.erl
index b1b4a4c..363b384 100644
--- a/src/rebar_reltool.erl
+++ b/src/rebar_reltool.erl
@@ -173,10 +173,17 @@ run_reltool(Server, _Config, ReltoolConfig) ->
[Reason])
end,
+ {BootRelName, BootRelVsn} =
+ rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
+
+ ok = create_RELEASES(TargetDir, BootRelName, BootRelVsn),
+
%% Initialize overlay vars with some basics
%% (that can get overwritten)
- OverlayVars0 = dict:from_list([{erts_vsn, "erts-" ++ erlang:system_info(version)},
- {target_dir, TargetDir}]),
+ OverlayVars0 =
+ dict:from_list([{erts_vsn, "erts-" ++ erlang:system_info(version)},
+ {rel_vsn, BootRelVsn},
+ {target_dir, TargetDir}]),
%% Load up any variables specified by overlay_vars
OverlayVars1 = overlay_vars(OverlayVars0, ReltoolConfig),
@@ -312,3 +319,15 @@ execute_overlay([Other | _Rest], _Vars, _BaseDir, _TargetDir) ->
apply_file_info(InFile, OutFile) ->
{ok, FileInfo} = file:read_file_info(InFile),
ok = file:write_file_info(OutFile, FileInfo).
+
+create_RELEASES(TargetDir, RelName, RelVsn) ->
+ ReleasesDir = filename:join(TargetDir, "releases"),
+ case release_handler:create_RELEASES(TargetDir, ReleasesDir,
+ filename:join([ReleasesDir, RelVsn, RelName ++ ".rel"]),
+ filename:join(TargetDir, "lib")) of
+ ok ->
+ ok;
+ {error, Reason} ->
+ ?ABORT("Failed to create RELEASES file: ~p\n",
+ [Reason])
+ end. \ No newline at end of file