-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
188 lines (167 loc) · 6.75 KB
/
Copy pathjustfile
File metadata and controls
188 lines (167 loc) · 6.75 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
set dotenv-load
# List all available commands
_default:
@just --list --unsorted
# Run a command in the environment
run *ARGS:
uv run {{ ARGS }}
# recreate vm
recreate-vm:
vagrant destroy
vagrant up
# SSH into vm
ssh:
vagrant ssh
# Run uv command in the django example project
djuv *ARGS:
#!/usr/bin/env bash
cd examples/django/bookstore
uv --project bookstore {{ ARGS }}
# Generate django project requirements:
dj-requirements:
just djuv pip compile pyproject.toml -o requirements.txt
# Run fujin command in the django example project
fujin *ARGS:
#!/usr/bin/env bash
cd examples/django/bookstore
../../../.venv/bin/python -m fujin {{ ARGS }}
download-pocketbase:
#!/usr/bin/env bash
set -euo pipefail
curl -L -o pocketbase_0.34.2_linux_arm64.zip "https://github.com/pocketbase/pocketbase/releases/download/v0.34.2/pocketbase_0.34.2_linux_amd64.zip"
unzip pocketbase_0.34.2_linux_arm64.zip -d ./examples/golang/pocketbase/
rm pocketbase_0.34.2_linux_arm64.zip
rm ./examples/golang/pocketbase/LICENSE.md
rm ./examples/golang/pocketbase/CHANGELOG.md
chmod +x ./examples/golang/pocketbase/pocketbase
# -------------------------------------------------------------------------
# Maintenance
#---------------------------------------------------------------------------
@fmt:
just --fmt --unstable
uvx ruff format
uvx prek run -a pyproject-fmt
@lint:
uvx mypy .
@docs-serve:
uv run --group docs sphinx-autobuild docs docs/_build/html --port 8002 --watch src/fujin
@docs-requirements:
uv export --no-hashes --group docs --format requirements-txt > docs/requirements.txt
# Generate help screenshots for documentation (requires: cargo install termshot)
@docs-screenshots:
#!/usr/bin/env bash
set -e
OUTPUT_DIR="docs/_static/images/help"
mkdir -p "$OUTPUT_DIR"
echo "Generating help screenshots for fujin documentation..."
echo ""
# Check if termshot is installed
if ! command -v termshot &> /dev/null; then
echo "❌ Error: termshot is not installed"
echo ""
echo "Install with: cargo install termshot"
exit 1
fi
# Function to generate screenshot
generate_screenshot() {
local name="$1"
local command="$2"
local output="$OUTPUT_DIR/${name}.png"
echo "📸 Generating ${name}.png..."
termshot --no-decoration --no-shadow --filename "$output" -- "uv run $command"
echo " ✓ Saved to $output"
}
# Main command
generate_screenshot "fujin-help" "fujin --help"
# Primary commands
generate_screenshot "init-help" "fujin init --help"
generate_screenshot "new-help" "fujin new --help"
generate_screenshot "up-help" "fujin up --help"
generate_screenshot "deploy-help" "fujin deploy --help"
generate_screenshot "down-help" "fujin down --help"
generate_screenshot "rollback-help" "fujin rollback --help"
generate_screenshot "prune-help" "fujin prune --help"
generate_screenshot "migrate-help" "fujin migrate --help"
generate_screenshot "audit-help" "fujin audit --help"
# App command and subcommands
generate_screenshot "app-help" "fujin app --help"
generate_screenshot "app-status-help" "fujin app status --help"
generate_screenshot "app-start-help" "fujin app start --help"
generate_screenshot "app-stop-help" "fujin app stop --help"
generate_screenshot "app-restart-help" "fujin app restart --help"
generate_screenshot "app-logs-help" "fujin app logs --help"
generate_screenshot "app-shell-help" "fujin app shell --help"
generate_screenshot "app-cat-help" "fujin app cat --help"
generate_screenshot "app-exec-help" "fujin app exec --help"
generate_screenshot "app-scale-help" "fujin app scale --help"
# Server command and subcommands
generate_screenshot "server-help" "fujin server --help"
generate_screenshot "server-status-help" "fujin server status --help"
generate_screenshot "server-bootstrap-help" "fujin server bootstrap --help"
generate_screenshot "server-create-user-help" "fujin server create-user --help"
generate_screenshot "server-setup-ssh-help" "fujin server setup-ssh --help"
generate_screenshot "server-exec-help" "fujin server exec --help"
# Shortcut command
generate_screenshot "fa-help" "fa --help"
echo ""
echo "✅ All help screenshots generated successfully!"
echo ""
echo "Screenshots saved in: $OUTPUT_DIR"
echo ""
echo "Next steps:"
echo " 1. Review generated images"
echo " 2. Verify .rst files reference correct images"
echo " 3. Add to git: git add $OUTPUT_DIR"
@test *ARGS:
uv run pytest --ignore=tests/integration -sv {{ ARGS }}
@test-integration *ARGS:
uv run pytest tests/integration {{ ARGS }}
# -------------------------------------------------------------------------
# RELEASE UTILITIES
#---------------------------------------------------------------------------
# Generate changelog
@logchanges *ARGS:
uvx git-cliff --output CHANGELOG.md {{ ARGS }}
# Sync plugin package versions to match core package version
@sync-plugin-versions:
#!/usr/bin/env bash
set -euo pipefail
CORE_VERSION=$(grep '^version = ' pyproject.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "Syncing plugin versions to $CORE_VERSION..."
for pyproject in plugins/*/pyproject.toml; do
plugin_name=$(basename "$(dirname "$pyproject")")
echo " - $plugin_name"
sed -i "s/^version = .*/version = \"$CORE_VERSION\"/" "$pyproject"
sed -i "s/\"fujin-cli>=.*\"/\"fujin-cli>=$CORE_VERSION\"/" "$pyproject"
done
echo "Done!"
# Bump project version and update changelog
bumpver VERSION:
#!/usr/bin/env bash
set -euo pipefail
uvx bump-my-version bump {{ VERSION }}
just sync-plugin-versions
just fmt || true
just logchanges
[ -z "$(git status --porcelain)" ] && { echo "No changes to commit."; git push && git push --tags; exit 0; }
version="$(uvx bump-my-version show current_version)"
git add -A
git commit -m "Generate changelog for version ${version}"
git tag -f "v${version}"
git push && git push --tags
# Build a binary distribution of the project using pyapp
build-bin:
#!/usr/bin/env bash
current_version=$(uvx bump-my-version show current_version)
uv build
export PYAPP_UV_ENABLED="1"
export PYAPP_PYTHON_VERSION="3.12"
export PYAPP_FULL_ISOLATION="1"
export PYAPP_EXPOSE_METADATA="1"
export PYAPP_PROJECT_NAME="fujin"
export PYAPP_PROJECT_VERSION="${current_version}"
export PYAPP_PROJECT_PATH="${PWD}/dist/fujin_cli-${current_version}-py3-none-any.whl"
export PYAPP_DISTRIBUTION_EMBED="1"
export RUST_BACKTRACE="full"
cargo install pyapp --force --root dist
mv dist/bin/pyapp "dist/bin/fujin_cli-${current_version}"