-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c13b55c
commit e52a862
Showing
1 changed file
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); \ | ||
|
@@ -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); \ | ||
|
@@ -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 \ | ||
|
@@ -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." | ||
|
@@ -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 }} | ||
|
||
|