Browse Source

relx release handling

Maxim Sokhatsky 10 years ago
parent
commit
4dc31a61db
3 changed files with 21 additions and 18 deletions
  1. BIN
      mad
  2. 0 18
      priv/reltool.config
  3. 21 0
      src/mad_release.erl

BIN
mad


+ 0 - 18
priv/reltool.config

@@ -1,18 +0,0 @@
-{sys, [
-       {lib_dirs, ["apps","deps"]},
-       {erts, [{mod_cond, derived}, {app_file, strip}]},
-       {app_file, strip},
-       {rel, "node", "1", MAD_APPS },
-       {rel, "start_clean", "", [ kernel, stdlib ]},
-       {boot_rel, "node"},
-       {profile, embedded},
-       {incl_cond, derived},
-       {mod_cond, derived},
-       {excl_archive_filters, [".*"]},
-       {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
-                           "^erts.*/(doc|info|include|lib|man|src)"]},
-       {excl_app_filters, ["\.gitignore"]},
-       {app, hipe, [{mod_cond, app}, {incl_cond, exclude}]}
-      ]}.
-
-{target_dir, "node"}.

+ 21 - 0
src/mad_release.erl

@@ -0,0 +1,21 @@
+-module(mad_release).
+-compile(export_all).
+
+release(Name,Apps) ->
+    file:write_file("relx.config",list_to_binary(io_lib:format(
+      "{release,{~s,\"1.0.0\"},~p}.\n"
+      "{include_erts,true}.\n"
+      "{extended_start_script,true}.\n"
+      "{generate_start_script,true}.\n"
+      "{sys_config,\"sys.config\"}.\n"
+      "{overlay,[{mkdir,\"log/sasl\"}]}.\n",[Name,Apps]))).
+
+main([]) -> main(["sample"]);
+main(Params) ->
+    [N|_] = Params,
+    Apps = [ filename:basename(F) || F <- filelib:wildcard("{apps,deps}/*"),  filelib:is_dir(F)],
+    release(N,Apps),
+    {Res,Status,X} = sh:run("relx",[],binary,".",[]),
+    case Status == 0 of
+         true -> skip;
+         false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]) end.