saasitone/Makefile

73 lines
1.5 KiB
Makefile
Raw Normal View History

2022-11-04 15:49:25 -07:00
# Determine if you have docker-compose or docker compose installed locally
# If this does not work on your system, just set the name of the executable you have installed
DCO_BIN := $(shell { command -v docker-compose || command -v docker compose; } 2>/dev/null)
# Connect to the primary database
2021-12-14 18:16:48 -08:00
.PHONY: db
db:
2022-11-04 15:49:25 -07:00
docker exec -it pagoda_db psql postgresql://admin:admin@localhost:5432/app
2022-11-04 15:49:25 -07:00
# Connect to the test database (you must run tests first before running this)
2021-12-14 18:16:48 -08:00
.PHONY: db-test
db-test:
2022-11-04 15:49:25 -07:00
docker exec -it pagoda_db psql postgresql://admin:admin@localhost:5432/app_test
2021-12-13 09:51:00 -08:00
# Connect to the primary cache
2021-12-27 14:36:18 -08:00
.PHONY: cache
cache:
2022-11-04 15:49:25 -07:00
docker exec -it pagoda_cache redis-cli
# Connect to the test cache
.PHONY: cache-test
cache-test:
2022-11-04 15:49:25 -07:00
docker exec -it pagoda_cache redis-cli -n 1
2021-12-27 14:36:18 -08:00
# Install Ent code-generation module
.PHONY: ent-install
ent-install:
go get -d entgo.io/ent/cmd/ent
# Generate Ent code
2021-12-11 10:46:01 -08:00
.PHONY: ent-gen
ent-gen:
go generate ./ent
# Create a new Ent entity
2021-12-11 10:46:01 -08:00
.PHONY: ent-new
ent-new:
2023-02-23 00:35:33 -08:00
go run entgo.io/ent/cmd/ent new $(name)
2021-12-11 10:46:01 -08:00
# Start the Docker containers
2021-12-11 11:00:10 -08:00
.PHONY: up
up:
2022-11-04 15:49:25 -07:00
$(DCO_BIN) up -d
2021-12-11 11:00:10 -08:00
sleep 3
# Rebuild Docker containers to wipe all data
.PHONY: reset
reset:
2022-11-04 15:49:25 -07:00
$(DCO_BIN) down
make up
# Run the application
2021-12-11 11:00:10 -08:00
.PHONY: run
run:
2021-12-11 13:06:28 -08:00
clear
2022-11-02 16:23:26 -07:00
go run cmd/web/main.go
# Run all tests
.PHONY: test
2021-12-17 18:14:43 -08:00
test:
go test -count=1 -p 1 ./...
# Run the worker
.PHONY: worker
worker:
clear
2023-01-04 04:02:05 -08:00
go run cmd/worker/main.go
# Check for direct dependency updates
.PHONY: check-updates
check-updates:
go list -u -m -f '{{if not .Indirect}}{{.}}{{end}}' all | grep "\["