|
@@ -1,6 +1,6 @@
|
|
|
# ErlyDTL plugin.
|
|
|
|
|
|
-ERLYDTL_CASES = compile full-path opts
|
|
|
+ERLYDTL_CASES = compile full-path opts path-full-path-suffix suffix
|
|
|
ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES))
|
|
|
|
|
|
.PHONY: erlydtl $(ERLYDTL_TARGETS)
|
|
@@ -99,3 +99,53 @@ erlydtl-opts: build clean
|
|
|
{ok, Result} = $(APP)_foo_dtl:render([{foo, <<\"<&>\">>}]), \
|
|
|
<<\"<&>\", _/binary>> = iolist_to_binary(Result), \
|
|
|
halt()"
|
|
|
+
|
|
|
+erlydtl-path-full-path-suffix: build clean
|
|
|
+
|
|
|
+ $i "Bootstrap a new OTP library named $(APP)"
|
|
|
+ $t mkdir $(APP)/
|
|
|
+ $t cp ../erlang.mk $(APP)/
|
|
|
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
|
|
|
+
|
|
|
+ $i "Generate ErlyDTL templates"
|
|
|
+ $t mkdir -p $(APP)/dtl/two/
|
|
|
+ $t touch $(APP)/dtl/one.dtl
|
|
|
+ $t touch $(APP)/dtl/two/three.dtl
|
|
|
+
|
|
|
+ $i "Build the application"
|
|
|
+ $t $(MAKE) -C $(APP) DEPS=erlydtl DTL_PATH=dtl DTL_FULL_PATH=1 DTL_SUFFIX=_suffix $v
|
|
|
+
|
|
|
+ $i "Check that ErlyDTL templates are compiled"
|
|
|
+ $t test -f $(APP)/ebin/one_suffix.beam
|
|
|
+ $t test -f $(APP)/ebin/two_three_suffix.beam
|
|
|
+
|
|
|
+ $i "Check that ErlyDTL generated modules are included in .app file"
|
|
|
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
|
|
|
+ ok = application:load($(APP)), \
|
|
|
+ {ok, [one_suffix, two_three_suffix]} = application:get_key($(APP), modules), \
|
|
|
+ halt()"
|
|
|
+
|
|
|
+erlydtl-suffix: build clean
|
|
|
+
|
|
|
+ $i "Bootstrap a new OTP library named $(APP)"
|
|
|
+ $t mkdir $(APP)/
|
|
|
+ $t cp ../erlang.mk $(APP)/
|
|
|
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
|
|
|
+
|
|
|
+ $i "Generate ErlyDTL templates"
|
|
|
+ $t mkdir $(APP)/templates/
|
|
|
+ $t touch $(APP)/templates/one.dtl
|
|
|
+ $t touch $(APP)/templates/two.dtl
|
|
|
+
|
|
|
+ $i "Build the application"
|
|
|
+ $t $(MAKE) -C $(APP) DEPS=erlydtl DTL_SUFFIX= $v
|
|
|
+
|
|
|
+ $i "Check that ErlyDTL templates are compiled"
|
|
|
+ $t test -f $(APP)/ebin/one.beam
|
|
|
+ $t test -f $(APP)/ebin/two.beam
|
|
|
+
|
|
|
+ $i "Check that ErlyDTL generated modules are included in .app file"
|
|
|
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
|
|
|
+ ok = application:load($(APP)), \
|
|
|
+ {ok, [one, two]} = application:get_key($(APP), modules), \
|
|
|
+ halt()"
|