diff options
-rwxr-xr-x | bootstrap | 3 | ||||
-rw-r--r-- | priv/shell-completion/bash/rebar | 1 | ||||
-rw-r--r-- | priv/shell-completion/zsh/_rebar | 1 | ||||
-rw-r--r-- | priv/templates/simplelib.app.src | 14 | ||||
-rw-r--r-- | priv/templates/simplelib.erl | 18 | ||||
-rw-r--r-- | priv/templates/simplelib.template | 3 | ||||
-rw-r--r-- | rebar.config.script | 5 | ||||
-rw-r--r-- | src/rebar.erl | 2 | ||||
-rw-r--r-- | src/rebar_dia_compiler.erl | 4 | ||||
-rw-r--r-- | src/rebar_templater.erl | 11 |
10 files changed, 55 insertions, 7 deletions
@@ -56,7 +56,8 @@ main(Args) -> %% Run rebar compile to do proper .app validation etc. %% and rebar escriptize to create the rebar script - rebar:main(["compile", "escriptize"] ++ Args), + RebarArgs = Args -- ["debug"], %% Avoid trying to run 'debug' command + rebar:main(["compile", "escriptize"] ++ RebarArgs), %% Finally, update executable perms for our script on *nix, %% or write out script files on win32. diff --git a/priv/shell-completion/bash/rebar b/priv/shell-completion/bash/rebar index d4a42dc..7dc3b5e 100644 --- a/priv/shell-completion/bash/rebar +++ b/priv/shell-completion/bash/rebar @@ -21,6 +21,7 @@ _rebar() compile \ create \ create-app \ + create-lib \ create-node \ ct \ doc \ diff --git a/priv/shell-completion/zsh/_rebar b/priv/shell-completion/zsh/_rebar index 21d9a8a..384fead 100644 --- a/priv/shell-completion/zsh/_rebar +++ b/priv/shell-completion/zsh/_rebar @@ -31,6 +31,7 @@ _rebar () { 'compile[Compile sources]' \ 'create[Create skel based on template and vars]' \ 'create-app[Create simple app skel]' \ + 'create-lib[Create simple lib skel]' \ 'create-node[Create simple node skel]' \ 'list-template[List avaiavle templates]' \ 'doc[Generate Erlang program documentation]' \ diff --git a/priv/templates/simplelib.app.src b/priv/templates/simplelib.app.src new file mode 100644 index 0000000..752665a --- /dev/null +++ b/priv/templates/simplelib.app.src @@ -0,0 +1,14 @@ +{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 new file mode 100644 index 0000000..2c4451f --- /dev/null +++ b/priv/templates/simplelib.erl @@ -0,0 +1,18 @@ +-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 new file mode 100644 index 0000000..59d20fa --- /dev/null +++ b/priv/templates/simplelib.template @@ -0,0 +1,3 @@ +{variables, [{libid, "mylib"}]}. +{template, "simplelib.app.src", "src/{{libid}}.app.src"}. +{template, "simplelib.erl", "src/{{libid}}.erl"}. diff --git a/rebar.config.script b/rebar.config.script index be61b5e..6735645 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -1,10 +1,7 @@ %% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- %% ex: ts=4 sw=4 ft=erlang et -%% TODO: Change temporary retest fork back to dizzyd/retest after merge -%% ExtraDeps = [{retest, ".*", {git, "git://github.com/dizzyd/retest.git"}}], -ExtraDeps = [{retest, ".*", - {git, "git://github.com/dizzyd/retest.git"}}], +ExtraDeps = [{retest, ".*", {git, "git://github.com/dizzyd/retest.git"}}], case os:getenv("REBAR_EXTRA_DEPS") of false -> diff --git a/src/rebar.erl b/src/rebar.erl index 8fad12f..00505be 100644 --- a/src/rebar.erl +++ b/src/rebar.erl @@ -338,6 +338,7 @@ escriptize Generate escript archive create template= [var=foo,...] Create skel based on template and vars create-app [appid=myapp] Create simple app skel +create-lib [libid=mylib] Create simple lib skel create-node [nodeid=mynode] Create simple node skel list-templates List available templates @@ -437,6 +438,7 @@ command_names() -> "compile", "create", "create-app", + "create-lib", "create-node", "ct", "delete-deps", diff --git a/src/rebar_dia_compiler.erl b/src/rebar_dia_compiler.erl index f81c734..ba9d159 100644 --- a/src/rebar_dia_compiler.erl +++ b/src/rebar_dia_compiler.erl @@ -75,8 +75,8 @@ compile_dia(Source, Target, Config) -> case diameter_dict_util:parse({path, Source}, []) of {ok, Spec} -> FileName = dia_filename(Source, Spec), - diameter_codegen:from_dict(FileName, Spec, Opts, erl), - diameter_codegen:from_dict(FileName, Spec, Opts, hrl), + _ = diameter_codegen:from_dict(FileName, Spec, Opts, erl), + _ = diameter_codegen:from_dict(FileName, Spec, Opts, hrl), HrlFile = filename:join("src", FileName ++ ".hrl"), case filelib:is_regular(HrlFile) of true -> diff --git a/src/rebar_templater.erl b/src/rebar_templater.erl index b8f7087..c21daa3 100644 --- a/src/rebar_templater.erl +++ b/src/rebar_templater.erl @@ -27,6 +27,7 @@ -module(rebar_templater). -export(['create-app'/2, + 'create-lib'/2, 'create-node'/2, 'list-templates'/2, create/2]). @@ -50,6 +51,10 @@ %% Alias for create w/ template=simpleapp create1(Config, "simpleapp"). +'create-lib'(Config, _File) -> + %% Alias for create w/ template=simplelib + create1(Config, "simplelib"). + 'create-node'(Config, _File) -> %% Alias for create w/ template=simplenode create1(Config, "simplenode"). @@ -116,6 +121,12 @@ info(help, 'create-app') -> "~n" "Valid command line options:~n" " [appid=myapp]~n", []); +info(help, 'create-lib') -> + ?CONSOLE( + "Create simple lib skel.~n" + "~n" + "Valid command line options:~n" + " [libid=mylib]~n", []); info(help, 'create-node') -> ?CONSOLE( "Create simple node skel.~n" |