aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--erlang.mk12
-rw-r--r--packages.v2.tsv2
-rw-r--r--plugins/erlydtl.mk12
4 files changed, 27 insertions, 8 deletions
diff --git a/README.md b/README.md
index 9b3ecbb..583462c 100644
--- a/README.md
+++ b/README.md
@@ -367,7 +367,14 @@ ErlyDTL plugin
This plugin is available by default. It adds automatic
compilation of ErlyDTL templates found in `templates/*.dtl`
-or any subdirectory.
+or any subdirectory.
+
+By default it ignores names of subdirectories and compiles
+`a/b/templatename.dtl` into `templatename_dtl.beam`. To include
+subdirectories names in the compiled module name add
+`DTL_FULL_PATH=1` into your Makefile - `a/b/templatename.dtl`
+will be compiled into `a_b_templatename_dtl.beam`.
+
Escript plugin
--------------
diff --git a/erlang.mk b/erlang.mk
index 7816648..fa52243 100644
--- a/erlang.mk
+++ b/erlang.mk
@@ -918,6 +918,10 @@ distclean-elvis:
# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
+# Configuration.
+
+DTL_FULL_PATH ?= 0
+
# Verbosity.
dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F));
@@ -928,9 +932,11 @@ dtl_verbose = $(dtl_verbose_$(V))
define compile_erlydtl
$(dtl_verbose) erl -noshell -pa ebin/ $(DEPS_DIR)/erlydtl/ebin/ -eval ' \
Compile = fun(F) -> \
- Module = list_to_atom( \
- string:to_lower(filename:basename(F, ".dtl")) ++ "_dtl"), \
- erlydtl:compile(F, Module, [{out_dir, "ebin/"}]) \
+ S = fun (1) -> re:replace(filename:rootname(string:sub_string(F, 11), ".dtl"), "/", "_", [{return, list}, global]); \
+ (0) -> filename:basename(F, ".dtl") \
+ end, \
+ Module = list_to_atom(string:to_lower(S($(DTL_FULL_PATH))) ++ "_dtl"), \
+ {ok, _} = erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) \
end, \
_ = [Compile(F) || F <- string:tokens("$(1)", " ")], \
init:stop()'
diff --git a/packages.v2.tsv b/packages.v2.tsv
index 9cbb697..d405aac 100644
--- a/packages.v2.tsv
+++ b/packages.v2.tsv
@@ -50,7 +50,7 @@ ranch git https://github.com/ninenines/ranch 1.1.0 http://ninenines.eu Socket ac
resource_discovery git https://github.com/erlware/resource_discovery master http://erlware.org/ An application used to dynamically discover resources present in an Erlang node cluster.
sfmt-erlang git https://github.com/jj1bdx/sfmt-erlang master https://github.com/jj1bdx/sfmt-erlang SFMT pseudo random number generator for Erlang.
sheriff git https://github.com/extend/sheriff master http://ninenines.eu Parse transform for type based validation.
-shotgun git https://github.com/inaka/shotgun.git 0.1 https://github.com/inaka/shotgun.git better than just a gun
+shotgun git https://github.com/inaka/shotgun.git 0.1.0 https://github.com/inaka/shotgun.git better than just a gun
sumo_db git https://github.com/inaka/sumo_db.git 1 https://github.com/inaka/sumo_db.git Erlang Persistency Framework
swab git https://github.com/crownedgrouse/swab.git master https://github.com/crownedgrouse/swab General purpose buffer handling module
sync git https://github.com/rustyio/sync.git master https://github.com/rustyio/sync On-the-fly recompiling and reloading in Erlang.
diff --git a/plugins/erlydtl.mk b/plugins/erlydtl.mk
index e288072..8d8795f 100644
--- a/plugins/erlydtl.mk
+++ b/plugins/erlydtl.mk
@@ -1,6 +1,10 @@
# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]>
# This file is part of erlang.mk and subject to the terms of the ISC License.
+# Configuration.
+
+DTL_FULL_PATH ?= 0
+
# Verbosity.
dtl_verbose_0 = @echo " DTL " $(filter %.dtl,$(?F));
@@ -11,9 +15,11 @@ dtl_verbose = $(dtl_verbose_$(V))
define compile_erlydtl
$(dtl_verbose) erl -noshell -pa ebin/ $(DEPS_DIR)/erlydtl/ebin/ -eval ' \
Compile = fun(F) -> \
- Module = list_to_atom( \
- string:to_lower(filename:basename(F, ".dtl")) ++ "_dtl"), \
- erlydtl:compile(F, Module, [{out_dir, "ebin/"}]) \
+ S = fun (1) -> re:replace(filename:rootname(string:sub_string(F, 11), ".dtl"), "/", "_", [{return, list}, global]); \
+ (0) -> filename:basename(F, ".dtl") \
+ end, \
+ Module = list_to_atom(string:to_lower(S($(DTL_FULL_PATH))) ++ "_dtl"), \
+ {ok, _} = erlydtl:compile(F, Module, [{out_dir, "ebin/"}, return_errors, {doc_root, "templates"}]) \
end, \
_ = [Compile(F) || F <- string:tokens("$(1)", " ")], \
init:stop()'