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

refactor: 4th use environment vars instead of about.yaml #95

Merged
merged 5 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions {{cookiecutter.project_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ SHELL := bash
.SECONDARY:

RUN = poetry run
# get values from about.yaml file
SCHEMA_NAME = $(shell ${SHELL} ./utils/get-value.sh name)
SOURCE_SCHEMA_PATH = $(shell ${SHELL} ./utils/get-value.sh source_schema_path)
SCHEMA_NAME = ${LINKML_SCHEMA_NAME}
SOURCE_SCHEMA_PATH = ${LINKML_SCHEMA_SOURCE_PATH}
SOURCE_SCHEMA_DIR = $(dir $(SOURCE_SCHEMA_PATH))
SRC = src
DEST = project
PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel
DOCDIR = docs
EXAMPLEDIR = examples
SHEET_MODULE = {{cookiecutter.__google_sheet_module}}
SHEET_ID = $(shell ${SHELL} ./utils/get-value.sh google_sheet_id)
SHEET_TABS = $(shell ${SHELL} ./utils/get-value.sh google_sheet_tabs)
SHEET_ID = ${LINKML_SCHEMA_GOOGLE_SHEET_ID}
SHEET_TABS = ${LINKML_SCHEMA_GOOGLE_SHEET_TABS}
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml

# environment variables
Expand Down Expand Up @@ -58,7 +57,7 @@ status: check-config
@echo "Source: $(SOURCE_SCHEMA_PATH)"

# generate products and add everything to github
setup: git-init install gen-project gen-examples gendoc git-add git-commit
setup: check-config git-init install gen-project gen-examples gendoc git-add git-commit

# install any dependencies required for building
install:
Expand Down Expand Up @@ -121,7 +120,11 @@ lint:
$(RUN) linkml-lint $(SOURCE_SCHEMA_PATH)

check-config:
@(grep my-datamodel about.yaml > /dev/null && printf "\n**Project not configured**:\n\n - Remember to edit 'about.yaml'\n\n" || exit 0)
ifndef LINKML_SCHEMA_NAME
$(error **Project not configured**:\n\n - See 'config.env'\n\n)
else
$(info Ok)
endif

convert-examples-to-%:
$(patsubst %, $(RUN) linkml-convert % -s $(SOURCE_SCHEMA_PATH) -C Person, $(shell ${SHELL} find src/data/examples -name "*.yaml"))
Expand Down
7 changes: 0 additions & 7 deletions {{cookiecutter.project_name}}/about.yaml

This file was deleted.

28 changes: 23 additions & 5 deletions {{cookiecutter.project_name}}/config.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
LINKML_GENERATORS_PROJECT_ARGS=--config-file config.yaml

### Extra layer of configuration for Makefile beyond
### what 'gen-project --config-file config.yaml' provides.
### Uncomment and set environment variables as needed.
###### schema definition variables, used by makefile

# LINKML_GENERATORS_MARKDOWN_ARGS=--no-mergeimports
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

## gen-project configuration file
LINKML_GENERATORS_CONFIG_YAML= --config-file config.yaml

## pass args if gendoc ignores config.yaml (i.e. --no-mergeimports)
LINKML_GENERATORS_DOC_ARGS=

## pass args to workaround genowl rdfs config bug (linkml#1453)
## (i.e. --no-type-objects --no-metaclasses --metadata-profile rdfs)
LINKML_GENERATORS_OWL_ARGS=

## pass args to trigger experimental java/typescript generation
LINKML_GENERATORS_JAVA_ARGS=
LINKML_GENERATORS_TYPESCRIPT_ARGS=

4 changes: 0 additions & 4 deletions {{cookiecutter.project_name}}/utils/get-value.sh

This file was deleted.

Loading