new functions and fixes
This commit is contained in:
@@ -16,16 +16,41 @@ export RUST_LOG="${RUST_LOG:-rustpad=debug,tower_http=info}"
|
||||
# Generate a new asset version on each run to prevent stale HTML and JavaScript.
|
||||
export ASSET_VERSION="${ASSET_VERSION:-dev-$(date +%s)}"
|
||||
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
echo "Cleaning RustPad build artifacts..."
|
||||
cargo clean --package rustpad
|
||||
update_browser_libs() {
|
||||
local python_bin=""
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python_bin="python3"
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
python_bin="python"
|
||||
fi
|
||||
|
||||
echo "Starting RustPad..."
|
||||
exec cargo run --package rustpad
|
||||
if [[ -z "$python_bin" ]]; then
|
||||
echo "Python 3 is required to download browser libraries for local Cargo development." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Checking browser libraries..."
|
||||
"$python_bin" scripts/update_browser_libs.py
|
||||
}
|
||||
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
if update_browser_libs; then
|
||||
echo "Cleaning RustPad build artifacts..."
|
||||
cargo clean --package rustpad
|
||||
|
||||
echo "Starting RustPad..."
|
||||
exec cargo run --package rustpad
|
||||
fi
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
exit 1
|
||||
fi
|
||||
echo "Local browser libraries could not be prepared; falling back to Docker." >&2
|
||||
fi
|
||||
|
||||
if command -v docker >/dev/null 2>&1; then
|
||||
export IMAGE_TAG="${IMAGE_TAG:-dev}"
|
||||
export BROWSER_LIBS_REFRESH="${BROWSER_LIBS_REFRESH:-dev-$(date +%s)}"
|
||||
|
||||
echo "Starting RustPad with Docker..."
|
||||
exec docker compose up --build --force-recreate --remove-orphans
|
||||
|
||||
Reference in New Issue
Block a user