Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve templates #1013

Closed
wants to merge 1 commit into from
Closed

Improve templates #1013

wants to merge 1 commit into from

Conversation

essen
Copy link
Member

@essen essen commented Nov 21, 2024

Move templates outside the source .mk files
Templates now no longer use Make variables for substitution
but instead replace strings with their equivalent:

template_name: Corresponds to n=template_name
project_name:  Corresponds to $(PROJECT) or in=project_name

This allows defining templates outside of Makefiles. For
example an external plugin could define their templates
in templates/my_template.erl and then have the following
in the included Makefile:

tpl_my_template = $(file < $(DEPS_DIR)/my_plugin/templates/my_template.erl)

By default the created file will be in src/template_name.erl.
This can be overriden with the tplp_* variable:

tplp_my_template = src/model/my_template.erl

Substitution is applied both to the template contents and
to its path.

My version of #983

@essen essen force-pushed the templates branch 3 times, most recently from e12229c to ff3171b Compare November 22, 2024 13:18
@essen essen marked this pull request as ready for review November 22, 2024 13:20
Templates now no longer use Make variables for substitution
but instead replace strings with their equivalent:

  template_name: Corresponds to n=template_name
  project_name:  Corresponds to $(PROJECT) or in=project_name

This allows defining templates outside of Makefiles. For
example an external plugin could define their templates
in templates/my_template.erl and then have the following
in the included Makefile:

  tpl_my_template = $(file < $(THIS)/templates/my_template.erl)

By default the created file will be in src/template_name.erl.
This can be overriden with the tplp_* variable:

  tplp_my_template = src/model/my_template.erl

Substitution is applied both to the template contents and
to its path.

In addition, attempting to overwrite an existing file when
creating a template will result in failure.
@essen
Copy link
Member Author

essen commented Nov 22, 2024

Merged!!

@essen essen closed this Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant