-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathTaskfile.yml
112 lines (84 loc) · 2.13 KB
/
Taskfile.yml
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
version: "3"
# global env:
env:
ENV1: testing
# OUT_DIR: "/Users/dev/Documents/iSpace/better-go/matrix/app/try/volo-example"
DATABASE_URL: "mysql://root:[email protected]:13306/cms"
tasks:
init:
- echo "init"
install:
cmds:
- cargo install cargo-watch # auto compile and run:
- cargo install diesel_cli
- cargo install sea-orm-cli # ref: https://www.sea-ql.org/SeaORM/docs/generate-entity/sea-orm-cli/
run:
cmds:
- echo "run cms"
- RUST_BACKTRACE=1 cargo run
# auto compile and run:
watch:
cmds:
- cargo watch -x run
api:test:
cmds:
- |
curl --request POST \
--url http://127.0.0.1:5001/todos/add \
--header 'Content-Type: application/json' \
--data '{
"text": "test"
}'
- |
curl --url http://127.0.0.1:5001/todos
clean:
cmds:
- cargo clean
open:
cmds:
- open http://localhost:3000
docs:
cmds:
- open https://github.com/tokio-rs/axum
- open https://github.com/diesel-rs/diesel
- open https://diesel.rs/
- open https://crates.io/crates/tracing
###############################################################################
db:migrate:model:
cmds:
- echo "db url $DATABASE_URL"
- sea-orm-cli generate entity -u ${DATABASE_URL} -o {{.APP_NAME}}/src
- cd {{.APP_NAME}}; cargo init --lib;
- cd {{.APP_NAME}}; mv src/mod.rs src/lib.rs;
- cd {{.APP_NAME}}; cargo add serde@1 --features derive
- cd {{.APP_NAME}}; cargo add [email protected]
vars:
APP_NAME: "rs-entity"
ignore_error: true
###############################################################################
db:setup:
cmds:
- diesel setup
db:add:
cmds:
- diesel migration generate posts
# create tables:
db:init:
cmds:
- diesel migration run
db:redo:
cmds:
- diesel migration redo
# delete all tables:
db:revert:
cmds:
- diesel migration revert
db:reset:
cmds:
- diesel database reset
db:help:
cmds:
- diesel help
db:show:
cmds:
- diesel print-schema