-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
128 lines (98 loc) · 2.78 KB
/
Justfile
File metadata and controls
128 lines (98 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# List available recipes
default:
@just --list
# Complete development environment: init DB, run server in background, then client
dev:
#!/usr/bin/env bash
# Initialize the database first
echo "Initializing database..."
./scripts/init_db.sh
# Start the web server in the background
echo "Starting web server..."
cargo run -p web_server &
SERVER_PID=$!
# Give the server a moment to start up
sleep 1
# Run the client example
echo "Starting client..."
cargo run --example client -p web_server
# Clean up the server when the client exits
kill $SERVER_PID
# Development with file watching
dev-watch:
#!/usr/bin/env bash
# Initialize the database first
echo "Initializing database..."
./scripts/init_db.sh
# Start web server with watching
echo "Starting web server with watching..."
# Use multiple terminals or a terminal multiplexer like tmux for this
# This particular command should be run in a separate terminal
cargo watch -q -c -w .cargo -w crates/lib/services/web_server/src/ -x "run -p web_server"
# Initialize the database using Docker
init-db:
./scripts/init_db.sh
# Initialize psql terminal
term-db:
docker exec -it -u postgres pg psql
# Run the web server specifically
run-ws:
cargo run -p web_server --bin web_server
# Run the web server with watch mode for development (requires cargo-watch)
watch-ws:
cargo watch -q -c -w crates/lib/services/web_server/src/ -x "run -p web_server"
# Run with watch mode for development (requires cargo-watch)
watch:
cargo watch -x run
# Build the project
build:
cargo build
# Build for production (optimized)
gen-key:
cargo run --example gen-key -p web_server
# Build for production (optimized)
build-release:
cargo build --release
# Check for errors
check:
cargo check
# Run tests
test:
cargo test
# Watch unit test
watch-unit MODEL NAME:
cargo watch -q -c -x "test -p lib-core -- model::{{MODEL}}::tests::{{NAME}} --exact --quiet --nocapture"
# Run clippy for linting
lint:
cargo clippy -- -D warnings
# Format code
format:
cargo fmt --all
# Clean the project
clean:
cargo clean
# Clean docker containers
docker-clean:
docker stop pg
docker rm pg
# Generate documentation
docs:
cargo doc --open
# Audit dependencies for security vulnerabilities
audit:
cargo audit
# Update dependencies
update-deps:
cargo update
# Database migrations (if using diesel)
migrate:
diesel migration run
# Revert last migration (if using diesel)
migrate-revert:
diesel migration revert
# Combined quality checks before committing
pre-commit: format lint test
# Deploy to production (customize as needed)
deploy: build-release
@echo "Deploying application..."
# Add your deployment commands here