浏览代码

Merge pull request #408 from tsloughter/escriptize_template

add escriptize project template
pull/410/head
Fred Hebert 10 年前
父节点
当前提交
ba8abae225
共有 4 个文件被更改,包括 55 次插入0 次删除
  1. +11
    -0
      priv/templates/escript.template
  2. +14
    -0
      priv/templates/escript_README.md
  3. +17
    -0
      priv/templates/escript_mod.erl
  4. +13
    -0
      priv/templates/escript_rebar.config

+ 11
- 0
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"}.

+ 14
- 0
priv/templates/escript_README.md 查看文件

@ -0,0 +1,14 @@
{{name}}
=====
{{desc}}
Build
-----
$ rebar3 escriptize
Run
---
$ _build/default/bin/{{name}}

+ 17
- 0
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
%%====================================================================

+ 13
- 0
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]}
]}]}.

正在加载...
取消
保存