Skip to content

Commit 21dc84d

Browse files
authoredOct 4, 2024··
Merge pull request #123 from linkml/fix_make_vars
Fix make vars quoting and improve docs gen by adding template location and documentation.
2 parents b2da87e + 100813d commit 21dc84d

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed
 

‎{{cookiecutter.project_name}}/Makefile

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SHELL := bash
1111
ifdef LINKML_ENVIRONMENT_FILENAME
1212
include ${LINKML_ENVIRONMENT_FILENAME}
1313
else
14-
include .env.public
14+
include config.public.mk
1515
endif
1616

1717
RUN = poetry run
@@ -22,35 +22,37 @@ SRC = src
2222
DEST = project
2323
PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
2424
DOCDIR = docs
25+
DOCTEMPLATES = $(SRC)/docs/templates
2526
EXAMPLEDIR = examples
2627
SHEET_MODULE = {{cookiecutter.__google_sheet_module}}
2728
SHEET_ID = $(LINKML_SCHEMA_GOOGLE_SHEET_ID)
2829
SHEET_TABS = $(LINKML_SCHEMA_GOOGLE_SHEET_TABS)
2930
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml
3031

32+
# Use += to append variables from the variables file
3133
CONFIG_YAML =
3234
ifdef LINKML_GENERATORS_CONFIG_YAML
33-
CONFIG_YAML = ${LINKML_GENERATORS_CONFIG_YAML}
35+
CONFIG_YAML += ${LINKML_GENERATORS_CONFIG_YAML}
3436
endif
3537

3638
GEN_DOC_ARGS =
3739
ifdef LINKML_GENERATORS_DOC_ARGS
38-
GEN_DOC_ARGS = ${LINKML_GENERATORS_DOC_ARGS}
40+
GEN_DOC_ARGS += ${LINKML_GENERATORS_DOC_ARGS}
3941
endif
4042

4143
GEN_OWL_ARGS =
4244
ifdef LINKML_GENERATORS_OWL_ARGS
43-
GEN_OWL_ARGS = ${LINKML_GENERATORS_OWL_ARGS}
45+
GEN_OWL_ARGS += ${LINKML_GENERATORS_OWL_ARGS}
4446
endif
4547

4648
GEN_JAVA_ARGS =
4749
ifdef LINKML_GENERATORS_JAVA_ARGS
48-
GEN_JAVA_ARGS = ${LINKML_GENERATORS_JAVA_ARGS}
50+
GEN_JAVA_ARGS += ${LINKML_GENERATORS_JAVA_ARGS}
4951
endif
5052

5153
GEN_TS_ARGS =
5254
ifdef LINKML_GENERATORS_TYPESCRIPT_ARGS
53-
GEN_TS_ARGS = ${LINKML_GENERATORS_TYPESCRIPT_ARGS}
55+
GEN_TS_ARGS += ${LINKML_GENERATORS_TYPESCRIPT_ARGS}
5456
endif
5557

5658

@@ -195,7 +197,7 @@ $(DOCDIR):
195197
mkdir -p $@
196198

197199
gendoc: $(DOCDIR)
198-
cp -rf $(SRC)/docs/* $(DOCDIR) ; \
200+
cp -rf $(SRC)/docs/files/* $(DOCDIR) ; \
199201
$(RUN) gen-doc ${GEN_DOC_ARGS} -d $(DOCDIR) $(SOURCE_SCHEMA_PATH)
200202

201203
testdoc: gendoc serve

‎{{cookiecutter.project_name}}/.env.public ‎{{cookiecutter.project_name}}/config.public.mk

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1+
# config.public.mk
2+
13
# This file is public in git. No sensitive info allowed.
4+
# These variables are sourced in Makefile, following make-file conventions.
5+
# Be aware that this file does not follow python or bash conventions, so may appear a little unfamiliar.
26

37
###### schema definition variables, used by makefile
48

5-
LINKML_SCHEMA_NAME="{{cookiecutter.__project_slug}}"
6-
LINKML_SCHEMA_AUTHOR="{{cookiecutter.__author}}"
7-
LINKML_SCHEMA_DESCRIPTION="{{cookiecutter.project_description}}"
8-
LINKML_SCHEMA_SOURCE_PATH="{{cookiecutter.__source_path}}"
9-
LINKML_SCHEMA_GOOGLE_SHEET_ID="{{cookiecutter.google_sheet_id}}"
10-
LINKML_SCHEMA_GOOGLE_SHEET_TABS="{{cookiecutter.google_sheet_tabs}}"
9+
# Note: makefile variables should not be quoted, as makefile handles quoting differently than bash
10+
LINKML_SCHEMA_NAME={{cookiecutter.__project_slug}}
11+
LINKML_SCHEMA_AUTHOR={{cookiecutter.__author}}
12+
LINKML_SCHEMA_DESCRIPTION={{cookiecutter.project_description}}
13+
LINKML_SCHEMA_SOURCE_PATH={{cookiecutter.__source_path}}
14+
LINKML_SCHEMA_GOOGLE_SHEET_ID={{cookiecutter.google_sheet_id}}
15+
LINKML_SCHEMA_GOOGLE_SHEET_TABS={{cookiecutter.google_sheet_tabs}}
1116

1217
###### linkml generator variables, used by makefile
1318

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
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.
2+
3+
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.

0 commit comments

Comments
 (0)
Please sign in to comment.