From 2eb01807da9457f4361bea238da431f1a75d645e Mon Sep 17 00:00:00 2001 From: Matthew Pereira Date: Thu, 3 Aug 2023 21:22:01 -0700 Subject: [PATCH 1/2] impliment makefile --- Makefile | 35 +++++++++++++++++++++++++++++++++++ alias-config.txt | 6 ------ alias.sh | 36 ------------------------------------ 3 files changed, 35 insertions(+), 42 deletions(-) create mode 100644 Makefile delete mode 100644 alias-config.txt delete mode 100755 alias.sh diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..b4c0872d --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +.PHONY: build start stop build-linter lint test test-server + +# Run commands with `make ` + +build: + docker compose build + +start: + docker compose up + +stop: + docker compose down + +build-linter: + docker compose build linter + +lint: + docker compose up linter + +# Below commands require the docker containers to be running + +migrations: + docker compose exec django python manage.py makemigrations + +migrate: + docker compose exec django python manage.py migrate + +db-shell: + docker compose exec django python manage.py shell + +test-frontend: + docker compose run -T -w /code/frontend webpack npm run test + +test-server: + docker exec django python manage.py test server.tests \ No newline at end of file diff --git a/alias-config.txt b/alias-config.txt deleted file mode 100644 index a83a6669..00000000 --- a/alias-config.txt +++ /dev/null @@ -1,6 +0,0 @@ -build: docker compose build -start:docker compose up -stop:docker compose down -build-linter:docker compose build linter -lint:docker compose up linter -test:docker compose run -T webpack npm run test diff --git a/alias.sh b/alias.sh deleted file mode 100755 index 32ea7488..00000000 --- a/alias.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Configuration file containing shortened versions and associated commands -config_file='alias-config.txt' - -# Function to display help message -show_help() { - echo "Usage: $0 " - echo "" - echo "Options:" - echo " -h Show help message" - echo "" - echo "Available commands:" - while IFS=':' read -r alias command || [ -n "$alias" ]; do - printf " %-8s %s\n" "$alias" "$command" - done < "$config_file" -} - -# If no arguments provided or the argument is -h, show help message -if [ $# -eq 0 ] || [ "$1" = "-h" ]; then - show_help - exit 0 -fi - -# Read the config file to find the matching shortened version -while IFS=':' read -r alias command; do - if [ "$alias" = "$1" ]; then - $command - exit 0 - fi -done < "$config_file" - -# If no matching shortened version is found, display an error message -echo "Unknown alias (shortcut name for command): $1" -echo "Run $0 -h for more information." -exit 1 From a6ce13522a87efd677d1d23df04d5131e7eb0fd3 Mon Sep 17 00:00:00 2001 From: Matthew Pereira Date: Thu, 3 Aug 2023 21:29:20 -0700 Subject: [PATCH 2/2] update .PHONY and comments --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b4c0872d..15bb8db9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -.PHONY: build start stop build-linter lint test test-server +.PHONY: build start stop build-linter lint migrations migrate db-shell test-server test-frontend -# Run commands with `make ` +# Run commands with `make ` build: docker compose build