Skip to content

Commit

Permalink
Bump bbmustache and fix templates (#1862)
Browse files Browse the repository at this point in the history
* bump bbmustache to version 1.6.0

* Use alternative bbmustache brackets in templates

This fixes the problems where literal nested tuples (`{{a,b},c}` or
`{{a,b}}`) would blow up and spaces needed to be inserted.
  • Loading branch information
ferd authored and tsloughter committed Oct 5, 2018
1 parent dec4846 commit d538be3
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 18 deletions.
7 changes: 4 additions & 3 deletions priv/templates/otp_app.app.src
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{application, {{name}},
[{description, "{{desc}}"},
{{=@@ @@=}}
{application, @@name@@,
[{description, "@@desc@@"},
{vsn, "0.1.0"},
{registered, []},
{mod, { {{name}}_app, []}},
{mod, {@@name@@_app, []}},
{applications,
[kernel,
stdlib
Expand Down
13 changes: 7 additions & 6 deletions priv/templates/plugin_README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{name}}
{{=@@ @@=}}
@@name@@
=====

{{desc}}
@@desc@@

Build
-----
Expand All @@ -14,13 +15,13 @@ Use
Add the plugin to your rebar config:

{plugins, [
{ {{name}}, ".*", {git, "git@host:user/{{name}}.git", {tag, "0.1.0"}}}
{@@name@@, {git, "https://host/user/@@name@@.git", {tag, "0.1.0"}}}
]}.

Then just call your plugin directly in an existing application:


$ rebar3 {{name}}
===> Fetching {{name}}
===> Compiling {{name}}
$ rebar3 @@name@@
===> Fetching @@name@@
===> Compiling @@name@@
<Plugin Output>
5 changes: 3 additions & 2 deletions priv/templates/relx_rebar.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{=@@ @@=}}
{erl_opts, [debug_info]}.
{deps, []}.

{relx, [{release, { {{name}}, "0.1.0" },
[{{name}},
{relx, [{release, {@@name@@, "0.1.0"},
[@@name@@,
sasl]},

{sys_config, "./config/sys.config"},
Expand Down
7 changes: 4 additions & 3 deletions priv/templates/sup.erl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{=@@ @@=}}
%%%-------------------------------------------------------------------
%% @doc {{name}} top level supervisor.
%% @doc @@name@@ top level supervisor.
%% @end
%%%-------------------------------------------------------------------

-module({{name}}_sup).
-module(@@name@@_sup).

-behaviour(supervisor).

Expand Down Expand Up @@ -31,7 +32,7 @@ start_link() ->
%% Before OTP 18 tuples must be used to specify a child. e.g.
%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
{ok, { {one_for_all, 0, 1}, []} }.
{ok, {{one_for_all, 0, 1}, []}}.

%%====================================================================
%% Internal functions
Expand Down
3 changes: 2 additions & 1 deletion priv/templates/sys.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{=@@ @@=}}
[
{ {{name}}, []}
{@@name@@, []}
].
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{parse_trans, "3.3.0"}, % force otp-21 compat
{providers, "1.7.0"},
{getopt, "1.0.1"},
{bbmustache, "1.5.0"},
{bbmustache, "1.6.0"},
{relx, "3.27.0"},
{cf, "0.2.2"},
{cth_readable, "1.4.2"},
Expand Down
4 changes: 2 additions & 2 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"1.1.0",
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.5.0">>},0},
[{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.6.0">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.3.1">>},0},
{<<"cf">>,{pkg,<<"cf">>,<<"0.2.2">>},0},
{<<"cth_readable">>,{pkg,<<"cth_readable">>,<<"1.4.2">>},0},
Expand All @@ -13,7 +13,7 @@
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.3">>},0}]}.
[
{pkg_hash,[
{<<"bbmustache">>, <<"8CFDE0602E90A4057E161BF5288ADE854B4E511E2E8924966A8438730E958381">>},
{<<"bbmustache">>, <<"7AC372AEC621A69C369DF237FBD9986CAABCDD6341089FE5F42E5A7A4AC706B8">>},
{<<"certifi">>, <<"D0F424232390BF47D82DA8478022301C561CF6445B5B5FB6A84D49A9E76D2639">>},
{<<"cf">>, <<"7F2913FFF90ABCABD0F489896CFEB0B0674F6C8DF6C10B17A83175448029896C">>},
{<<"cth_readable">>, <<"0F57B4EB7DA7F5438F422312245F9143A1B3118C11B6BAE5C3D1391C9EE88322">>},
Expand Down

0 comments on commit d538be3

Please sign in to comment.