plugin_erlydtl.mk 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # ErlyDTL plugin
  2. ERLYDTL_CASES = test
  3. ERLYDTL_TARGETS = $(addprefix erlydtl-,$(ERLYDTL_CASES))
  4. ERLYDTL_CLEAN_TARGETS = $(addprefix clean-,$(ERLYDTL_TARGETS))
  5. .PHONY: erlydtl clean-erlydtl
  6. clean-erlydtl: $(ERLYDTL_CLEAN_TARGETS)
  7. $(ERLYDTL_CLEAN_TARGETS):
  8. $t rm -rf $(APP_TO_CLEAN)/
  9. erlydtl: $(ERLYDTL_TARGETS)
  10. erlydtl-test: build clean-erlydtl-test
  11. $i "Bootstrap a new OTP application named $(APP)"
  12. $t mkdir $(APP)/
  13. $t cp ../erlang.mk $(APP)/
  14. $t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
  15. $t mkdir $(APP)/templates
  16. $t touch $(APP)/templates/$(APP)_template.dtl
  17. $t touch $(APP)/templates/$(APP)_template2.dtl
  18. $t echo "PROJECT = $(APP)" > $(APP)/Makefile
  19. $t echo "DEPS = erlydtl" >> $(APP)/Makefile
  20. $t echo "include erlang.mk" >> $(APP)/Makefile
  21. $i "Build the application"
  22. $t $(MAKE) -C $(APP) $v
  23. $i "Check that ErlyDTL templates are compiled"
  24. $t test -f $(APP)/ebin/$(APP)_template_dtl.beam
  25. $t test -f $(APP)/ebin/$(APP)_template2_dtl.beam
  26. $i "Check that ErlyDTL generated modules are included in .app file"
  27. $t $(ERL) -pa $(APP)/ebin/ -eval " \
  28. ok = application:load($(APP)), \
  29. {ok, Modules} = application:get_key($(APP), modules), \
  30. true = lists:member($(APP)_template_dtl, Modules), \
  31. true = lists:member($(APP)_template2_dtl, Modules), \
  32. halt()"