Enhance Makefile with help command and improve task descriptions

This commit is contained in:
William Valentin
2025-07-24 13:20:36 -07:00
parent 3abe262804
commit 40da6f1fba

View File

@@ -2,7 +2,10 @@ TARGET=thechart
VERSION=1.0.0 VERSION=1.0.0
ROOT=/home/will ROOT=/home/will
ICON=chart-671.png ICON=chart-671.png
setup-env: help: ## Show this help
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
setup-env: ## Set up the development environment
@echo "Setting up the development environment..."
pip install poetry pip install poetry
poetry env use 3.13 poetry env use 3.13
poetry install poetry install
@@ -10,28 +13,38 @@ setup-env:
poetry run pre-commit install --install-hooks --overwrite poetry run pre-commit install --install-hooks --overwrite
poetry run pre-commit autoupdate poetry run pre-commit autoupdate
poetry run pre-commit run --all-files poetry run pre-commit run --all-files
build: build: ## Build the Docker image
@echo "Building the Docker image..."
docker buildx build --platform linux/amd64,linux/arm64 -t ${IMAGE} --push . docker buildx build --platform linux/amd64,linux/arm64 -t ${IMAGE} --push .
install: install: ## Install the application
@echo "Installing the application..."
pyinstaller --name ${TARGET} --optimize 2 --onefile --windowed --hidden-import='PIL._tkinter_finder' --icon='${ICON}' --add-data=".env:." --add-data='./chart-671.png:.' --add-data='./thechart_data.csv:.' src/main.py pyinstaller --name ${TARGET} --optimize 2 --onefile --windowed --hidden-import='PIL._tkinter_finder' --icon='${ICON}' --add-data=".env:." --add-data='./chart-671.png:.' --add-data='./thechart_data.csv:.' src/main.py
cp -f ./thechart_data.csv ${ROOT}/Documents/ cp -f ./thechart_data.csv ${ROOT}/Documents/
cp -f ./dist/${TARGET} ${ROOT}/Applications/ cp -f ./dist/${TARGET} ${ROOT}/Applications/
cp -f ./deploy/${TARGET}.desktop ${ROOT}/.local/share/applications/ cp -f ./deploy/${TARGET}.desktop ${ROOT}/.local/share/applications/
desktop-file-validate ${ROOT}/.local/share/applications/${TARGET}.desktop desktop-file-validate ${ROOT}/.local/share/applications/${TARGET}.desktop
run: run: ## Run the application
@echo "Running the application..."
python src/main.py python src/main.py
start: start: ## Start the application
@echo "Starting the application..."
docker-compose up -d --build docker-compose up -d --build
stop: stop: ## Stop the application
@echo "Stopping the application..."
docker-compose down docker-compose down
test: test: ## Run the tests
@echo "Running the tests..."
docker-compose exec ${TARGET} pipenv run pytest -v --tb=short docker-compose exec ${TARGET} pipenv run pytest -v --tb=short
lint: lint: ## Run the linter
@echo "Running the linter..."
docker-compose exec ${TARGET} pipenv run pre-commit run --all-files docker-compose exec ${TARGET} pipenv run pre-commit run --all-files
format: format: ## Format the code
@echo "Formatting the code..."
docker-compose exec ${TARGET} pipenv run pre-commit run --all-files --show-diff docker-compose exec ${TARGET} pipenv run pre-commit run --all-files --show-diff
shell: shell: ## Open a shell in the container
@echo "Opening a shell in the container..."
docker-compose exec -it ${TARGET} /bin/bash docker-compose exec -it ${TARGET} /bin/bash
requirements: requirements: ## Export the requirements to a file
@echo "Exporting requirements to requirements.txt..."
poetry export --without-hashes -f requirements.txt -o requirements.txt poetry export --without-hashes -f requirements.txt -o requirements.txt
.PHONY: setup-env build install run start stop test lint format shell .PHONY: setup-env build install run start stop test lint format shell requirements help