Skip to content

Commit

Permalink
chore: Jinja update entire makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
saattrupdan committed Jul 15, 2024
1 parent c13b55c commit e52a862
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions {{cookiecutter.project_name}}/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ install-brew:
echo "Installed Homebrew."; \
fi

{% if cookiecutter.open_source != 'y' -%}
install-gpg:
@if [ "$(shell which gpg)" = "" ] || [ "$(shell which gpg-agent)" = "" ]; then \
uname=$$(uname); \
Expand All @@ -94,7 +95,9 @@ generate-gpg-key:
gpg --full-generate-key; \
echo "Generated a new GPG key. Remember to register it to Github at https://github.com/settings/gpg/new, where you add the key generated by running 'gpg --armor --export <key>'"; \
fi
{% endif -%}

{% if cookiecutter.dependency_manager != 'pip' -%}
install-pipx:
@if [ "$(shell which pipx)" = "" ]; then \
uname=$$(uname); \
Expand All @@ -107,9 +110,22 @@ install-pipx:
pipx ensurepath --force; \
echo "Installed pipx."; \
fi
{{'\ninstall-poetry:\n\t@if [ ! "$(shell poetry --version)" = "Poetry (version 1.8.2)" ]; then \\\n python3 -m pip uninstall -y poetry poetry-core poetry-plugin-export; \\\n pipx install --force poetry==1.8.2; \\\n echo "Installed Poetry."; \\\n fi\n' if cookiecutter.dependency_manager != 'pip'}}

install-poetry:
@if [ ! "$(shell poetry --version)" = "Poetry (version 1.8.2)" ]; then \
python3 -m pip uninstall -y poetry poetry-core poetry-plugin-export;
pipx install --force poetry==1.8.2;
echo "Installed Poetry.";
fi
{% endif -%}

install-dependencies:
{{'@poetry env use python' if cookiecutter.dependency_manager != 'pip' else '@python'}}{{cookiecutter.python_version}}{{' && poetry install' if cookiecutter.dependency_manager != 'pip' else ' -m venv .venv\n\t@. .venv/bin/activate && pip install -qU pip && pip install -qe .[dev]'}}
{% if cookiecutter.dependency_manager != 'pip' -%}
@poetry env use python{{cookiecutter.python_version}} && poetry install
{% else -%}
@python -m venv .venv
@. .venv/bin/activate && pip install -qU pip && pip install -qe .[dev]
{% endif -%}

setup-environment-variables:
@if [ -d src/ragger ]; then \
Expand Down Expand Up @@ -152,7 +168,13 @@ add-repo-to-git:
@if [ "$(shell git remote)" = "" ]; then \
git remote add origin [email protected]:alexandrainst/{{ cookiecutter.project_name }}.git; \
fi
{{'\nfreeze: ## Freeze dependencies\n\t@. .venv/bin/activate && python src/scripts/freeze_dependencies.py\n\t@echo "Updated dependencies in pyproject.toml."\n' if cookiecutter.dependency_manager == 'pip'}}

{% if cookiecutter.dependency_manager == 'pip' -%}
freeze: ## Freeze dependencies
@. .venv/bin/activate && python src/scripts/freeze_dependencies.py
@echo "Updated dependencies in pyproject.toml."
{% endif -%}

docs: ## Generate documentation
@{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}pdoc --docformat google src/{{cookiecutter.project_name}} -o docs
@echo "Saved documentation."
Expand All @@ -171,7 +193,10 @@ view-docs: ## View documentation
test: ## Run tests
@{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}pytest && {{'poetry run ' if cookiecutter.dependency_manager != 'pip'}}readme-cov

docker: ## Build Docker image and run container{{'\n\t@$(MAKE) --quiet freeze' if cookiecutter.dependency_manager == 'pip'}}
docker: ## Build Docker image and run container
{% if cookiecutter.dependency_manager == 'pip' -%}
@$(MAKE) --quiet freeze
{% endif -%}
@docker build -t {{ cookiecutter.project_name }} .
@docker run -it --rm {{ cookiecutter.project_name }}

Expand Down

0 comments on commit e52a862

Please sign in to comment.