-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmise.toml
More file actions
106 lines (85 loc) · 2.9 KB
/
Copy pathmise.toml
File metadata and controls
106 lines (85 loc) · 2.9 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
[vars]
exename = "frozenbbs"
bbscmd = "target/debug/{{vars.exename}}"
cfgfile = "\"`cargo run config config-path`\""
dbfile = "\"`cargo run config db-path`\""
# Initial setup
[tasks.setup]
description = "Install dev requirements"
run = """
if which -s diesel; then
echo Diesel is already installed.
else
cargo install diesel_cli --no-default-features --features sqlite
echo Installed diesel.
fi
"""
# Build and install
[tasks.build]
description = "Build the debug version"
run = "cargo build"
[tasks.build_release]
description = "Build the release version"
run = "cargo build --release"
[tasks.install]
description = "Install the release version"
run = "cargo install --path ."
# Development
[tasks.db_nuke]
description = "Delete the database"
confirm = "Really delete the database?"
run = "rm -f {{vars.dbfile }}"
[tasks.db_format]
description = "Format migrations with pg_format"
run = "pg_format --type-case 2 --function-case 2 --keyword-case 2 -i migrations/*/*.sql"
[tasks.db_fixture]
description = "Create some test data"
depends = ["db_migrate"]
confirm = "Really write test data to the database?"
run = """
{{vars.bbscmd}} user observe --node-id !cafebead --short-name FRZB --long-name "Frozen BBS"
{{vars.bbscmd}} user observe -n !1234fedc -s 1234 -l 'Jerk'
{{vars.bbscmd}} user ban -n !1234fedc
{{vars.bbscmd}} user observe -n !1234abcd -s 4567 -l 'OK person'
{{vars.bbscmd}} board add --name "Board Talk" --description "Discussing this BBS itself."
{{vars.bbscmd}} board add --name "Meshtastic" --description "How did we get here?"
{{vars.bbscmd}} board add --name "Local" --description "Things happening nearby."
{{vars.bbscmd}} post add --board-id 1 --node-id !cafebead --content "First post."
{{vars.bbscmd}} post add --board-id 1 --node-id !1234fedc --content "LOL I'm a jerk look at me!"
{{vars.bbscmd}} post add --board-id 1 --node-id !1234abcd --content "Third post."
"""
# Deployment
[tasks.install_config]
description = "Install the default configuration file"
depends = ["build"]
run = """
mkdir -p "$(dirname {{vars.cfgfile}})"
echo 'db_path = {{vars.dbfile}}' > {{vars.cfgfile}}
cat config-sample.toml >> {{vars.cfgfile}}
echo 'Edit {{vars.cfgfile}} to customize your BBS.'
"""
[tasks.db_migrate]
description = "Apply migrations"
run = """
mkdir -p "$(dirname {{vars.dbfile}})"
diesel --database-url {{vars.dbfile}} migration run
"""
# Maintenance
[tasks.db_shell]
description = "Connect to the database"
run = "sqlite3 {{ vars.dbfile }}"
# Backup and restore
[tasks.db_dump]
description = "Export the database to a text file"
run = "sqlite3 {{ vars.dbfile }} .dump > backup.sql"
[tasks.db_restore]
description = "Restore the database from backup"
depends = ["db_nuke"]
run = "cat backup.sql | sqlite3 {{vars.dbfile}}"
# Running the BBS
[tasks.server]
description = "Run the BBS"
run="{{vars.exename}} server"
[tasks.server_info]
description = "Run the BBS with info logging"
run="{{vars.exename}} -v server"