#!/bin/sh set -e MIZE_SRC="/home/me/work/mize" # hardcoded for now RSYNC_EXCLUDES="--exclude=.git --exclude=node_modules --exclude=target --exclude=mize_config.toml --exclude=rust_dist --exclude=deno_dist --exclude=dist --exclude=result --exclude=pkg" function main { if [[ "$1" == "dlu" ]]; then deploy_lush fi if [[ "$1" == "dma" ]]; then deploy_lush fi if [[ "$1" == "dmo" ]]; then deploy_main_obsidian fi } function deploy_lush { echo "c2vi: Deploying to lush..." # Copy files to lush rsync -r -u -v --delete --mkpath $RSYNC_EXCLUDES $MIZE_SRC/* lush:here/mize # compile ssh lush nix develop /home/me/here/mize --impure -v -L -c sh -c "cargo build --release --manifest-path /home/me/here/mize/packages/ppc/Cargo.toml" # restart service ssh lush "sudo systemctl restart ppc" } function deploy_main_website { echo "c2vi: Deploying website to ppc-hosting..." # Copy files to lush rsync -r -u -v --delete --mkpath $RSYNC_EXCLUDES $MIZE_SRC/* ppc-hosting:ppc-src # compile ssh ppc-hosting nix develop /root/host/ppc-src --impure -v -L -c sh -c "cargo build --release --manifest-path /root/host/ppc-src/packages/ppc/Cargo.toml" # restart service ssh ppc-hosting "sudo systemctl restart ppc" } function deploy_main_obsidian { echo "c2vi: Deploying to local main obsidian vault..." deno run --config $MIZE_SRC/packages/ppc/platform/obsidian/deno.json build cp -r $MIZE_SRC/packages/ppc/platform/obsidian/dist/* ~/work/things/.obsidian/plugins/ppc/ } main "$@"