summaryrefslogtreecommitdiff
path: root/priv/templates
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-05-09 13:23:59 -0500
committerTristan Sloughter <t@crashfast.com>2015-05-09 13:23:59 -0500
commit6c72286bf9a60e9c2945a9a416762b175f5fe160 (patch)
treeac5d52fe1ed6330001bcdf12b1a3bac6a3119f10 /priv/templates
parentb904c5b57a4dbe393009da0bc6720c2a78a310e1 (diff)
add escriptize project template
Diffstat (limited to 'priv/templates')
-rw-r--r--priv/templates/escript.template11
-rw-r--r--priv/templates/escript_README.md14
-rw-r--r--priv/templates/escript_mod.erl17
-rw-r--r--priv/templates/escript_rebar.config13
4 files changed, 55 insertions, 0 deletions
diff --git a/priv/templates/escript.template b/priv/templates/escript.template
new file mode 100644
index 0000000..c0afd3c
--- /dev/null
+++ b/priv/templates/escript.template
@@ -0,0 +1,11 @@
+{description, "Escriptized application"}.
+{variables, [
+ {name, "mylib", "Name of the OTP application to be escriptized"},
+ {desc, "An escript", "Short description of the project"}
+]}.
+{template, "escript_mod.erl", "{{name}}/src/{{name}}.erl"}.
+{template, "otp_lib.app.src", "{{name}}/src/{{name}}.app.src"}.
+{template, "escript_rebar.config", "{{name}}/rebar.config"}.
+{template, "gitignore", "{{name}}/.gitignore"}.
+{template, "LICENSE", "{{name}}/LICENSE"}.
+{template, "escript_README.md", "{{name}}/README.md"}.
diff --git a/priv/templates/escript_README.md b/priv/templates/escript_README.md
new file mode 100644
index 0000000..577d679
--- /dev/null
+++ b/priv/templates/escript_README.md
@@ -0,0 +1,14 @@
+{{name}}
+=====
+
+{{desc}}
+
+Build
+-----
+
+ $ rebar3 escriptize
+
+Run
+---
+
+ $ _build/default/bin/{{name}}
diff --git a/priv/templates/escript_mod.erl b/priv/templates/escript_mod.erl
new file mode 100644
index 0000000..f8a779b
--- /dev/null
+++ b/priv/templates/escript_mod.erl
@@ -0,0 +1,17 @@
+-module({{name}}).
+
+%% API exports
+-export([main/1]).
+
+%%====================================================================
+%% API functions
+%%====================================================================
+
+%% escript Entry point
+main(Args) ->
+ io:format("Args: ~p~n", [Args]),
+ erlang:halt(0).
+
+%%====================================================================
+%% Internal functions
+%%====================================================================
diff --git a/priv/templates/escript_rebar.config b/priv/templates/escript_rebar.config
new file mode 100644
index 0000000..196f835
--- /dev/null
+++ b/priv/templates/escript_rebar.config
@@ -0,0 +1,13 @@
+{erl_opts, [no_debug_info]}.
+{deps, []}.
+
+{escript_incl_apps,
+ [{{name}}]}.
+{escript_top_level_app, {{name}}}.
+{escript_name, {{name}}}.
+{escript_emu_args, "%%! +sbtu +A0\n"}.
+
+%% Profiles
+{profiles, [{test,
+ [{erl_opts, [debug_info]}
+ ]}]}.