fix(ios): use wrapper script for pod install in cap:sync:ios

The cap:sync:ios npm script was failing with "pod: command not found"
because npm scripts don't inherit the same PATH environment as shell
scripts, preventing detection of pod installed via rbenv shims.

Added pod-install.sh wrapper script that:
- Detects pod via command -v or rbenv shims ($HOME/.rbenv/shims/pod)
- Executes pod install with the found command
- Matches the pod detection logic used in build-native.sh

Updated cap:sync:ios script to use the wrapper instead of calling
pod install directly, ensuring consistent pod detection across
all build contexts.
This commit is contained in:
Matthew
2026-01-15 23:05:45 -08:00
parent 2915fe7438
commit dd55c6b4e1
2 changed files with 26 additions and 1 deletions

View File

@@ -15,7 +15,7 @@
"lint": "eslint . --fix",
"cap:sync": "npx cap sync && node scripts/fix-capacitor-plugins.js",
"cap:sync:android": "npx cap sync android && node scripts/fix-capacitor-plugins.js",
"cap:sync:ios": "npx cap copy ios && node scripts/fix-capacitor-plugins.js && cd ios/App && pod install && cd ../..",
"cap:sync:ios": "npx cap copy ios && node scripts/fix-capacitor-plugins.js && cd ios/App && ../../scripts/pod-install.sh && cd ../..",
"postinstall": "node scripts/fix-capacitor-plugins.js"
},
"dependencies": {

View File

@@ -0,0 +1,25 @@
#!/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 "$@"