this repo has no description
at main 86 lines 2.3 kB view raw
1#!/bin/bash 2# Install axe to a specified location or default ~/.local/axe 3 4set -e 5 6SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 7PROJECT_DIR="$(dirname "$SCRIPT_DIR")" 8BUILD_PRODUCTS="${PROJECT_DIR}/build_products" 9 10# Default installation directory 11INSTALL_DIR="${1:-$HOME/.local/axe}" 12BIN_DIR="${2:-$HOME/.local/bin}" 13 14# Colors for output 15RED='\033[0;31m' 16GREEN='\033[0;32m' 17YELLOW='\033[1;33m' 18NC='\033[0m' # No Color 19 20echo "🔧 AXe Installer" 21echo "================" 22echo "" 23 24# Check if build products exist 25if [[ ! -f "${BUILD_PRODUCTS}/axe" ]]; then 26 echo -e "${RED}Error: axe executable not found at ${BUILD_PRODUCTS}/axe${NC}" 27 echo "Please run './scripts/build.sh' first or 'swift build -c release'" 28 exit 1 29fi 30 31if [[ ! -d "${BUILD_PRODUCTS}/Frameworks" ]]; then 32 echo -e "${RED}Error: Frameworks directory not found at ${BUILD_PRODUCTS}/Frameworks${NC}" 33 echo "Please run './scripts/build.sh' first" 34 exit 1 35fi 36 37echo "Installation directory: ${INSTALL_DIR}" 38echo "Binary symlink: ${BIN_DIR}/axe" 39echo "" 40 41# Create directories 42echo "📁 Creating directories..." 43mkdir -p "${INSTALL_DIR}" 44mkdir -p "${BIN_DIR}" 45 46# Copy executable 47echo "📦 Copying axe executable..." 48cp "${BUILD_PRODUCTS}/axe" "${INSTALL_DIR}/axe" 49chmod +x "${INSTALL_DIR}/axe" 50 51# Copy frameworks 52echo "📦 Copying Frameworks..." 53rm -rf "${INSTALL_DIR}/Frameworks" 54cp -R "${BUILD_PRODUCTS}/Frameworks" "${INSTALL_DIR}/Frameworks" 55 56# Create symlink 57echo "🔗 Creating symlink in ${BIN_DIR}..." 58rm -f "${BIN_DIR}/axe" 59ln -sf "${INSTALL_DIR}/axe" "${BIN_DIR}/axe" 60 61# Verify installation 62echo "" 63echo "✅ Installation complete!" 64echo "" 65echo "Directory structure:" 66echo " ${INSTALL_DIR}/" 67echo " ├── axe" 68echo " └── Frameworks/" 69ls "${INSTALL_DIR}/Frameworks" | sed 's/^/ ├── /' 70echo "" 71echo "Symlink:" 72echo " ${BIN_DIR}/axe -> ${INSTALL_DIR}/axe" 73echo "" 74 75# Test if it works 76if command -v axe &> /dev/null; then 77 echo "🎉 axe is now available in your PATH!" 78 echo "" 79 axe --version 2>/dev/null || echo "(run 'axe --help' to get started)" 80else 81 echo -e "${YELLOW}Note: ${BIN_DIR} may not be in your PATH${NC}" 82 echo "Add this to your shell config (~/.zshrc or ~/.bashrc):" 83 echo "" 84 echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" 85 echo "" 86fi