summaryrefslogtreecommitdiff
path: root/priv/templates
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2014-09-16 19:36:04 -0500
committerTristan Sloughter <t@crashfast.com>2014-09-16 19:36:04 -0500
commit884d298291e64fad99f096ee82018b568e0985f2 (patch)
tree2251d30abe9bf5890d2fd7506e74979149307df4 /priv/templates
parent71d9500997930a43f30bce863e05f3dbaa4fd3f4 (diff)
update templating
Diffstat (limited to 'priv/templates')
-rw-r--r--priv/templates/README.md7
-rw-r--r--priv/templates/app.erl (renamed from priv/templates/simpleapp.erl)17
-rw-r--r--priv/templates/basicnif.c59
-rw-r--r--priv/templates/basicnif.erl42
-rw-r--r--priv/templates/basicnif.template3
-rw-r--r--priv/templates/ctsuite.erl167
-rw-r--r--priv/templates/ctsuite.template2
-rw-r--r--priv/templates/gitignore13
-rw-r--r--priv/templates/license.template7
-rw-r--r--priv/templates/listenapp.app.src17
-rw-r--r--priv/templates/listenapp_app.erl77
-rw-r--r--priv/templates/otp_app.app.src12
-rw-r--r--priv/templates/otp_fsm.erl79
-rw-r--r--priv/templates/otp_lib.app.src12
-rw-r--r--priv/templates/otp_lib.template7
-rw-r--r--priv/templates/otp_rel.template10
-rw-r--r--priv/templates/otp_srv.erl63
-rw-r--r--priv/templates/otpapp.template15
-rw-r--r--priv/templates/otpfsm.template8
-rw-r--r--priv/templates/otplib.app.src13
-rw-r--r--priv/templates/otplib.template13
-rw-r--r--priv/templates/otpsrv.template8
-rw-r--r--priv/templates/readme.template7
-rw-r--r--priv/templates/rebar.config (renamed from priv/templates/simple_rebar.config)0
-rw-r--r--priv/templates/relx.config12
-rw-r--r--priv/templates/simple_SUITE.erl48
-rw-r--r--priv/templates/simple_SUITE.template7
-rw-r--r--priv/templates/simple_gitignore.template2
-rw-r--r--priv/templates/simpleapp.app.src17
-rw-r--r--priv/templates/simpleapp.template4
-rw-r--r--priv/templates/simpleapp_app.erl55
-rw-r--r--priv/templates/simpleapp_gitignore12
-rw-r--r--priv/templates/simpleevent.erl60
-rw-r--r--priv/templates/simpleevent.template2
-rw-r--r--priv/templates/simplefsm.erl57
-rw-r--r--priv/templates/simplefsm.template2
-rw-r--r--priv/templates/simplelib.app.src14
-rw-r--r--priv/templates/simplelib.erl18
-rw-r--r--priv/templates/simplelib.template3
-rw-r--r--priv/templates/simplelogging.hrl19
-rw-r--r--priv/templates/simplelogging.template2
-rw-r--r--priv/templates/simplemod.erl6
-rw-r--r--priv/templates/simplemod.template3
-rw-r--r--priv/templates/simplemod_tests.erl3
-rw-r--r--priv/templates/simplenode.erl.script44
-rwxr-xr-xpriv/templates/simplenode.install_upgrade.escript52
-rwxr-xr-xpriv/templates/simplenode.nodetool182
-rw-r--r--priv/templates/simplenode.reltool.config44
-rwxr-xr-xpriv/templates/simplenode.runner404
-rw-r--r--priv/templates/simplenode.sys.config11
-rw-r--r--priv/templates/simplenode.template13
-rw-r--r--priv/templates/simplenode.vm.args19
-rw-r--r--priv/templates/simplenode.windows.runner.cmd103
-rw-r--r--priv/templates/simplenode.windows.start_erl.cmd40
-rw-r--r--priv/templates/simplesrv.erl50
-rw-r--r--priv/templates/simplesrv.template2
-rw-r--r--priv/templates/simplesup.erl37
-rw-r--r--priv/templates/simplesup.template8
-rw-r--r--priv/templates/sup.erl (renamed from priv/templates/simpleapp_sup.erl)2
-rw-r--r--priv/templates/sys.config3
-rw-r--r--priv/templates/vm.args6
61 files changed, 87 insertions, 1937 deletions
diff --git a/priv/templates/README.md b/priv/templates/README.md
index 939799a..ce2898e 100644
--- a/priv/templates/README.md
+++ b/priv/templates/README.md
@@ -6,9 +6,4 @@ An Erlang {{appid}} library.
Build
-----
- $ rebar get-deps compile
-
-Run
----
-
- $ erl -pa ebin -env ERL_LIBS deps -s {{appid}} \ No newline at end of file
+ $ rebar compile
diff --git a/priv/templates/simpleapp.erl b/priv/templates/app.erl
index 6f76752..1c3e8f2 100644
--- a/priv/templates/simpleapp.erl
+++ b/priv/templates/app.erl
@@ -1,21 +1,26 @@
%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
%% @doc {{appid}} public API
%% @end
%%%-------------------------------------------------------------------
--module({{appid}}).
+-module({{appid}}_app).
-%% API
--export([
- ]).
+-behaviour(application).
+
+%% Application callbacks
+-export([start/2
+ ,stop/1]).
%%====================================================================
%% API
%%====================================================================
+start(_StartType, _StartArgs) ->
+ {{appid}}_sup:start_link().
+%%--------------------------------------------------------------------
+stop(_State) ->
+ ok.
%%====================================================================
%% Internal functions
diff --git a/priv/templates/basicnif.c b/priv/templates/basicnif.c
deleted file mode 100644
index a1aa9e9..0000000
--- a/priv/templates/basicnif.c
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "erl_nif.h"
-
-static ErlNifResourceType* {{module}}_RESOURCE = NULL;
-
-typedef struct
-{
-} {{module}}_handle;
-
-// Prototypes
-static ERL_NIF_TERM {{module}}_new(ErlNifEnv* env, int argc,
- const ERL_NIF_TERM argv[]);
-static ERL_NIF_TERM {{module}}_myfunction(ErlNifEnv* env, int argc,
- const ERL_NIF_TERM argv[]);
-
-static ErlNifFunc nif_funcs[] =
-{
- {"new", 0, {{module}}_new},
- {"myfunction", 1, {{module}}_myfunction}
-};
-
-static ERL_NIF_TERM {{module}}_new(ErlNifEnv* env, int argc,
- const ERL_NIF_TERM argv[])
-{
- {{module}}_handle* handle = enif_alloc_resource({{module}}_RESOURCE,
- sizeof({{module}}_handle));
- ERL_NIF_TERM result = enif_make_resource(env, handle);
- enif_release_resource(handle);
- return enif_make_tuple2(env, enif_make_atom(env, "ok"), result);
-}
-
-
-static ERL_NIF_TERM {{module}}_myfunction(ErlNifEnv* env, int argc,
- const ERL_NIF_TERM argv[])
-{
- return enif_make_atom(env, "ok");
-}
-
-static void {{module}}_resource_cleanup(ErlNifEnv* env, void* arg)
-{
- /* Delete any dynamically allocated memory stored in {{module}}_handle */
- /* {{module}}_handle* handle = ({{module}}_handle*)arg; */
-}
-
-static int on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
-{
- ErlNifResourceFlags flags = ERL_NIF_RT_CREATE | ERL_NIF_RT_TAKEOVER;
- ErlNifResourceType* rt = enif_open_resource_type(env, NULL,
- "{{module}}_resource",
- &{{module}}_resource_cleanup,
- flags, NULL);
- if (rt == NULL)
- return -1;
-
- {{module}}_RESOURCE = rt;
-
- return 0;
-}
-
-ERL_NIF_INIT({{module}}, nif_funcs, &on_load, NULL, NULL, NULL);
diff --git a/priv/templates/basicnif.erl b/priv/templates/basicnif.erl
deleted file mode 100644
index e1f4143..0000000
--- a/priv/templates/basicnif.erl
+++ /dev/null
@@ -1,42 +0,0 @@
--module({{module}}).
-
--export([new/0,
- myfunction/1]).
-
--on_load(init/0).
-
--define(nif_stub, nif_stub_error(?LINE)).
-nif_stub_error(Line) ->
- erlang:nif_error({nif_not_loaded,module,?MODULE,line,Line}).
-
--ifdef(TEST).
--include_lib("eunit/include/eunit.hrl").
--endif.
-
-init() ->
- PrivDir = case code:priv_dir(?MODULE) of
- {error, bad_name} ->
- EbinDir = filename:dirname(code:which(?MODULE)),
- AppPath = filename:dirname(EbinDir),
- filename:join(AppPath, "priv");
- Path ->
- Path
- end,
- erlang:load_nif(filename:join(PrivDir, ?MODULE), 0).
-
-new() ->
- ?nif_stub.
-
-myfunction(_Ref) ->
- ?nif_stub.
-
-%% ===================================================================
-%% EUnit tests
-%% ===================================================================
--ifdef(TEST).
-
-basic_test() ->
- {ok, Ref} = new(),
- ?assertEqual(ok, myfunction(Ref)).
-
--endif.
diff --git a/priv/templates/basicnif.template b/priv/templates/basicnif.template
deleted file mode 100644
index 6dde8bb..0000000
--- a/priv/templates/basicnif.template
+++ /dev/null
@@ -1,3 +0,0 @@
-{variables, [{module, "mymodule"}]}.
-{template, "basicnif.erl", "src/{{module}}.erl"}.
-{template, "basicnif.c", "c_src/{{module}}.c"}.
diff --git a/priv/templates/ctsuite.erl b/priv/templates/ctsuite.erl
deleted file mode 100644
index 33a8fac..0000000
--- a/priv/templates/ctsuite.erl
+++ /dev/null
@@ -1,167 +0,0 @@
-%% common_test suite for {{testmod}}
-
--module({{testmod}}_SUITE).
--include_lib("common_test/include/ct.hrl").
-
--compile(export_all).
-
-%%--------------------------------------------------------------------
-%% Function: suite() -> Info
-%%
-%% Info = [tuple()]
-%% List of key/value pairs.
-%%
-%% Description: Returns list of tuples to set default properties
-%% for the suite.
-%%
-%% Note: The suite/0 function is only meant to be used to return
-%% default data values, not perform any other operations.
-%%--------------------------------------------------------------------
-suite() -> [{timetrap, {seconds, 20}}].
-
-%%--------------------------------------------------------------------
-%% Function: groups() -> [Group]
-%%
-%% Group = {GroupName,Properties,GroupsAndTestCases}
-%% GroupName = atom()
-%% The name of the group.
-%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
-%% Group properties that may be combined.
-%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
-%% TestCase = atom()
-%% The name of a test case.
-%% Shuffle = shuffle | {shuffle,Seed}
-%% To get cases executed in random order.
-%% Seed = {integer(),integer(),integer()}
-%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
-%% repeat_until_any_ok | repeat_until_any_fail
-%% To get execution of cases repeated.
-%% N = integer() | forever
-%%
-%% Description: Returns a list of test case group definitions.
-%%--------------------------------------------------------------------
-groups() -> [].
-
-%%--------------------------------------------------------------------
-%% Function: all() -> GroupsAndTestCases
-%%
-%% GroupsAndTestCases = [{group,GroupName} | TestCase]
-%% GroupName = atom()
-%% Name of a test case group.
-%% TestCase = atom()
-%% Name of a test case.
-%%
-%% Description: Returns the list of groups and test cases that
-%% are to be executed.
-%%
-%% NB: By default, we export all 1-arity user defined functions
-%%--------------------------------------------------------------------
-all() ->
- [ {exports, Functions} | _ ] = ?MODULE:module_info(),
- [ FName || {FName, _} <- lists:filter(
- fun ({module_info,_}) -> false;
- ({all,_}) -> false;
- ({init_per_suite,1}) -> false;
- ({end_per_suite,1}) -> false;
- ({_,1}) -> true;
- ({_,_}) -> false
- end, Functions)].
-
-%%--------------------------------------------------------------------
-%% Function: init_per_suite(Config0) ->
-%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
-%%
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding the test case configuration.
-%% Reason = term()
-%% The reason for skipping the suite.
-%%
-%% Description: Initialization before the suite.
-%%
-%% Note: This function is free to add any key/value pairs to the Config
-%% variable, but should NOT alter/remove any existing entries.
-%%--------------------------------------------------------------------
-init_per_suite(Config) ->
- Config.
-
-%%--------------------------------------------------------------------
-%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
-%%
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding the test case configuration.
-%%
-%% Description: Cleanup after the suite.
-%%--------------------------------------------------------------------
-end_per_suite(_Config) ->
- ok.
-
-%%--------------------------------------------------------------------
-%% Function: init_per_group(GroupName, Config0) ->
-%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
-%%
-%% GroupName = atom()
-%% Name of the test case group that is about to run.
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding configuration data for the group.
-%% Reason = term()
-%% The reason for skipping all test cases and subgroups in the group.
-%%
-%% Description: Initialization before each test case group.
-%%--------------------------------------------------------------------
-init_per_group(_group, Config) ->
- Config.
-
-%%--------------------------------------------------------------------
-%% Function: end_per_group(GroupName, Config0) ->
-%% void() | {save_config,Config1}
-%%
-%% GroupName = atom()
-%% Name of the test case group that is finished.
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding configuration data for the group.
-%%
-%% Description: Cleanup after each test case group.
-%%--------------------------------------------------------------------
-end_per_group(_group, Config) ->
- Config.
-
-%%--------------------------------------------------------------------
-%% Function: init_per_testcase(TestCase, Config0) ->
-%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
-%%
-%% TestCase = atom()
-%% Name of the test case that is about to run.
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding the test case configuration.
-%% Reason = term()
-%% The reason for skipping the test case.
-%%
-%% Description: Initialization before each test case.
-%%
-%% Note: This function is free to add any key/value pairs to the Config
-%% variable, but should NOT alter/remove any existing entries.
-%%--------------------------------------------------------------------
-init_per_testcase(TestCase, Config) ->
- Config.
-
-%%--------------------------------------------------------------------
-%% Function: end_per_testcase(TestCase, Config0) ->
-%% void() | {save_config,Config1} | {fail,Reason}
-%%
-%% TestCase = atom()
-%% Name of the test case that is finished.
-%% Config0 = Config1 = [tuple()]
-%% A list of key/value pairs, holding the test case configuration.
-%% Reason = term()
-%% The reason for failing the test case.
-%%
-%% Description: Cleanup after each test case.
-%%--------------------------------------------------------------------
-end_per_testcase(TestCase, Config) ->
- Config.
-
-test_{{testmod}}() ->
- [{userdata,[{doc,"Testing the {{testmod}} module"}]}].
-
-test_{{testmod}}(_Config) ->
- {skip,"Not implemented."}.
diff --git a/priv/templates/ctsuite.template b/priv/templates/ctsuite.template
deleted file mode 100644
index b7de337..0000000
--- a/priv/templates/ctsuite.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{testmod, "mymodule"}]}.
-{template, "ctsuite.erl", "test/{{testmod}}_SUITE.erl"}.
diff --git a/priv/templates/gitignore b/priv/templates/gitignore
new file mode 100644
index 0000000..79ae0fb
--- /dev/null
+++ b/priv/templates/gitignore
@@ -0,0 +1,13 @@
+.eunit
+deps
+priv
+*.o
+*.beam
+*.plt
+.erlang.cookie
+ebin
+log
+erl_crash.dump
+.rebar
+_rel
+logs
diff --git a/priv/templates/license.template b/priv/templates/license.template
deleted file mode 100644
index b903017..0000000
--- a/priv/templates/license.template
+++ /dev/null
@@ -1,7 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "LICENSE", "LICENSE"}.
diff --git a/priv/templates/listenapp.app.src b/priv/templates/listenapp.app.src
deleted file mode 100644
index 5efb148..0000000
--- a/priv/templates/listenapp.app.src
+++ /dev/null
@@ -1,17 +0,0 @@
-{application, {{appid}},
- [
- {description, "{{appid}}"}
- ,{vsn, "0.1.0"}
- ,{registered, [{{appid}}_sup]}
- ,{applications,
- [kernel
- ,stdlib
- ]}
- ,{mod, { {{appid}}, []} }
- ,{env,
- [
- ]}
- ,{start_phases,
- [{listen, []}
- ]}
- ]}.
diff --git a/priv/templates/listenapp_app.erl b/priv/templates/listenapp_app.erl
deleted file mode 100644
index 7740a69..0000000
--- a/priv/templates/listenapp_app.erl
+++ /dev/null
@@ -1,77 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc {{appid}} OTP application callback module.
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{appid}}_app).
-
--behaviour(application).
-
--define(APP, {{appid}}).
-
-%% Application callbacks
--export([start_phase/3, start/2, stop/1]).
-
--export([config/0, config/1, config/2,
- start/0, a_start/2]).
-
-%%%===================================================================
-%%% Convenience Functions
-%%%===================================================================
-
-start() ->
- a_start(?APP, permanent).
-
-config(Key, Default) ->
- case application:get_env(?APP, Key) of
- undefined -> Default;
- {ok, Val} -> Val
- end.
-
-config(Key) ->
- case application:get_env(?APP, Key) of
- undefined -> erlang:error({missing_config, Key});
- {ok, Val} -> Val
- end.
-
-config() ->
- application:get_all_env(?APP).
-
-
-%% ===================================================================
-%% Application callbacks
-%% ===================================================================
-
-start(_StartType, _StartArgs) ->
- {{appid}}_sup:start_link().
-
-stop(_State) ->
- ok.
-
-start_phase(listen, _Type, _Args) ->
- Dispatch = [{'_',
- [{'_', {{app}}_http_handler, []}]}
- ],
- cowboy:start_listener(http, 100,
- cowboy_tcp_transport,
- [{port, config(http_listen_port)}],
- cowboy_http_protocol,
- [{dispatch, Dispatch}]),
- ok.
-
-%%%===================================================================
-%%% Internal functions
-%%%===================================================================
-
-a_start(App, Type) ->
- start_ok(App, Type, application:start(App, Type)).
-
-start_ok(_App, _Type, ok) -> ok;
-start_ok(_App, _Type, {error, {already_started, _App}}) -> ok;
-start_ok(App, Type, {error, {not_started, Dep}}) ->
- ok = a_start(Dep, Type),
- a_start(App, Type);
-start_ok(App, _Type, {error, Reason}) ->
- erlang:error({app_start_failed, App, Reason}).
diff --git a/priv/templates/otp_app.app.src b/priv/templates/otp_app.app.src
new file mode 100644
index 0000000..1a4e4e8
--- /dev/null
+++ b/priv/templates/otp_app.app.src
@@ -0,0 +1,12 @@
+{application, {{appid}},
+ [
+ {description, "{{appid}}"}
+ ,{vsn, "0.1.0"}
+ ,{registered, []}
+ ,{mod, {'{{appid}}_app', []}}
+ ,{applications,
+ [kernel
+ ,stdlib
+ ]}
+ ,{env,[]}
+ ]}.
diff --git a/priv/templates/otp_fsm.erl b/priv/templates/otp_fsm.erl
deleted file mode 100644
index 0f1eafb..0000000
--- a/priv/templates/otp_fsm.erl
+++ /dev/null
@@ -1,79 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc {{appid}} {{fsmid}} OTP FSM.
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{appid}}_{{fsmid}}_fsm).
-
--behaviour(gen_fsm).
-
--include("{{appid}}_log.hrl").
-
-%% API
--export([start_link/0
- ]).
-
-%% gen_fsm callbacks
--export([init/1, handle_event/3, handle_sync_event/4, handle_info/3,
- terminate/3, code_change/4]).
-
--export([disconnected/2
- ,disconnected/3
- ]).
-
--record(state, {replaceme}).
-
-%%====================================================================
-%% API
-%%====================================================================
-start_link() ->
- gen_fsm:start_link(?MODULE, [], []).
-
-%%====================================================================
-%% gen_fsm callbacks
-%%====================================================================
-
-%% gen_fsm init/1 callback
-%% @private
-init([]) ->
- {ok, disconnected, #state{}}.
-
-%% state event handler functions.
-%% @private
-disconnected(Event, State) ->
- ?WARN("[state: disconnected] Unhandled event: ~p", [Event]),
- {next_state, disconnected, State}.
-
-disconnected(Event, _From, State) ->
- ?WARN("[state: disconnected] Unhandled event: ~p", [Event]),
- {next_state, disconnected, State}.
-
-%% gen_fsm callbacks
-%% @private
-handle_event(Event, StateName, State) ->
- ?WARN("[state: ~p] Unhandled event: ~p", [StateName, Event]),
- {next_state, StateName, State}.
-
-%% @private
-handle_sync_event(Event, _From, StateName, State) ->
- ?WARN("[state: ~p] Unhandled event: ~p", [StateName, Event]),
- {next_state, StateName, State}.
-
-%% @private
-handle_info(Info, StateName, State) ->
- ?INFO("[state: ~p] Unexpected msg: ~p", [StateName, Info]),
- {next_state, StateName, State}.
-
-%% @private
-terminate(_Reason, _StateName, _State) ->
- ok.
-
-%% @private
-code_change(_OldVsn, StateName, State, _Extra) ->
- {ok, StateName, State}.
-
-%%====================================================================
-%% Internal functions
-%%====================================================================
diff --git a/priv/templates/otp_lib.app.src b/priv/templates/otp_lib.app.src
new file mode 100644
index 0000000..1a4e4e8
--- /dev/null
+++ b/priv/templates/otp_lib.app.src
@@ -0,0 +1,12 @@
+{application, {{appid}},
+ [
+ {description, "{{appid}}"}
+ ,{vsn, "0.1.0"}
+ ,{registered, []}
+ ,{mod, {'{{appid}}_app', []}}
+ ,{applications,
+ [kernel
+ ,stdlib
+ ]}
+ ,{env,[]}
+ ]}.
diff --git a/priv/templates/otp_lib.template b/priv/templates/otp_lib.template
new file mode 100644
index 0000000..605de9c
--- /dev/null
+++ b/priv/templates/otp_lib.template
@@ -0,0 +1,7 @@
+{template, "app.erl", "src/{{appid}}_app.erl"}.
+{template, "sup.erl", "src/{{appid}}_sup.erl"}.
+{template, "otp_lib.app.src", "src/{{appid}}.app.src"}.
+{template, "rebar.config", "rebar.config"}.
+{template, "gitignore", ".gitignore"}.
+{template, "LICENSE", "LICENSE"}.
+{template, "README.md", "README.md"}.
diff --git a/priv/templates/otp_rel.template b/priv/templates/otp_rel.template
new file mode 100644
index 0000000..450c539
--- /dev/null
+++ b/priv/templates/otp_rel.template
@@ -0,0 +1,10 @@
+{template, "app.erl", "apps/{{appid}}/src/{{appid}}_app.erl"}.
+{template, "sup.erl", "apps/{{appid}}/src/{{appid}}_sup.erl"}.
+{template, "otp_app.app.src", "apps/{{appid}}/src/{{appid}}.app.src"}.
+{template, "rebar.config", "rebar.config"}.
+{template, "relx.config", "relx.config"}.
+{template, "sys.config", "config/sys.config"}.
+{template, "vm.args", "config/vm.args"}.
+{template, "gitignore", ".gitignore"}.
+{template, "LICENSE", "LICENSE"}.
+{template, "README.md", "README.md"}.
diff --git a/priv/templates/otp_srv.erl b/priv/templates/otp_srv.erl
deleted file mode 100644
index 11609c0..0000000
--- a/priv/templates/otp_srv.erl
+++ /dev/null
@@ -1,63 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc {{appid}} {{srvid}} OTP gen_server.
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{appid}}_{{srvid}}).
-
--behaviour(gen_server).
-
--include("{{appid}}_log.hrl").
-
-%% API
--export([start_link/0
- ]).
-
-%% gen_server callbacks
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
-
--record(state, {replaceme}).
-
-%%====================================================================
-%% API
-%%====================================================================
-start_link() ->
- gen_server:start_link(?MODULE, [], []).
-
-%%====================================================================
-%% gen_server callbacks
-%%====================================================================
-
-%% @private
-init([]) ->
- {ok, #state{}}.
-
-%% @private
-handle_call(Call, _From, State) ->
- ?WARN("Unexpected call ~p.", [Call]),
- {noreply, State}.
-
-%% @private
-handle_cast(Msg, State) ->
- ?WARN("Unexpected cast ~p", [Msg]),
- {noreply, State}.
-
-%% @private
-handle_info(Info, State) ->
- ?WARN("Unexpected info ~p", [Info]),
- {noreply, State}.
-
-%% @private
-terminate(_Reason, _State) ->
- ok.
-
-%% @private
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-%%====================================================================
-%% internal functions
-%%====================================================================
diff --git a/priv/templates/otpapp.template b/priv/templates/otpapp.template
deleted file mode 100644
index 525ea57..0000000
--- a/priv/templates/otpapp.template
+++ /dev/null
@@ -1,15 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "simpleapp.erl", "src/{{appid}}.erl"}.
-{template, "simpleapp.app.src", "src/{{appid}}.app.src"}.
-{template, "simpleapp_app.erl", "src/{{appid}}_app.erl"}.
-{template, "simpleapp_sup.erl", "src/{{appid}}_sup.erl"}.
-{template, "simplelogging.hrl", "src/{{appid}}_log.hrl"}.
-{template, "simple_rebar.config", "rebar.config"}.
-{template, "simpleapp_gitignore", ".gitignore"}.
-{template, "LICENSE", "LICENSE"}.
-{template, "README.md", "README.md"}. \ No newline at end of file
diff --git a/priv/templates/otpfsm.template b/priv/templates/otpfsm.template
deleted file mode 100644
index 15deb18..0000000
--- a/priv/templates/otpfsm.template
+++ /dev/null
@@ -1,8 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{fsmid, "fsmid"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "otp_fsm.erl", "src/{{appid}}_{{fsmid}}_fsm.erl"}. \ No newline at end of file
diff --git a/priv/templates/otplib.app.src b/priv/templates/otplib.app.src
deleted file mode 100644
index 2919bc4..0000000
--- a/priv/templates/otplib.app.src
+++ /dev/null
@@ -1,13 +0,0 @@
-{application, {{appid}},
- [
- {description, "{{appid}}"}
- ,{vsn, "0.1.0"}
- ,{registered, []}
- ,{applications,
- [kernel
- ,stdlib
- ]}
- ,{env,
- [
- ]}
- ]}.
diff --git a/priv/templates/otplib.template b/priv/templates/otplib.template
deleted file mode 100644
index 8cb58fe..0000000
--- a/priv/templates/otplib.template
+++ /dev/null
@@ -1,13 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "simpleapp.erl", "src/{{appid}}.erl"}.
-{template, "otplib.app.src", "src/{{appid}}.app.src"}.
-{template, "simplelogging.hrl", "src/{{appid}}_log.hrl"}.
-{template, "simple_rebar.config", "rebar.config"}.
-{template, "simpleapp_gitignore", ".gitignore"}.
-{template, "LICENSE", "LICENSE"}.
-{template, "README.md", "README.md"}. \ No newline at end of file
diff --git a/priv/templates/otpsrv.template b/priv/templates/otpsrv.template
deleted file mode 100644
index d65f58b..0000000
--- a/priv/templates/otpsrv.template
+++ /dev/null
@@ -1,8 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{srvid, "mysrv"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "otp_srv.erl", "src/{{appid}}_{{srvid}}.erl"}. \ No newline at end of file
diff --git a/priv/templates/readme.template b/priv/templates/readme.template
deleted file mode 100644
index 2ee6e44..0000000
--- a/priv/templates/readme.template
+++ /dev/null
@@ -1,7 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "Readme.md", "Readme.md"}.
diff --git a/priv/templates/simple_rebar.config b/priv/templates/rebar.config
index f618f3e..f618f3e 100644
--- a/priv/templates/simple_rebar.config
+++ b/priv/templates/rebar.config
diff --git a/priv/templates/relx.config b/priv/templates/relx.config
new file mode 100644
index 0000000..7cb3a8a
--- /dev/null
+++ b/priv/templates/relx.config
@@ -0,0 +1,12 @@
+%% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*-
+{release, {'{{appid}}', "0.1.0"},
+ [{{appid}},
+ sasl]}.
+
+{sys_config, "./config/sys.config"}.
+{vm_args, "./config/vm.args"}.
+
+{dev_mode, true}.
+{include_erts, false}.
+
+{extended_start_script, true}.
diff --git a/priv/templates/simple_SUITE.erl b/priv/templates/simple_SUITE.erl
deleted file mode 100644
index f6c03fb..0000000
--- a/priv/templates/simple_SUITE.erl
+++ /dev/null
@@ -1,48 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc CommonTest test suite for {{test}}
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{test}}_SUITE).
--include_lib("common_test/include/ct.hrl").
--compile(export_all).
-
-%%%%%%%%%%%%%%%%%%%%
-%%% Tests to run %%%
-%%%%%%%%%%%%%%%%%%%%
-%% Specific test cases or groups to run. The test case is named as
-%% a single atom.
-
-all() ->
- [default_case].
-
-%%%%%%%%%%%%%%%%%%%%%%
-%%% Setup/Teardown %%%
-%%%%%%%%%%%%%%%%%%%%%%
-%% Runs once at the beginning of the suite. The process is different
-%% from the one the case will run in.
-init_per_suite(Config) ->
- Config.
-
-%% Runs once at the end of the suite. The process is different
-%% from the one the case will run in.
-end_per_suite(Config) ->
- Config.
-
-%% Runs before the test case. Runs in the same process.
-init_per_testcase(_CaseName, Config) ->
- Config.
-
-%% Runs after the test case. Runs in the same process.
-end_per_testcase(_CaseName, Config) ->
- Config.
-
-%%%%%%%%%%%%%
-%%% TESTS %%%
-%%%%%%%%%%%%%
-default_case(Config) ->
- _Priv = ?config(priv_dir, Config),
- _Data = ?config(data_dir, Config),
- ok.
diff --git a/priv/templates/simple_SUITE.template b/priv/templates/simple_SUITE.template
deleted file mode 100644
index 843cce7..0000000
--- a/priv/templates/simple_SUITE.template
+++ /dev/null
@@ -1,7 +0,0 @@
-{variables, [{test, "mytest"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "simple_SUITE.erl", "test/{{test}}_SUITE.erl"}.
diff --git a/priv/templates/simple_gitignore.template b/priv/templates/simple_gitignore.template
deleted file mode 100644
index 890dd90..0000000
--- a/priv/templates/simple_gitignore.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{appid, "myapp"}]}.
-{template, "simpleapp_gitignore", ".gitignore"}. \ No newline at end of file
diff --git a/priv/templates/simpleapp.app.src b/priv/templates/simpleapp.app.src
deleted file mode 100644
index c9eefd1..0000000
--- a/priv/templates/simpleapp.app.src
+++ /dev/null
@@ -1,17 +0,0 @@
-{application, {{appid}},
- [
- {description, "{{appid}}"}
- ,{vsn, "0.1.0"}
- ,{registered, [{{appid}}_sup]}
- ,{applications,
- [kernel
- ,stdlib
- ]}
- ,{mod, { {{appid}}, []}}
- ,{env,
- [
- ]}
- ,{start_phases,
- [{listen, []}
- ]}
- ]}.
diff --git a/priv/templates/simpleapp.template b/priv/templates/simpleapp.template
deleted file mode 100644
index 2419a00..0000000
--- a/priv/templates/simpleapp.template
+++ /dev/null
@@ -1,4 +0,0 @@
-{variables, [{appid, "myapp"}]}.
-{template, "simpleapp.app.src", "src/{{appid}}.app.src"}.
-{template, "simpleapp_app.erl", "src/{{appid}}_app.erl"}.
-{template, "simpleapp_sup.erl", "src/{{appid}}_sup.erl"}.
diff --git a/priv/templates/simpleapp_app.erl b/priv/templates/simpleapp_app.erl
deleted file mode 100644
index 8c645ca..0000000
--- a/priv/templates/simpleapp_app.erl
+++ /dev/null
@@ -1,55 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc {{appid}} OTP application callback module.
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{appid}}_app).
-
--behaviour(application).
-
--define(APP, {{appid}}).
-
-%% Application callbacks
--export([start/2, stop/1]).
-
--export([config/0, config/1, config/2,
- start/0]).
-
-%%%===================================================================
-%%% Convenience Functions
-%%%===================================================================
-
-start() ->
- application:ensure_all_started(?APP, permanent).
-
-config(Key, Default) ->
- case application:get_env(?APP, Key) of
- undefined -> Default;
- {ok, Val} -> Val
- end.
-
-config(Key) ->
- case application:get_env(?APP, Key) of
- undefined -> erlang:error({missing_config, Key});
- {ok, Val} -> Val
- end.
-
-config() ->
- application:get_all_env(?APP).
-
-
-%% ===================================================================
-%% Application callbacks
-%% ===================================================================
-
-start(_StartType, _StartArgs) ->
- {{appid}}_sup:start_link().
-
-stop(_State) ->
- ok.
-
-%%%===================================================================
-%%% Internal functions
-%%%===================================================================
diff --git a/priv/templates/simpleapp_gitignore b/priv/templates/simpleapp_gitignore
deleted file mode 100644
index 39e58a6..0000000
--- a/priv/templates/simpleapp_gitignore
+++ /dev/null
@@ -1,12 +0,0 @@
-*~
-*.beam
-.gitignore
-ebin/*.app
-c_src/*.o
-.eunit/*
-.#*
-deps/*
-.rebar/
-.rebarinfo
-.edts*
-logs/* \ No newline at end of file
diff --git a/priv/templates/simpleevent.erl b/priv/templates/simpleevent.erl
deleted file mode 100644
index 1d529a3..0000000
--- a/priv/templates/simpleevent.erl
+++ /dev/null
@@ -1,60 +0,0 @@
--module({{eventid}}).
--behaviour(gen_event).
-
-%% ------------------------------------------------------------------
-%% API Function Exports
-%% ------------------------------------------------------------------
-
--export([start_link/0,
- add_handler/2]).
-
-%% ------------------------------------------------------------------
-%% gen_event Function Exports
-%% ------------------------------------------------------------------
-
--export([init/1,
- handle_event/2,
- handle_call/2,
- handle_info/2,
- terminate/2,
- code_change/3]).
-
--record(state, {}).
-
-%% ------------------------------------------------------------------
-%% API Function Definitions
-%% ------------------------------------------------------------------
-
-start_link() ->
- gen_event:start_link({local, ?MODULE}).
-
-add_handler(Handler, Args) ->
- gen_event:add_handler(?MODULE, Handler, Args).
-
-%% ------------------------------------------------------------------
-%% gen_event Function Definitions
-%% ------------------------------------------------------------------
-
-init([]) ->
- {ok, #state{}}.
-
-handle_event(_Event, State) ->
- {ok, State}.
-
-handle_call(_Request, State) ->
- Reply = ok,
- {ok, Reply, State}.
-
-handle_info(_Info, State) ->
- {ok, State}.
-
-terminate(_Reason, _State) ->
- ok.
-
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-%% ------------------------------------------------------------------
-%% Internal Function Definitions
-%% ------------------------------------------------------------------
-
diff --git a/priv/templates/simpleevent.template b/priv/templates/simpleevent.template
deleted file mode 100644
index 68f3894..0000000
--- a/priv/templates/simpleevent.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{eventid, "myevent"}]}.
-{template, "simpleevent.erl", "src/{{eventid}}.erl"}.
diff --git a/priv/templates/simplefsm.erl b/priv/templates/simplefsm.erl
deleted file mode 100644
index 776081e..0000000
--- a/priv/templates/simplefsm.erl
+++ /dev/null
@@ -1,57 +0,0 @@
--module({{fsmid}}).
--behaviour(gen_fsm).
--define(SERVER, ?MODULE).
-
-%% ------------------------------------------------------------------
-%% API Function Exports
-%% ------------------------------------------------------------------
-
--export([start_link/0]).
-
-%% ------------------------------------------------------------------
-%% gen_fsm Function Exports
-%% ------------------------------------------------------------------
-
--export([init/1, state_name/2, state_name/3, handle_event/3,
- handle_sync_event/4, handle_info/3, terminate/3,
- code_change/4]).
-
-%% ------------------------------------------------------------------
-%% API Function Definitions
-%% ------------------------------------------------------------------
-
-start_link() ->
- gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], []).
-
-%% ------------------------------------------------------------------
-%% gen_fsm Function Definitions
-%% ------------------------------------------------------------------
-
-init(_Args) ->
- {ok, initial_state_name, initial_state}.
-
-state_name(_Event, State) ->
- {next_state, state_name, State}.
-
-state_name(_Event, _From, State) ->
- {reply, ok, state_name, State}.
-
-handle_event(_Event, StateName, State) ->
- {next_state, StateName, State}.
-
-handle_sync_event(_Event, _From, StateName, State) ->
- {reply, ok, StateName, State}.
-
-handle_info(_Info, StateName, State) ->
- {next_state, StateName, State}.
-
-terminate(_Reason, _StateName, _State) ->
- ok.
-
-code_change(_OldVsn, StateName, State, _Extra) ->
- {ok, StateName, State}.
-
-%% ------------------------------------------------------------------
-%% Internal Function Definitions
-%% ------------------------------------------------------------------
-
diff --git a/priv/templates/simplefsm.template b/priv/templates/simplefsm.template
deleted file mode 100644
index 179c739..0000000
--- a/priv/templates/simplefsm.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{fsmid, "myfsm"}]}.
-{template, "simplefsm.erl", "src/{{fsmid}}.erl"}.
diff --git a/priv/templates/simplelib.app.src b/priv/templates/simplelib.app.src
deleted file mode 100644
index 752665a..0000000
--- a/priv/templates/simplelib.app.src
+++ /dev/null
@@ -1,14 +0,0 @@
-{application, {{libid}},
- [
- {description, "An Erlang {{libid}} library"},
- {vsn, "1"},
- {modules, [
- {{libid}}
- ]},
- {registered, []},
- {applications, [
- kernel,
- stdlib
- ]},
- {env, []}
- ]}.
diff --git a/priv/templates/simplelib.erl b/priv/templates/simplelib.erl
deleted file mode 100644
index 2c4451f..0000000
--- a/priv/templates/simplelib.erl
+++ /dev/null
@@ -1,18 +0,0 @@
--module({{libid}}).
-
-%% {{libid}}: {{libid}} library's entry point.
-
--export([my_func/0]).
-
-
-%% API
-
-my_func() ->
- ok().
-
-%% Internals
-
-ok() ->
- ok.
-
-%% End of Module.
diff --git a/priv/templates/simplelib.template b/priv/templates/simplelib.template
deleted file mode 100644
index 59d20fa..0000000
--- a/priv/templates/simplelib.template
+++ /dev/null
@@ -1,3 +0,0 @@
-{variables, [{libid, "mylib"}]}.
-{template, "simplelib.app.src", "src/{{libid}}.app.src"}.
-{template, "simplelib.erl", "src/{{libid}}.erl"}.
diff --git a/priv/templates/simplelogging.hrl b/priv/templates/simplelogging.hrl
deleted file mode 100644
index d46dae3..0000000
--- a/priv/templates/simplelogging.hrl
+++ /dev/null
@@ -1,19 +0,0 @@
-%%% Author : Geoff Cant <nem@erlang.geek.nz>
-%%% Description : Logging macros
-%%% Created : 13 Jan 2006 by Geoff Cant <nem@erlang.geek.nz>
-
--ifndef(logging_macros).
--define(logging_macros, true).
-
-
--define(INFO(Format, Args),
- error_logger:info_msg("pid=~p mod=~p line=~p " ++ Format,
- [self(), ?MODULE, ?LINE | Args])).
--define(WARN(Format, Args),
- error_logger:warning_msg("pid=~p mod=~p line=~p " ++ Format,
- [self(), ?MODULE, ?LINE | Args])).
--define(ERR(Format, Args),
- error_logger:error_msg("pid=~p mod=~p line=~p " ++ Format,
- [self(), ?MODULE, ?LINE | Args])).
-
--endif. %logging
diff --git a/priv/templates/simplelogging.template b/priv/templates/simplelogging.template
deleted file mode 100644
index e8baa83..0000000
--- a/priv/templates/simplelogging.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{appid, "myapp"}]}.
-{template, "simplelogging.hrl", "src/{{appid}}_log.hrl"}.
diff --git a/priv/templates/simplemod.erl b/priv/templates/simplemod.erl
deleted file mode 100644
index 46597ae..0000000
--- a/priv/templates/simplemod.erl
+++ /dev/null
@@ -1,6 +0,0 @@
--module({{modid}}).
-
--export([my_func/0]).
-
-my_func() ->
- ok.
diff --git a/priv/templates/simplemod.template b/priv/templates/simplemod.template
deleted file mode 100644
index 04d61f3..0000000
--- a/priv/templates/simplemod.template
+++ /dev/null
@@ -1,3 +0,0 @@
-{variables, [{modid, "mymod"}]}.
-{template, "simplemod.erl", "src/{{modid}}.erl"}.
-{template, "simplemod_tests.erl", "test/{{modid}}_tests.erl"}.
diff --git a/priv/templates/simplemod_tests.erl b/priv/templates/simplemod_tests.erl
deleted file mode 100644
index c5ca0bb..0000000
--- a/priv/templates/simplemod_tests.erl
+++ /dev/null
@@ -1,3 +0,0 @@
--module({{modid}}_tests).
--include_lib("eunit/include/eunit.hrl").
-
diff --git a/priv/templates/simplenode.erl.script b/priv/templates/simplenode.erl.script
deleted file mode 100644
index f4c63af..0000000
--- a/priv/templates/simplenode.erl.script
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/sh
-
-# /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is.
-if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
- POSIX_SHELL="true"
- export POSIX_SHELL
- exec /usr/bin/ksh $0 "$@"
-fi
-
-# clear it so if we invoke other scripts, they run as ksh as well
-unset POSIX_SHELL
-
-## This script replaces the default "erl" in erts-VSN/bin. This is
-## necessary as escript depends on erl and in turn, erl depends on
-## having access to a bootscript (start.boot). Note that this script
-## is ONLY invoked as a side-effect of running escript -- the embedded
-## node bypasses erl and uses erlexec directly (as it should).
-##
-## Note that this script makes the assumption that there is a
-## start_clean.boot file available in $ROOTDIR/release/VSN.
-
-# Determine the abspath of where this script is executing from.
-ERTS_BIN_DIR=$(cd ${0%/*} && pwd -P)
-
-# Now determine the root directory -- this script runs from erts-VSN/bin,
-# so we simply need to strip off two dirs from the end of the ERTS_BIN_DIR
-# path.
-ROOTDIR=${ERTS_BIN_DIR%/*/*}
-
-# Parse out release and erts info
-START_ERL=`cat $ROOTDIR/releases/start_erl.data`
-ERTS_VSN=${START_ERL% *}
-APP_VSN=${START_ERL#* }
-
-BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
-EMU=beam
-PROGNAME=`echo $0 | sed 's/.*\\///'`
-CMD="$BINDIR/erlexec"
-export EMU
-export ROOTDIR
-export BINDIR
-export PROGNAME
-
-exec $CMD -boot $ROOTDIR/releases/$APP_VSN/start_clean ${1+"$@"}
diff --git a/priv/templates/simplenode.install_upgrade.escript b/priv/templates/simplenode.install_upgrade.escript
deleted file mode 100755
index 0d4cbe3..0000000
--- a/priv/templates/simplenode.install_upgrade.escript
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env escript
-%%! -noshell -noinput
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ft=erlang ts=4 sw=4 et
-
--define(TIMEOUT, 60000).
--define(INFO(Fmt,Args), io:format(Fmt,Args)).
-
-%% TODO: This script currently does NOT support slim releases.
-%% Necessary steps to upgrade a slim release are as follows:
-%% 1. unpack relup archive manually
-%% 2. copy releases directory and necessary libraries
-%% 3. using release_hander:set_unpacked/2 .
-%% For more details, see https://github.com/rebar/rebar/pull/52
-%% and https://github.com/rebar/rebar/issues/202
-
-main([NodeName, Cookie, ReleasePackage]) ->
- TargetNode = start_distribution(NodeName, Cookie),
- {ok, Vsn} = rpc:call(TargetNode, release_handler, unpack_release,
- [ReleasePackage], ?TIMEOUT),
- ?INFO("Unpacked Release ~p~n", [Vsn]),
- {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
- check_install_release, [Vsn], ?TIMEOUT),
- {ok, OtherVsn, Desc} = rpc:call(TargetNode, release_handler,
- install_release, [Vsn], ?TIMEOUT),
- ?INFO("Installed Release ~p~n", [Vsn]),
- ok = rpc:call(TargetNode, release_handler, make_permanent, [Vsn], ?TIMEOUT),
- ?INFO("Made Release ~p Permanent~n", [Vsn]);
-main(_) ->
- init:stop(1).
-
-start_distribution(NodeName, Cookie) ->
- MyNode = make_script_node(NodeName),
- {ok, _Pid} = net_kernel:start([MyNode, shortnames]),
- erlang:set_cookie(node(), list_to_atom(Cookie)),
- TargetNode = make_target_node(NodeName),
- case {net_kernel:hidden_connect_node(TargetNode),
- net_adm:ping(TargetNode)} of
- {true, pong} ->
- ok;
- {_, pang} ->
- io:format("Node ~p not responding to pings.\n", [TargetNode]),
- init:stop(1)
- end,
- TargetNode.
-
-make_target_node(Node) ->
- [_, Host] = string:tokens(atom_to_list(node()), "@"),
- list_to_atom(lists:concat([Node, "@", Host])).
-
-make_script_node(Node) ->
- list_to_atom(lists:concat([Node, "_upgrader_", os:getpid()])).
diff --git a/priv/templates/simplenode.nodetool b/priv/templates/simplenode.nodetool
deleted file mode 100755
index ce06c6a..0000000
--- a/priv/templates/simplenode.nodetool
+++ /dev/null
@@ -1,182 +0,0 @@
-#!/usr/bin/env escript
-%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
-%% ex: ft=erlang ts=4 sw=4 et
-%% -------------------------------------------------------------------
-%%
-%% nodetool: Helper Script for interacting with live nodes
-%%
-%% -------------------------------------------------------------------
-main(Args) ->
- ok = start_epmd(),
- %% Extract the args
- {RestArgs, TargetNode} = process_args(Args, [], undefined),
-
- %% any commands that don't need a running node
- case RestArgs of
- ["chkconfig", File] ->
- case file:consult(File) of
- {ok, _} ->
- io:format("ok\n"),
- halt(0);
- {error, {Line, Mod, Term}} ->
- io:format(standard_error, ["Error on line ",
- file:format_error({Line, Mod, Term}), "\n"], []),
- halt(1);
- {error, R} ->
- io:format(standard_error, ["Error reading config file: ",
- file:format_error(R), "\n"], []),
- halt(1)
- end;
- _ ->
- ok
- end,
-
- %% See if the node is currently running -- if it's not, we'll bail
- case {net_kernel:hidden_connect_node(TargetNode),
- net_adm:ping(TargetNode)} of
- {true, pong} ->
- ok;
- {false,pong} ->
- io:format("Failed to connect to node ~p .\n", [TargetNode]),
- halt(1);
- {_, pang} ->
- io:format("Node ~p not responding to pings.\n", [TargetNode]),
- halt(1)
- end,
-
- case RestArgs of
- ["getpid"] ->
- io:format("~p\n",
- [list_to_integer(rpc:call(TargetNode, os, getpid, []))]);
- ["ping"] ->
- %% If we got this far, the node already responsed to a
- %% ping, so just dump a "pong"
- io:format("pong\n");
- ["stop"] ->
- io:format("~p\n", [rpc:call(TargetNode, init, stop, [], 60000)]);
- ["restart"] ->
- io:format("~p\n", [rpc:call(TargetNode, init, restart, [], 60000)]);
- ["reboot"] ->
- io:format("~p\n", [rpc:call(TargetNode, init, reboot, [], 60000)]);
- ["rpc", Module, Function | RpcArgs] ->
- case rpc:call(TargetNode,
- list_to_atom(Module),
- list_to_atom(Function),
- [RpcArgs], 60000) of
- ok ->
- ok;
- {badrpc, Reason} ->
- io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]),
- halt(1);
- _ ->
- halt(1)
- end;
- ["rpc_infinity", Module, Function | RpcArgs] ->
- case rpc:call(TargetNode,
- list_to_atom(Module),
- list_to_atom(Function),
- [RpcArgs], infinity) of
- ok ->
- ok;
- {badrpc, Reason} ->
- io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]),
- halt(1);
- _ ->
- halt(1)
- end;
- ["rpcterms", Module, Function, ArgsAsString] ->
- case rpc:call(TargetNode,
- list_to_atom(Module),
- list_to_atom(Function),
- consult(ArgsAsString), 60000) of
- {badrpc, Reason} ->
- io:format("RPC to ~p failed: ~p\n", [TargetNode, Reason]),
- halt(1);
- Other ->
- io:format("~p\n", [Other])
- end;
- Other ->
- io:format("Other: ~p\n", [Other]),
- io:format("Usage: nodetool {chkconfig|getpid|ping|stop|restart|reboot|rpc|rpc_infinity|rpcterms}\n")
- end,
- net_kernel:stop().
-
-process_args([], Acc, TargetNode) ->
- {lists:reverse(Acc), TargetNode};
-process_args(["-setcookie", Cookie | Rest], Acc, TargetNode) ->
- erlang:set_cookie(node(), list_to_atom(Cookie)),
- process_args(Rest, Acc, TargetNode);
-process_args(["-name", TargetName | Rest], Acc, _) ->
- ThisNode = append_node_suffix(TargetName, "_maint_"),
- {ok, _} = net_kernel:start([ThisNode, longnames]),
- process_args(Rest, Acc, nodename(TargetName));
-process_args(["-sname", TargetName | Rest], Acc, _) ->
- ThisNode = append_node_suffix(TargetName, "_maint_"),
- {ok, _} = net_kernel:start([ThisNode, shortnames]),
- process_args(Rest, Acc, nodename(TargetName));
-process_args([Arg | Rest], Acc, Opts) ->
- process_args(Rest, [Arg | Acc], Opts).
-
-
-start_epmd() ->
- [] = os:cmd(epmd_path() ++ " -daemon"),
- ok.
-
-epmd_path() ->
- ErtsBinDir = filename:dirname(escript:script_name()),
- Name = "epmd",
- case os:find_executable(Name, ErtsBinDir) of
- false ->
- case os:find_executable(Name) of
- false ->
- io:format("Could not find epmd.~n"),
- halt(1);
- GlobalEpmd ->
- GlobalEpmd
- end;
- Epmd ->
- Epmd
- end.
-
-
-nodename(Name) ->
- case string:tokens(Name, "@") of
- [_Node, _Host] ->
- list_to_atom(Name);
- [Node] ->
- [_, Host] = string:tokens(atom_to_list(node()), "@"),
- list_to_atom(lists:concat([Node, "@", Host]))
- end.
-
-append_node_suffix(Name, Suffix) ->
- case string:tokens(Name, "@") of
- [Node, Host] ->
- list_to_atom(lists:concat([Node, Suffix, os:getpid(), "@", Host]));
- [Node] ->
- list_to_atom(lists:concat([Node, Suffix, os:getpid()]))
- end.
-
-
-%%
-%% Given a string or binary, parse it into a list of terms, ala file:consult/0
-%%
-consult(Str) when is_list(Str) ->
- consult([], Str, []);
-consult(Bin) when is_binary(Bin)->
- consult([], binary_to_list(Bin), []).
-
-consult(Cont, Str, Acc) ->
- case erl_scan:tokens(Cont, Str, 0) of
- {done, Result, Remaining} ->
- case Result of
- {ok, Tokens, _} ->
- {ok, Term} = erl_parse:parse_term(Tokens),
- consult([], Remaining, [Term | Acc]);
- {eof, _Other} ->
- lists:reverse(Acc);
- {error, Info, _} ->
- {error, Info}
- end;
- {more, Cont1} ->
- consult(Cont1, eof, Acc)
- end.
diff --git a/priv/templates/simplenode.reltool.config b/priv/templates/simplenode.reltool.config
deleted file mode 100644
index eae8ab3..0000000
--- a/priv/templates/simplenode.reltool.config
+++ /dev/null
@@ -1,44 +0,0 @@
-%% -*- mode: erlang -*-
-%% ex: ft=erlang
-{sys, [
- {lib_dirs, []},
- {erts, [{mod_cond, derived}, {app_file, strip}]},
- {app_file, strip},
- {rel, "{{nodeid}}", "1",
- [
- kernel,
- stdlib,
- sasl,
- {{nodeid}}
- ]},
- {rel, "start_clean", "",
- [
- kernel,
- stdlib
- ]},
- {boot_rel, "{{nodeid}}"},
- {profile, embedded},
- {incl_cond, derived},
- {excl_archive_filters, [".*"]}, %% Do not archive built libs
- {excl_sys_filters, ["^bin/(?!start_clean.boot)",
- "^erts.*/bin/(dialyzer|typer)",
- "^erts.*/(doc|info|include|lib|man|src)"]},
- {excl_app_filters, ["\.gitignore"]},
- {app, {{nodeid}}, [{mod_cond, app}, {incl_cond, include}]}
- ]}.
-
-{target_dir, "{{nodeid}}"}.
-
-{overlay, [
- {mkdir, "log/sasl"},
- {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
- {copy, "files/nodetool", "releases/\{\{rel_vsn\}\}/nodetool"},
- {copy, "{{nodeid}}/bin/start_clean.boot",
- "\{\{erts_vsn\}\}/bin/start_clean.boot"},
- {copy, "files/{{nodeid}}", "bin/{{nodeid}}"},
- {copy, "files/{{nodeid}}.cmd", "bin/{{nodeid}}.cmd"},
- {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
- {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
- {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
- {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
- ]}.
diff --git a/priv/templates/simplenode.runner b/priv/templates/simplenode.runner
deleted file mode 100755
index 3e9e10f..0000000
--- a/priv/templates/simplenode.runner
+++ /dev/null
@@ -1,404 +0,0 @@
-#!/bin/sh
-# -*- tab-width:4;indent-tabs-mode:nil -*-
-# ex: ts=4 sw=4 et
-
-# /bin/sh on Solaris is not a POSIX compatible shell, but /usr/bin/ksh is.
-if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
- POSIX_SHELL="true"
- export POSIX_SHELL
- # To support 'whoami' add /usr/ucb to path
- PATH=/usr/ucb:$PATH
- export PATH
- exec /usr/bin/ksh $0 "$@"
-fi
-
-# clear it so if we invoke other scripts, they run as ksh
-unset POSIX_SHELL
-
-RUNNER_SCRIPT_DIR=$(cd ${0%/*} && pwd -P)
-RUNNER_SCRIPT=${0##*/}
-
-CALLER_DIR=$PWD
-
-RUNNER_BASE_DIR=${RUNNER_SCRIPT_DIR%/*}
-RUNNER_ETC_DIR=$RUNNER_BASE_DIR/etc
-# Note the trailing slash on $PIPE_DIR/
-PIPE_DIR=/tmp/$RUNNER_BASE_DIR/
-RUNNER_USER=
-WHOAMI=$(whoami)
-
-# Make sure this script is running as the appropriate user
-if ([ "$RUNNER_USER" ] && [ "x$WHOAMI" != "x$RUNNER_USER" ]); then
- type sudo > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- echo "sudo doesn't appear to be installed and your EUID isn't $RUNNER_USER" 1>&2
- exit 1
- fi
- echo "Attempting to restart script through sudo -H -u $RUNNER_USER" >&2
- exec sudo -H -u $RUNNER_USER -i $RUNNER_SCRIPT_DIR/$RUNNER_SCRIPT $@
-fi
-
-# Identify the script name
-SCRIPT=`basename $0`
-
-# Parse out release and erts info
-START_ERL=`cat $RUNNER_BASE_DIR/releases/start_erl.data`
-ERTS_VSN=${START_ERL% *}
-APP_VSN=${START_ERL#* }
-
-# Use $CWD/vm.args if exists, otherwise releases/APP_VSN/vm.args, or
-# else etc/vm.args
-if [ -e "$CALLER_DIR/vm.args" ]; then
- VMARGS_PATH=$CALLER_DIR/vm.args
- USE_DIR=$CALLER_DIR
-else
- USE_DIR=$RUNNER_BASE_DIR
- if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/vm.args" ]; then
- VMARGS_PATH="$RUNNER_BASE_DIR/releases/$APP_VSN/vm.args"
- else
- VMARGS_PATH="$RUNNER_ETC_DIR/vm.args"
- fi
-fi
-
-RUNNER_LOG_DIR=$USE_DIR/log
-# Make sure log directory exists
-mkdir -p $RUNNER_LOG_DIR
-
-# Use releases/VSN/sys.config if it exists otherwise use etc/app.config
-if [ -e "$USE_DIR/sys.config" ]; then
- CONFIG_PATH="$USE_DIR/sys.config"
-else
- if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/sys.config" ]; then
- CONFIG_PATH="$RUNNER_BASE_DIR/releases/$APP_VSN/sys.config"
- else
- CONFIG_PATH="$RUNNER_ETC_DIR/app.config"
- fi
-fi
-
-# Extract the target node name from node.args
-NAME_ARG=`egrep '^\-s?name' $VMARGS_PATH`
-if [ -z "$NAME_ARG" ]; then
- echo "vm.args needs to have either -name or -sname parameter."
- exit 1
-fi
-
-# Extract the name type and name from the NAME_ARG for REMSH
-REMSH_TYPE=`echo $NAME_ARG | awk '{print $1}'`
-REMSH_NAME=`echo $NAME_ARG | awk '{print $2}'`
-
-# Test if REMSH_NAME contains a @ and set REMSH_HOSTNAME_PART
-# and REMSH_NAME_PART according REMSH_TYPE
-MAYBE_FQDN_HOSTNAME=`hostname`
-HOSTNAME=`echo $MAYBE_FQDN_HOSTNAME | awk -F. '{print $1}'`
-
-REMSH_HOSTNAME_PART="$MAYBE_FQDN_HOSTNAME"
-case "$REMSH_NAME" in
- *@*)
- REMSH_HOSTNAME_PART=`echo $REMSH_NAME | awk -F@ '{print $2}'`
- REMSH_NAME_PART=`echo $REMSH_NAME | awk -F@ '{print $1}'`
- ;;
- *)
- REMSH_NAME_PART="$REMSH_NAME"
- if [ "$REMSH_TYPE" = "-sname" ]; then
- REMSH_HOSTNAME_PART="$HOSTNAME"
- else
- # -name type, check if `hostname` is fqdn
- if [ "$MAYBE_FQDN_HOSTNAME" = "$HOSTNAME" ]; then
- echo "Hostname must be a fqdn domain name when node is configured with long names"
- echo "and the full node name isn't configured in vm.args"
- exit 1
- fi
- fi
- ;;
-esac
-
-# Note the `date +%s`, used to allow multiple remsh to the same node
-# transparently
-REMSH_NAME_ARG="$REMSH_TYPE remsh`date +%s`@$REMSH_HOSTNAME_PART"
-REMSH_REMSH_ARG="-remsh $REMSH_NAME_PART@$REMSH_HOSTNAME_PART"
-
-# Extract the target cookie
-COOKIE_ARG=`grep '^\-setcookie' $VMARGS_PATH`
-if [ -z "$COOKIE_ARG" ]; then
- echo "vm.args needs to have a -setcookie parameter."
- exit 1
-fi
-
-# Make sure CWD is set to the right dir
-cd $USE_DIR
-
-# Make sure log directory exists
-mkdir -p $USE_DIR/log
-
-RUNNER_SCRIPT_DATA=
-if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data" ]; then
- RUNNER_SCRIPT_DATA=`cat $RUNNER_BASE_DIR/releases/$APP_VSN/runner_script.data`
-fi
-
-if [ -z "$RUNNER_SCRIPT_DATA" ]; then
- ROOTDIR=$RUNNER_BASE_DIR
- ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin
- if [ -e "$RUNNER_BASE_DIR/releases/$APP_VSN/nodetool" ]; then
- NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG"
- else
- NODETOOL="$ERTS_PATH/escript $ERTS_PATH/nodetool $NAME_ARG $COOKIE_ARG"
- fi
- SLIM_ARGS=
-elif [ "$RUNNER_SCRIPT_DATA" = "slim" ]; then
- # Setup system paths
- SYSTEM_ERL_PATH=`which erl`
- if [ ! -x "$SYSTEM_ERL_PATH" ]; then
- echo "Failed to find erl. Is Erlang/OTP available in PATH?"
- exit 1
- fi
- SYSTEM_HOME_BIN=${SYSTEM_ERL_PATH%/*}
- ROOTDIR=$SYSTEM_HOME_BIN/../lib/erlang
- ERTS_PATH=$ROOTDIR/erts-$ERTS_VSN/bin
- unset SYSTEM_ERL_PATH
- unset SYSTEM_HOME_BIN
-
- LOCAL_ERTS_PATH=$RUNNER_BASE_DIR/erts-$ERTS_VSN/bin
- NODETOOL="$ERTS_PATH/escript $RUNNER_BASE_DIR/releases/$APP_VSN/nodetool $NAME_ARG $COOKIE_ARG"
- unset LOCAL_ERL_PATH
-
- # Setup additional arguments for slim release
- SLIM_ARGS="-boot_var RELTOOL_EXT_LIB $RUNNER_BASE_DIR/lib -sasl releases_dir \"$RUNNER_BASE_DIR/releases\""
-else
- echo "Unknown runner_script.data"
- exit 1
-fi
-
-# Setup remote shell command to control node
-REMSH="$ERTS_PATH/erl -hidden $REMSH_NAME_ARG $REMSH_REMSH_ARG $COOKIE_ARG"
-
-# Common functions
-
-# Ping node without allowing nodetool to take stdin
-ping_node() {
- $NODETOOL ping < /dev/null
-}
-
-# Set the PID global variable, return 1 on error
-get_pid() {
- PID=`$NODETOOL getpid < /dev/null`
- ES=$?
- if [ "$ES" -ne 0 ]; then
- echo "Node is not running!"
- return 1
- fi
-
- # don't allow empty or init pid's
- if [ -z $PID ] || [ "$PID" -le 1 ]; then
- return 1
- fi
-
- return 0
-}
-
-# Check the first argument for instructions
-case "$1" in
- start|start_boot)
- # Make sure there is not already a node running
- RES=`ping_node`
- if [ "$RES" = "pong" ]; then
- echo "Node is already running!"
- exit 1
- fi
- case "$1" in
- start)
- shift
- START_OPTION="console"
- HEART_OPTION="start"
- ;;
- start_boot)
- shift
- START_OPTION="console_boot"
- HEART_OPTION="start_boot"
- ;;
- esac
- RUN_PARAM=$(printf "\'%s\' " "$@")
- HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT $HEART_OPTION $RUN_PARAM"
- export HEART_COMMAND
- mkdir -p $PIPE_DIR
- $ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT $START_OPTION $RUN_PARAM" 2>&1
- ;;
-
- stop)
- # Wait for the node to completely stop...
- case `uname -s` in
- Darwin)
- # Make sure we explicitly set this because iTerm.app doesn't for
- # some reason.
- COMMAND_MODE=unix2003
- esac
-
- # Get the PID from nodetool
- get_pid
- GPR=$?
- if [ "$GPR" -ne 0 ] || [ -z $PID ]; then
- exit $GPR
- fi
-
- # Tell nodetool to initiate a stop
- $NODETOOL stop
- ES=$?
- if [ "$ES" -ne 0 ]; then
- exit $ES
- fi
-
- # Wait for the node to completely stop...
- while `kill -s 0 $PID 2>/dev/null`
- do
- sleep 1
- done
- ;;
-
- restart)
- ## Restart the VM without exiting the process
- $NODETOOL restart
- ES=$?
- if [ "$ES" -ne 0 ]; then
- exit $ES
- fi
- ;;
-
- reboot)
- ## Restart the VM completely (uses heart to restart it)
- $NODETOOL reboot
- ES=$?
- if [ "$ES" -ne 0 ]; then
- exit $ES
- fi
- ;;
-
- ping)
- ## See if the VM is alive
- ping_node
- ES=$?
- if [ "$ES" -ne 0 ]; then
- exit $ES
- fi
- ;;
-
- attach)
- # Make sure a node is running
- ping_node
- ES=$?
- if [ "$ES" -ne 0 ]; then
- echo "Node is not running!"
- exit $ES
- fi
-
- shift
- exec $ERTS_PATH/to_erl $PIPE_DIR
- ;;
-
- remote_console)
- # Make sure a node is running
- ping_node
- ES=$?
- if [ "$ES" -ne 0 ]; then
- echo "Node is not running!"
- exit $ES
- fi
-
- shift
- exec $REMSH
- ;;
-
- upgrade)
- if [ -z "$2" ]; then
- echo "Missing upgrade package argument"
- echo "Usage: $SCRIPT upgrade {package base name}"
- echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
- exit 1
- fi
-
- # Make sure a node IS running
- ping_node
- ES=$?
- if [ "$ES" -ne 0 ]; then
- echo "Node is not running!"
- exit $ES
- fi
-
- node_name=`echo $NAME_ARG | awk '{print $2}'`
- erlang_cookie=`echo $COOKIE_ARG | awk '{print $2}'`
-
- $ERTS_PATH/escript $RUNNER_BASE_DIR/bin/install_upgrade.escript $node_name $erlang_cookie $2
- ;;
-
- console|console_clean|console_boot)
- # .boot file typically just $SCRIPT (ie, the app name)
- # however, for debugging, sometimes start_clean.boot is useful.
- # For e.g. 'setup', one may even want to name another boot script.
- case "$1" in
- console) BOOTFILE=$SCRIPT ;;
- console_clean) BOOTFILE=start_clean ;;
- console_boot)
- shift
- BOOTFILE="$1"
- shift
- ;;
- esac
- # Setup beam-required vars
- BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
- EMU=beam
- PROGNAME=`echo $0 | sed 's/.*\\///'`
- CMD="$BINDIR/erlexec $SLIM_ARGS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH"
- export EMU
- export ROOTDIR
- export BINDIR
- export PROGNAME
-
- # Dump environment info for logging purposes
- echo "Exec: $CMD" -- ${1+"$@"}
- echo "Root: $ROOTDIR"
-
- # Log the startup
- logger -t "$SCRIPT[$$]" "Starting up"
-
- # Start the VM
- exec $CMD -- ${1+"$@"}
- ;;
-
- foreground)
- # start up the release in the foreground for use by runit
- # or other supervision services
-
- BOOTFILE=$SCRIPT
- FOREGROUNDOPTIONS="-noinput +Bd"
-
- # Setup beam-required vars
- BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
- EMU=beam
- PROGNAME=`echo $0 | sed 's/.*\///'`
- CMD="$BINDIR/erlexec $SLIM_ARGS $FOREGROUNDOPTIONS -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -config $CONFIG_PATH -args_file $VMARGS_PATH"
- export EMU
- export ROOTDIR
- export BINDIR
- export PROGNAME
-
- # Dump environment info for logging purposes
- echo "Exec: $CMD" -- ${1+"$@"}
- echo "Root: $ROOTDIR"
-
- # Start the VM
- exec $CMD -- ${1+"$@"}
- ;;
- getpid)
- # Get the PID from nodetool
- get_pid
- ES=$?
- if [ "$ES" -ne 0 ] || [ -z $PID ]; then
- exit $ES
- fi
- echo $PID
- ;;
- *)
- echo "Usage: $SCRIPT {start|start_boot <file>|foreground|stop|restart|reboot|ping|console|getpid|console_clean|console_boot <file>|attach|remote_console|upgrade}"
- exit 1
- ;;
-esac
-
-exit 0
diff --git a/priv/templates/simplenode.sys.config b/priv/templates/simplenode.sys.config
deleted file mode 100644
index 3b7f6bd..0000000
--- a/priv/templates/simplenode.sys.config
+++ /dev/null
@@ -1,11 +0,0 @@
-[
- %% SASL config
- {sasl, [
- {sasl_error_logger, {file, "log/sasl-error.log"}},
- {errlog_type, error},
- {error_logger_mf_dir, "log/sasl"}, % Log directory
- {error_logger_mf_maxbytes, 10485760}, % 10 MB max file size
- {error_logger_mf_maxfiles, 5} % 5 files max
- ]}
-].
-
diff --git a/priv/templates/simplenode.template b/priv/templates/simplenode.template
deleted file mode 100644
index 5d2c49d..0000000
--- a/priv/templates/simplenode.template
+++ /dev/null
@@ -1,13 +0,0 @@
-{variables, [{nodeid, "mynode"}]}.
-{template, "simplenode.reltool.config", "reltool.config"}.
-{file, "simplenode.erl.script", "files/erl"}.
-{chmod, 8#744, "files/erl"}.
-{file, "simplenode.nodetool", "files/nodetool"}.
-{chmod, 8#744, "files/nodetool"}.
-{file, "simplenode.runner", "files/{{nodeid}}"}.
-{chmod, 8#744, "files/{{nodeid}}"}.
-{file, "simplenode.sys.config", "files/sys.config"}.
-{template, "simplenode.vm.args", "files/vm.args"}.
-{template, "simplenode.windows.runner.cmd", "files/{{nodeid}}.cmd"}.
-{file, "simplenode.windows.start_erl.cmd", "files/start_erl.cmd"}.
-{file, "simplenode.install_upgrade.escript", "files/install_upgrade.escript"}.
diff --git a/priv/templates/simplenode.vm.args b/priv/templates/simplenode.vm.args
deleted file mode 100644
index 700b15e..0000000
--- a/priv/templates/simplenode.vm.args
+++ /dev/null
@@ -1,19 +0,0 @@
-## Name of the node
--name {{nodeid}}@127.0.0.1
-
-## Cookie for distributed erlang
--setcookie {{nodeid}}
-
-## Heartbeat management; auto-restarts VM if it dies or becomes unresponsive
-## (Disabled by default..use with caution!)
-##-heart
-
-## Enable kernel poll and a few async threads
-##+K true
-##+A 5
-
-## Increase number of concurrent ports/sockets
-##-env ERL_MAX_PORTS 4096
-
-## Tweak GC to run more often
-##-env ERL_FULLSWEEP_AFTER 10
diff --git a/priv/templates/simplenode.windows.runner.cmd b/priv/templates/simplenode.windows.runner.cmd
deleted file mode 100644
index d45f438..0000000
--- a/priv/templates/simplenode.windows.runner.cmd
+++ /dev/null
@@ -1,103 +0,0 @@
-@setlocal
-
-@set node_name={{nodeid}}
-
-@rem Get the absolute path to the parent directory,
-@rem which is assumed to be the node root.
-@for /F "delims=" %%I in ("%~dp0..") do @set node_root=%%~fI
-
-@set releases_dir=%node_root%\releases
-
-@rem Parse ERTS version and release version from start_erl.data
-@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
- @call :set_trim erts_version %%I
- @call :set_trim release_version %%J
-)
-
-@set vm_args=%releases_dir%\%release_version%\vm.args
-@set sys_config=%releases_dir%\%release_version%\sys.config
-@set node_boot_script=%releases_dir%\%release_version%\%node_name%
-@set clean_boot_script=%releases_dir%\%release_version%\start_clean
-
-@rem extract erlang cookie from vm.args
-@for /f "usebackq tokens=1-2" %%I in (`findstr /b \-setcookie "%vm_args%"`) do @set erlang_cookie=%%J
-
-@set erts_bin=%node_root%\erts-%erts_version%\bin
-
-@set service_name=%node_name%_%release_version%
-
-@set erlsrv="%erts_bin%\erlsrv.exe"
-@set epmd="%erts_bin%\epmd.exe"
-@set escript="%erts_bin%\escript.exe"
-@set werl="%erts_bin%\werl.exe"
-@set nodetool="%erts_bin%\nodetool"
-
-@if "%1"=="usage" @goto usage
-@if "%1"=="install" @goto install
-@if "%1"=="uninstall" @goto uninstall
-@if "%1"=="start" @goto start
-@if "%1"=="stop" @goto stop
-@if "%1"=="restart" @call :stop && @goto start
-@if "%1"=="console" @goto console
-@if "%1"=="ping" @goto ping
-@if "%1"=="query" @goto query
-@if "%1"=="attach" @goto attach
-@if "%1"=="upgrade" @goto upgrade
-@echo Unknown command: "%1"
-
-:usage
-@echo Usage: %~n0 [install^|uninstall^|start^|stop^|restart^|console^|ping^|query^|attach^|upgrade]
-@goto :EOF
-
-:install
-@set description=Erlang node %node_name% in %node_root%
-@set start_erl=%node_root%\bin\start_erl.cmd
-@set args= ++ %node_name% ++ %node_root%
-@%erlsrv% add %service_name% -c "%description%" -sname %node_name% -w "%node_root%" -m "%start_erl%" -args "%args%" -stopaction "init:stop()."
-@goto :EOF
-
-:uninstall
-@%erlsrv% remove %service_name%
-@%epmd% -kill
-@goto :EOF
-
-:start
-@%erlsrv% start %service_name%
-@goto :EOF
-
-:stop
-@%erlsrv% stop %service_name%
-@goto :EOF
-
-:console
-@start "%node_name% console" %werl% -boot "%node_boot_script%" -config "%sys_config%" -args_file "%vm_args%" -sname %node_name%
-@goto :EOF
-
-:ping
-@%escript% %nodetool% ping -sname "%node_name%" -setcookie "%erlang_cookie%"
-@exit %ERRORLEVEL%
-@goto :EOF
-
-:query
-@%erlsrv% list %service_name%
-@exit %ERRORLEVEL%
-@goto :EOF
-
-:attach
-@for /f "usebackq" %%I in (`hostname`) do @set hostname=%%I
-start "%node_name% attach" %werl% -boot "%clean_boot_script%" -remsh %node_name%@%hostname% -sname console -setcookie %erlang_cookie%
-@goto :EOF
-
-:upgrade
-@if "%2"=="" (
- @echo Missing upgrade package argument
- @echo Usage: %~n0 upgrade {package base name}
- @echo NOTE {package base name} MUST NOT include the .tar.gz suffix
- @goto :EOF
-)
-@%escript% %node_root%\bin\install_upgrade.escript %node_name% %erlang_cookie% %2
-@goto :EOF
-
-:set_trim
-@set %1=%2
-@goto :EOF
diff --git a/priv/templates/simplenode.windows.start_erl.cmd b/priv/templates/simplenode.windows.start_erl.cmd
deleted file mode 100644
index c0f2072..0000000
--- a/priv/templates/simplenode.windows.start_erl.cmd
+++ /dev/null
@@ -1,40 +0,0 @@
-@setlocal
-
-@rem Parse arguments. erlsrv.exe prepends erl arguments prior to first ++.
-@rem Other args are position dependent.
-@set args="%*"
-@for /F "delims=++ tokens=1,2,3" %%I in (%args%) do @(
- @set erl_args=%%I
- @call :set_trim node_name %%J
- @rem Trim spaces from the left of %%K (node_root), which may have spaces inside
- @for /f "tokens=* delims= " %%a in ("%%K") do @set node_root=%%a
-)
-
-@set releases_dir=%node_root%\releases
-
-@rem parse ERTS version and release version from start_erl.dat
-@for /F "usebackq tokens=1,2" %%I in ("%releases_dir%\start_erl.data") do @(
- @call :set_trim erts_version %%I
- @call :set_trim release_version %%J
-)
-
-@set erl_exe="%node_root%\erts-%erts_version%\bin\erl.exe"
-@set boot_file="%releases_dir%\%release_version%\%node_name%"
-
-@if exist "%releases_dir%\%release_version%\sys.config" (
- @set app_config="%releases_dir%\%release_version%\sys.config"
-) else (
- @set app_config="%node_root%\etc\app.config"
-)
-
-@if exist "%releases_dir%\%release_version%\vm.args" (
- @set vm_args="%releases_dir%\%release_version%\vm.args"
-) else (
- @set vm_args="%node_root%\etc\vm.args"
-)
-
-@%erl_exe% %erl_args% -boot %boot_file% -config %app_config% -args_file %vm_args%
-
-:set_trim
-@set %1=%2
-@goto :EOF
diff --git a/priv/templates/simplesrv.erl b/priv/templates/simplesrv.erl
deleted file mode 100644
index af6ca50..0000000
--- a/priv/templates/simplesrv.erl
+++ /dev/null
@@ -1,50 +0,0 @@
--module({{srvid}}).
--behaviour(gen_server).
--define(SERVER, ?MODULE).
-
-%% ------------------------------------------------------------------
-%% API Function Exports
-%% ------------------------------------------------------------------
-
--export([start_link/0]).
-
-%% ------------------------------------------------------------------
-%% gen_server Function Exports
-%% ------------------------------------------------------------------
-
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
-
-%% ------------------------------------------------------------------
-%% API Function Definitions
-%% ------------------------------------------------------------------
-
-start_link() ->
- gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
-
-%% ------------------------------------------------------------------
-%% gen_server Function Definitions
-%% ------------------------------------------------------------------
-
-init(Args) ->
- {ok, Args}.
-
-handle_call(_Request, _From, State) ->
- {reply, ok, State}.
-
-handle_cast(_Msg, State) ->
- {noreply, State}.
-
-handle_info(_Info, State) ->
- {noreply, State}.
-
-terminate(_Reason, _State) ->
- ok.
-
-code_change(_OldVsn, State, _Extra) ->
- {ok, State}.
-
-%% ------------------------------------------------------------------
-%% Internal Function Definitions
-%% ------------------------------------------------------------------
-
diff --git a/priv/templates/simplesrv.template b/priv/templates/simplesrv.template
deleted file mode 100644
index 101844a..0000000
--- a/priv/templates/simplesrv.template
+++ /dev/null
@@ -1,2 +0,0 @@
-{variables, [{srvid, "myserver"}]}.
-{template, "simplesrv.erl", "src/{{srvid}}.erl"}.
diff --git a/priv/templates/simplesup.erl b/priv/templates/simplesup.erl
deleted file mode 100644
index 0e3a1de..0000000
--- a/priv/templates/simplesup.erl
+++ /dev/null
@@ -1,37 +0,0 @@
-%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
-%% @doc {{supid}} supervisor
-%% @end
-%%%-------------------------------------------------------------------
-
--module({{appid}}_{{supid}}_sup).
-
--behaviour(supervisor).
-
-%% API
--export([start_link/0]).
-
-%% Supervisor callbacks
--export([init/1]).
-
--define(SERVER, ?MODULE).
-
-%%====================================================================
-%% API functions
-%%====================================================================
-
-start_link() ->
- supervisor:start_link({local, ?SERVER}, ?MODULE, []).
-
-%%====================================================================
-%% Supervisor callbacks
-%%====================================================================
-
-%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
-init([]) ->
- {ok, { {one_for_all, 0, 1}, []} }.
-
-%%====================================================================
-%% Internal functions
-%%====================================================================
diff --git a/priv/templates/simplesup.template b/priv/templates/simplesup.template
deleted file mode 100644
index f3e7fed..0000000
--- a/priv/templates/simplesup.template
+++ /dev/null
@@ -1,8 +0,0 @@
-{variables, [{appid, "myapp"}
- ,{supid, "my"}
- ,{copyright_year, "2014"}
- ,{copyright_holder, "Geoff Cant"}
- ,{author_name, "Geoff Cant"}
- ,{author_email, "nem@erlang.geek.nz"}
- ]}.
-{template, "simplesup.erl", "src/{{appid}}_{{supid}}_sup.erl"}.
diff --git a/priv/templates/simpleapp_sup.erl b/priv/templates/sup.erl
index 7c13fa1..3dd5b12 100644
--- a/priv/templates/simpleapp_sup.erl
+++ b/priv/templates/sup.erl
@@ -1,6 +1,4 @@
%%%-------------------------------------------------------------------
-%% @copyright {{copyright_holder}} ({{copyright_year}})
-%% @author {{author_name}} <{{author_email}}>
%% @doc {{appid}} top level supervisor.
%% @end
%%%-------------------------------------------------------------------
diff --git a/priv/templates/sys.config b/priv/templates/sys.config
new file mode 100644
index 0000000..e678cf7
--- /dev/null
+++ b/priv/templates/sys.config
@@ -0,0 +1,3 @@
+[
+ {'{{appid}}', []}
+].
diff --git a/priv/templates/vm.args b/priv/templates/vm.args
new file mode 100644
index 0000000..27028ac
--- /dev/null
+++ b/priv/templates/vm.args
@@ -0,0 +1,6 @@
+-name {{appid}}
+
+-setcookie {{appid}}_cookie
+
++K true
++A30