#!/bin/bash # # Setup script for Google API Client library # This script downloads and installs the Google API Client using Composer # # Usage: ./setup-vendor.sh # set -e echo "================================================" echo "Informatiq Smart Google Pricing - Vendor Setup" echo "================================================" echo "" # Check if composer is installed if ! command -v composer &> /dev/null; then echo "❌ Composer is not installed." echo "" echo "Please install Composer from https://getcomposer.org" echo "Or manually download Google API Client from:" echo "https://github.com/googleapis/google-api-php-client/releases" echo "" exit 1 fi echo "✓ Composer found" echo "" # Check if vendor directory already exists with Google Client if [ -f "vendor/google/apiclient/src/Google/Client.php" ]; then echo "✓ Google API Client is already installed" echo "" read -p "Do you want to reinstall? (y/N): " -n 1 -r echo "" if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Setup cancelled." exit 0 fi echo "" fi echo "Installing Google API Client and dependencies..." echo "" # Install dependencies composer install --no-dev --optimize-autoloader echo "" echo "================================================" echo "✓ Installation Complete!" echo "================================================" echo "" echo "Google API Client has been installed to vendor/" echo "Directory size: $(du -sh vendor/ | cut -f1)" echo "" echo "Next steps:" echo "1. Upload the entire plugin directory to WordPress" echo "2. Activate the plugin" echo "3. Configure settings at WooCommerce > Smart Pricing" echo "" echo "The plugin is now ready for distribution!" echo ""