-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
89 lines (72 loc) · 1.72 KB
/
justfile
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
export DATABASE_URL := "sqlite:./data/hitomi.db"
# Default recipe to display help information
default:
@just --list
# Build a docker image
[group('docker')]
docker-build:
docker build -t nledford/hitomi:latest .
# Build and run a docker image
[group('docker')]
docker-run:
#!/usr/bin/env bash
docker run\
-e TZ='America/New_York'\
-e DATABASE_URL='sqlite:/data/hitomi.db'\
-v "./data:/data"\
--rm -it --name hitomi nledford/hitomi:latest run
# Run clippy. Fails if clippy finds issues.
[group('rust')]
clippy:
cargo clippy -- -Dwarnings
# Format rust files
[group('rust')]
format:
cargo fmt --all
# Build rust files
[group('rust')]
build: format clippy
cargo build
# Build and run tests
[group('rust')]
test: build
cargo nextest run
# Run the application once
[group('rust')]
run: test
cargo run -- run
# Run the application in loop mode
[group('rust')]
run-loop $RUST_BACKTRACE="full" $LOG_LEVEL="INFO": test
cargo run -- run -l
# Install the application to local machine
[group('rust')]
install: build test
cargo install --path .
# Update rust crates
[group('rust')]
update:
cargo upgrade; cargo update;
# Backup the sqlite database
[group('sqlite')]
backup-db:
sqlite3 ./data/hitomi.db ".backup './data/hitomi-backup.db'"
# Create a database using sqlx
[group('sqlx')]
create-db:
sqlx database create
# Delete a database using sqlx
[group('sqlx')]
drop-db:
sqlx database drop
# Recreates the database from scratch
[group('sqlx')]
rebuild-db: backup-db drop-db create-db run-migrations
# Create a sqlx migration
[group('sqlx')]
add-migration migration:
sqlx migrate add {{migration}}
# Run sqlx migrations
[group('sqlx')]
run-migrations:
sqlx migrate run