#!/usr/bin/env bash
set -euo pipefail

cd "$(dirname "$0")"

echo "==> Stopping any running Pommedoro..."
pkill -9 -f Pommedoro 2>/dev/null || true
sleep 0.5

echo "==> Cleaning previous build..."
rm -rf .build/Pommedoro.app .build/Pommedoro.dmg

echo "==> Building DMG..."
make dmg

echo "==> Installing to /Applications..."
make install

echo "==> Launching Pommedoro.app..."
open /Applications/Pommedoro.app

echo ""
echo "==> Done. DMG at: .build/Pommedoro.dmg"
