From cdd5f2f0207205598c3d29c8ed2d5ff0c46444de Mon Sep 17 00:00:00 2001 From: amc-corey-cox <69321580+amc-corey-cox@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:41:15 -0500 Subject: [PATCH 1/2] Remove quoting in makefile variables, improve docs files/templates --- {{cookiecutter.project_name}}/.env.public | 15 +++++++++------ {{cookiecutter.project_name}}/Makefile | 14 ++++++++------ .../src/docs/{ => files}/about.md | 0 .../src/docs/templates/README.md | 3 +++ 4 files changed, 20 insertions(+), 12 deletions(-) rename {{cookiecutter.project_name}}/src/docs/{ => files}/about.md (100%) create mode 100644 {{cookiecutter.project_name}}/src/docs/templates/README.md diff --git a/{{cookiecutter.project_name}}/.env.public b/{{cookiecutter.project_name}}/.env.public index 17c26cc..fab402e 100644 --- a/{{cookiecutter.project_name}}/.env.public +++ b/{{cookiecutter.project_name}}/.env.public @@ -1,13 +1,16 @@ # This file is public in git. No sensitive info allowed. +# These variables are sourced in Makefile, following make-file conventions. +# Be aware that this file does not follow python or bash conventions, so may appear a little unfamiliar. ###### schema definition variables, used by makefile -LINKML_SCHEMA_NAME="{{cookiecutter.__project_slug}}" -LINKML_SCHEMA_AUTHOR="{{cookiecutter.__author}}" -LINKML_SCHEMA_DESCRIPTION="{{cookiecutter.project_description}}" -LINKML_SCHEMA_SOURCE_PATH="{{cookiecutter.__source_path}}" -LINKML_SCHEMA_GOOGLE_SHEET_ID="{{cookiecutter.google_sheet_id}}" -LINKML_SCHEMA_GOOGLE_SHEET_TABS="{{cookiecutter.google_sheet_tabs}}" +# Note: makefile variables should not be quoted, as makefile handles quoting differently than bash +LINKML_SCHEMA_NAME={{cookiecutter.__project_slug}} +LINKML_SCHEMA_AUTHOR={{cookiecutter.__author}} +LINKML_SCHEMA_DESCRIPTION={{cookiecutter.project_description}} +LINKML_SCHEMA_SOURCE_PATH={{cookiecutter.__source_path}} +LINKML_SCHEMA_GOOGLE_SHEET_ID={{cookiecutter.google_sheet_id}} +LINKML_SCHEMA_GOOGLE_SHEET_TABS={{cookiecutter.google_sheet_tabs}} ###### linkml generator variables, used by makefile diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile index 3ae3205..4ad0d18 100644 --- a/{{cookiecutter.project_name}}/Makefile +++ b/{{cookiecutter.project_name}}/Makefile @@ -22,35 +22,37 @@ SRC = src DEST = project PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel DOCDIR = docs +DOCTEMPLATES = $(SRC)/docs/templates EXAMPLEDIR = examples SHEET_MODULE = {{cookiecutter.__google_sheet_module}} SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID) SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS) SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml +# Use += to append variables from the variables file CONFIG_YAML = ifdef LINKML_GENERATORS_CONFIG_YAML -CONFIG_YAML = ${LINKML_GENERATORS_CONFIG_YAML} +CONFIG_YAML += ${LINKML_GENERATORS_CONFIG_YAML} endif GEN_DOC_ARGS = ifdef LINKML_GENERATORS_DOC_ARGS -GEN_DOC_ARGS = ${LINKML_GENERATORS_DOC_ARGS} +GEN_DOC_ARGS += ${LINKML_GENERATORS_DOC_ARGS} endif GEN_OWL_ARGS = ifdef LINKML_GENERATORS_OWL_ARGS -GEN_OWL_ARGS = ${LINKML_GENERATORS_OWL_ARGS} +GEN_OWL_ARGS += ${LINKML_GENERATORS_OWL_ARGS} endif GEN_JAVA_ARGS = ifdef LINKML_GENERATORS_JAVA_ARGS -GEN_JAVA_ARGS = ${LINKML_GENERATORS_JAVA_ARGS} +GEN_JAVA_ARGS += ${LINKML_GENERATORS_JAVA_ARGS} endif GEN_TS_ARGS = ifdef LINKML_GENERATORS_TYPESCRIPT_ARGS -GEN_TS_ARGS = ${LINKML_GENERATORS_TYPESCRIPT_ARGS} +GEN_TS_ARGS += ${LINKML_GENERATORS_TYPESCRIPT_ARGS} endif @@ -195,7 +197,7 @@ $(DOCDIR): mkdir -p $@ gendoc: $(DOCDIR) - cp -rf $(SRC)/docs/* $(DOCDIR) ; \ + cp -rf $(SRC)/docs/files/* $(DOCDIR) ; \ $(RUN) gen-doc ${GEN_DOC_ARGS} -d $(DOCDIR) $(SOURCE_SCHEMA_PATH) testdoc: gendoc serve diff --git a/{{cookiecutter.project_name}}/src/docs/about.md b/{{cookiecutter.project_name}}/src/docs/files/about.md similarity index 100% rename from {{cookiecutter.project_name}}/src/docs/about.md rename to {{cookiecutter.project_name}}/src/docs/files/about.md diff --git a/{{cookiecutter.project_name}}/src/docs/templates/README.md b/{{cookiecutter.project_name}}/src/docs/templates/README.md new file mode 100644 index 0000000..e46c937 --- /dev/null +++ b/{{cookiecutter.project_name}}/src/docs/templates/README.md @@ -0,0 +1,3 @@ +Use this folder to store templates to modify the generated documentation. The templates are written in Jinja2 and are used to generate the HTML documentation for the schema. + +The default templates are stored in the linkml repository at https://github.com/linkml/linkml/tree/main/linkml/generators/docgen. If you want to use these as a starting point, you can copy them into this folder and modify them as needed. \ No newline at end of file From 100813d41207a07e62a3311e7e10c23f60ddbf77 Mon Sep 17 00:00:00 2001 From: amc-corey-cox <69321580+amc-corey-cox@users.noreply.github.com> Date: Wed, 11 Sep 2024 07:56:14 -0500 Subject: [PATCH 2/2] Move Makefile variables to config.public.mk --- {{cookiecutter.project_name}}/Makefile | 2 +- {{cookiecutter.project_name}}/{.env.public => config.public.mk} | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) rename {{cookiecutter.project_name}}/{.env.public => config.public.mk} (98%) diff --git a/{{cookiecutter.project_name}}/Makefile b/{{cookiecutter.project_name}}/Makefile index 4ad0d18..3a4bc5f 100644 --- a/{{cookiecutter.project_name}}/Makefile +++ b/{{cookiecutter.project_name}}/Makefile @@ -11,7 +11,7 @@ SHELL := bash ifdef LINKML_ENVIRONMENT_FILENAME include ${LINKML_ENVIRONMENT_FILENAME} else -include .env.public +include config.public.mk endif RUN = poetry run diff --git a/{{cookiecutter.project_name}}/.env.public b/{{cookiecutter.project_name}}/config.public.mk similarity index 98% rename from {{cookiecutter.project_name}}/.env.public rename to {{cookiecutter.project_name}}/config.public.mk index fab402e..ab92906 100644 --- a/{{cookiecutter.project_name}}/.env.public +++ b/{{cookiecutter.project_name}}/config.public.mk @@ -1,3 +1,5 @@ +# config.public.mk + # This file is public in git. No sensitive info allowed. # These variables are sourced in Makefile, following make-file conventions. # Be aware that this file does not follow python or bash conventions, so may appear a little unfamiliar.