Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.DEFAULT_GOAL:=help

%: # skip unknown commands
@:

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%17s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
Expand All @@ -8,7 +11,7 @@ start: ## Start all containers in background
docker-compose up --detach

stop: ## Stop all containers
docker-compose stop ${CONTAINER}
docker-compose stop

build: ## Build backend & frontend containers
make build-backend
Expand All @@ -34,44 +37,41 @@ test: ## Run tests
make test-frontend
make test-backend

manage: ## Use manage.py, i.e make manage CMD=collectstatic
docker-compose run --rm --no-deps backend python3 manage.py ${CMD}

build-backend: ## Build backend container
docker-compose stop backend
docker build --tag codeforpoznan/pah-fm-backend backend
manage: ## Use manage.py, i.e make manage populate_database
docker-compose exec backend ./manage.py $(filter-out $@,$(MAKECMDGOALS))

build-frontend: ## Build frontend container
docker-compose stop frontend
docker build --tag codeforpoznan/pah-fm-frontend frontend

remove-backend: ## Stop and remove backend container
docker-compose rm -v --stop --force backend

remove-frontend: ## Stop and remove frontend container
docker-compose rm -v --stop --force frontend

lint-backend: ## Run linters on backend container
docker-compose run --rm --no-deps backend flake8 .
docker-compose run --rm --no-deps backend black .

lint-frontend: ## Run linters on frontend container
docker-compose run --rm --no-deps frontend npm run lint:fix
docker-compose exec frontend npm run lint:fix

test-frontend: ## Run tests on frontend container
docker-compose run --rm --no-deps frontend npm run test
docker-compose exec frontend npm run test

bash-frontend: ## Enter frontend container
docker-compose exec frontend bash

build-backend: ## Build backend container
docker-compose stop backend
docker build --tag codeforpoznan/pah-fm-backend backend

remove-backend: ## Stop and remove backend container
docker-compose rm -v --stop --force backend

lint-backend: ## Run linters on backend container
docker-compose exec backend flake8 .
docker-compose exec backend black .

test-backend: ## Run tests on backend container
make manage CMD=test
make manage test

bash-backend: ## Enter backend container
docker-compose exec backend bash

bash-frontend: ## Enter frontend container
docker-compose exec frontend bash

debug-backend: ## Debug backend container (Django)
docker attach `docker-compose ps -q backend`

populate-database: ## Populate database with factory based data
make manage CMD=populate_database
docker attach `docker-compose ps -q backend`
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ make start
4. Generate some random data for testing

```shell script
make populate-database
make manage populate_database
```


Expand Down Expand Up @@ -182,7 +182,7 @@ how can I fix it?
`A:` `make lint` and `git add . && git commit && git push`

`Q:` How to generate some random data for testing?
`A:` `make populate-database`
`A:` `make manage populate_database`

`Q:` How to debug backend with PDB?
`A:` Place `import pdb; pdb.set_trace()` in code, save the file,
Expand All @@ -204,7 +204,7 @@ If you have any more questions not described here then please ask us

#### Initial admin credentials
We have 2 default users who are always present - `hello` and `ola`,
but you can create a few more default by running `make populate-database`.
but you can create a few more default by running `make manage populate_database`.
This command will create `driver` and `passenger` and also few other
random users and basic entities (Cars, Projects).
Every user that's randomly created has the same password -`pass123`.
Expand All @@ -216,7 +216,7 @@ username | password | Vue app access | Django Admin acce
------------------------------- | --------- | -------------- | ------------------- |
hello@codeforpoznan.pl | pass123 | no | yes |
ola@pah.org.pl | pass123 | no | no |
...after `populate-database`... | ... | ... | ... |
...after `populate_database`... | ... | ... | ... |
driver@codeforpoznan.pl | pass123 | yes | no |
passenger@codeforpoznan.pl | pass123 | yes | no |

Expand Down