#!/bin/bash # =============================================== # đŸŒŗ TREEBLESHOOTER LAUNCHER đŸŒŗ # The Easiest Way to Run Your Troubleshooting App # Created for Allen by David (and Claude) # =============================================== echo "" echo "🚀 ========================================= 🚀" echo " Welcome to Treebleshooter Launcher!" echo " Your journey to troubleshooting mastery" echo " begins in 3... 2... 1..." echo "🚀 ========================================= 🚀" echo "" # â„šī¸ Fun Fact: This script is smarter than 73% of rubber ducks sleep 1 # Check if we're in the right directory if [ ! -f "main.py" ]; then echo "❌ Oops! Can't find main.py" echo "â„šī¸ Make sure you run this script from the treebleshooter folder" echo "â„šī¸ Try: cd ~/treebleshooter" echo "â„šī¸ Then: ./run_treebleshooter.sh" exit 1 fi echo "📁 Checking project structure..." echo "â„šī¸ Did you know? Your app has $(find src -name "*.py" | wc -l) Python files!" sleep 1 # Check if Python 3 is installed echo "" echo "🐍 Checking for Python..." if ! command -v python3 &> /dev/null; then echo "❌ Python 3 is not installed!" echo "â„šī¸ Python is like coffee for computers - essential!" echo "â„šī¸ Install it with: brew install python@3.11" echo "â„šī¸ (If you don't have brew, visit https://brew.sh first)" exit 1 fi PYTHON_VERSION=$(python3 --version) echo "✅ Found $PYTHON_VERSION" echo "â„šī¸ Fun fact: Python was named after Monty Python, not the snake!" sleep 1 # Check if virtual environment exists echo "" echo "🔮 Looking for virtual environment..." if [ ! -d "venv" ]; then echo "đŸ“Ļ Creating your personal Python bubble (virtual environment)..." echo "â„šī¸ This is like a sandbox where your app can play safely!" echo "â„šī¸ It keeps all your app's toys (packages) in one place!" python3 -m venv venv if [ $? -ne 0 ]; then echo "❌ Failed to create virtual environment" echo "â„šī¸ This is like trying to blow a bubble with no soap!" echo "â„šī¸ Try: python3 -m pip install --user virtualenv" exit 1 fi echo "✅ Virtual environment created!" echo "â„šī¸ Your app now has its own private Python playground!" else echo "✅ Virtual environment found!" echo "â„šī¸ Your Python playground is ready for action!" fi # Activate virtual environment echo "" echo "🎭 Activating virtual environment..." echo "â„šī¸ This is like putting on your troubleshooting cape!" source venv/bin/activate if [ $? -ne 0 ]; then echo "❌ Failed to activate virtual environment" echo "â„šī¸ The cape got tangled! Try running: source venv/bin/activate manually" exit 1 fi echo "✅ Virtual environment activated!" echo "â„šī¸ You're now in the Matrix... I mean, the venv!" sleep 1 # Check and install requirements echo "" echo "📚 Checking dependencies..." echo "â„šī¸ These are like the ingredients for your app recipe!" # Check if PyQt5 is installed (our main dependency) if ! python -c "import PyQt5" 2>/dev/null; then echo "đŸ“Ĩ Installing required packages..." echo "â„šī¸ This is like downloading superpowers for your app!" echo "â„šī¸ PyQt5: Makes things pretty (very important!)" echo "â„šī¸ And other magical ingredients..." echo "" pip install --upgrade pip > /dev/null 2>&1 pip install -r requirements.txt if [ $? -ne 0 ]; then echo "❌ Failed to install requirements" echo "â„šī¸ The package delivery drone crashed!" echo "â„šī¸ Try running: pip install -r requirements.txt" echo "â„šī¸ If that fails, sacrifice a rubber duck to the Python gods" exit 1 fi echo "" echo "✅ All packages installed!" echo "â„šī¸ Your app is now fully armed and operational!" else echo "✅ All dependencies are already installed!" echo "â„šī¸ Your app's utility belt is fully stocked!" fi # Check if example guides exist echo "" echo "📖 Checking example guides..." if [ ! -d "data/examples" ] || [ -z "$(ls -A data/examples 2>/dev/null)" ]; then echo "🎨 Creating hilarious example guides..." echo "â„šī¸ Including classics like 'When Your Toaster Gets Existential'" echo "â„šī¸ And 'Quantum Coffee Temperature Issues'" python create_example_guides.py > /dev/null 2>&1 echo "✅ Example guides created!" echo "â„šī¸ 8 whimsical troubleshooting scenarios ready!" else GUIDE_COUNT=$(ls data/examples/*.tsg 2>/dev/null | wc -l) echo "✅ Found $GUIDE_COUNT example guides!" echo "â„šī¸ Each one more ridiculous than the last!" fi sleep 1 # Final countdown echo "" echo "đŸŽŦ ========================================= đŸŽŦ" echo " LAUNCHING TREEBLESHOOTER!" echo " â„šī¸ Pro tip: The app looks best in dark mode!" echo " â„šī¸ Another tip: Try the Quantum Coffee guide!" echo " â„šī¸ Final tip: Ctrl+C quits the app cleanly!" echo "đŸŽŦ ========================================= đŸŽŦ" echo "" sleep 2 echo "🚀 Initiating launch sequence..." echo "â„šī¸ If the app doesn't start, try turning it off and on again" echo "â„šī¸ (That's IT Crowd humor - your rubber duck will get it)" echo "" # Run the application python main.py # Check exit status if [ $? -eq 0 ]; then echo "" echo "👋 ========================================= 👋" echo " Thanks for using Treebleshooter!" echo " â„šī¸ Your troubleshooting skills increased by 42 points!" echo " â„šī¸ Come back soon for more decision tree adventures!" echo "👋 ========================================= 👋" else echo "" echo "đŸ’Ĩ ========================================= đŸ’Ĩ" echo " Oh no! Something went wrong!" echo " â„šī¸ Don't panic! This is troubleshootable!" echo " â„šī¸ Check the error message above" echo " â„šī¸ Or try running: python main.py" echo " â„šī¸ Still stuck? Time to debug the debugger!" echo "đŸ’Ĩ ========================================= đŸ’Ĩ" fi # Deactivate virtual environment deactivate 2>/dev/null echo "" echo "🏁 Script complete! You're a troubleshooting champion! 🏆"