#!/bin/bash
#
# Wrapper script to find and run pod install
# Handles rbenv shims and standard CocoaPods installations
#
# @author Matthew Raymer

set -e

# Get pod command (handles rbenv)
get_pod_command() {
    if command -v pod &> /dev/null; then
        echo "pod"
    elif [ -f "$HOME/.rbenv/shims/pod" ]; then
        echo "$HOME/.rbenv/shims/pod"
    else
        echo "pod"  # Let it fail with standard error message
    fi
}

# Find pod command
POD_CMD=$(get_pod_command)

# Run pod install
exec "$POD_CMD" install "$@"
