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 all 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
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ Suggestions:

Change to the folder your generated project is in.

Optionally customize your project when necessary:

- pass arguments to linkml generators via 'config.yaml' configuration file;
- pass supported environment variables via 'config.env' configuration file;
- configure proxy server via project configuration file (as illustrated):
```bash
git init
poetry source add --priority=default myproxy https://repo.example.com/repository/pypi-all/simple
```
Optionally customize your project if needed:

* pass arguments to linkml generators via 'config.yaml' configuration file;
* pass supported environment variables via '.env.public' configuration file;
* configure proxy server via project configuration file (as illustrated):
```bash
git init
poetry source add --priority=default myproxy https://repo.example.com/repository/pypi-all/simple
```

Setup your project
```bash
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# This file is public in git. No sensitive info allowed.

###### 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}}"

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

Expand Down
19 changes: 11 additions & 8 deletions {{cookiecutter.project_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ SHELL := bash
ifdef LINKML_ENVIRONMENT_FILENAME
include ${LINKML_ENVIRONMENT_FILENAME}
else
include config.env
include .env.public
endif

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

CONFIG_YAML =
Expand Down Expand Up @@ -78,7 +77,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 @@ -154,7 +153,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 '.env.public'\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.

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

This file was deleted.

Loading