[build]
description = "Compile the project for publication and installation."
initial_message = "Build project ..."
commands = ["imake binary", "python -m snakypy.zshpower", "poetry build"]
final_message = "Build project terminated!"

[install]
description = "Performs the installation of project dependencies and installs the same."
initial_message = "Installing package and dependencies ..."
commands = ["poetry install"]
final_message = "Installation command terminated!"

[tests]
description = "Perform tests using the Pytest library"
initial_message = "Starting tests with Pytest ..."
commands = ["poetry run pytest"]
final_message = "Test command terminated!"

[tox]
description = "Tests using the Tox library."
initial_message = "Starting tests with Tox ..."
commands = ["poetry run tox"]
final_message = "Test command terminated!"

[binary]
description = "Generate binary"
initial_message = "Generate binary..."
commands = [
"""
pyinstaller binary-command.spec
pyinstaller binary-draw.spec
python -c '
import platform
import shutil
from pathlib import Path
from os.path import join
Path(join("binary", "linux")).mkdir(parents=True, exist_ok=True)
Path(join("binary", "macos")).mkdir(parents=True, exist_ok=True)
if platform.system() == "Linux":
    shutil.move(join("dist", "zshpower"), join("binary", "linux", "zshpower"))
    shutil.move(join("dist", "zshpower-draw"), join("binary", "linux", "zshpower-draw"))
elif platform.system() == "Darwin":
    shutil.move(join("dist", "zshpower"), join("binary", "macos", "zshpower"))
    shutil.move(join("dist", "zshpower-draw"), join("binary", "macos", "zshpower-draw"))
'
"""
]
final_message = "Generate binary terminated!"

[linters]
description = "Checks if the project structure is in accordance with certain linters."
initial_message = "Checking project structure with linters ..."
commands = [
"""
poetry run flake8 snakypy/ tests/;
poetry run mypy snakypy/ tests/;
poetry run isort --profile black snakypy/ tests/ --check-only;
poetry run black snakypy/ tests/ --check;
"""
]
final_message = "Linter command terminated!"

[fixup]
description = "Corrects the project structure with certain tools."
initial_message = "Correcting the project structure ..."
commands = [
"""
poetry run isort --profile black snakypy/ tests/;
poetry run black snakypy/ tests/;
"""
]
final_message = "Command to correct structure finished!"

[clean]
description = "Removes insignificant objects."
initial_message = "Starting object cleanup ..."
commands = [
"""
rm -rf dist;
rm -rf .pytest_cache;
rm -rf .tox;
rm -rf .mypy_cache;
rm -rf docs/_build;
"""
]
final_message = "Cleaning command finished!"

[pypi]
#
# Add configuration: poetry config repositories.pypi https://upload.pypi.org/legacy/
#
description = "Publish this project to the Pypi repository."
initial_message = "Publishing package to the Pypi repository ..."
commands = [
"""
rm -f dist/*;
python -m snakypy.zshpower;
poetry build;
poetry publish -r pypi -u williamcanin;
"""
]
final_message = "Publishing command terminated!"

[testpypi]
#
# Add configuration: poetry config repositories.testpypi https://test.pypi.org/legacy/
#
description = "Publish this project to the TestPypi repository."
initial_message = "Publishing package to the TestPypi repository ..."
commands = [
"""
rm -f dist/*;
python -m snakypy.zshpower;
poetry build;
poetry publish -r testpypi -u williamcanin;
"""
]
final_message = "Publishing command terminated!"
