feat(ios): add comprehensive requirements checking and improved CocoaPods detection
Enhanced iOS test app setup with better prerequisite handling: Requirements Checker: - Created check-requirements.sh script - Verifies all prerequisites (macOS, Xcode, Ruby, CocoaPods, Node.js) - Checks Ruby version (requires 3.1+) - Detects CocoaPods in multiple locations (PATH, rbenv, gem bin) - Validates UTF-8 encoding - Provides installation instructions for missing items Build Script Improvements: - Enhanced CocoaPods detection (checks PATH, rbenv, gem bin) - Better error messages with installation options - Automatic LANG=en_US.UTF-8 export - Uses detected pod command location Documentation Updates: - Expanded prerequisites section with versions - Added rbenv recommendation - Added quick requirements check step - Clearer installation instructions Fixes: - Handles rbenv-based CocoaPods installation - Works with system Ruby, rbenv, or Homebrew - Provides helpful error messages Result: Developers can easily verify and install all requirements
This commit is contained in:
@@ -48,12 +48,35 @@ if ! command -v xcodebuild &> /dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v pod &> /dev/null; then
|
||||
log_error "CocoaPods not found. Install with:"
|
||||
log_info " gem install cocoapods"
|
||||
# Check for CocoaPods (try multiple locations)
|
||||
POD_CMD=""
|
||||
if command -v pod &> /dev/null; then
|
||||
POD_CMD="pod"
|
||||
elif [ -f ~/.rbenv/shims/pod ]; then
|
||||
POD_CMD="~/.rbenv/shims/pod"
|
||||
elif [ -f ~/.gem/bin/pod ]; then
|
||||
POD_CMD="~/.gem/bin/pod"
|
||||
else
|
||||
log_error "CocoaPods not found."
|
||||
log_info ""
|
||||
log_info "Installation options:"
|
||||
log_info " 1. Using rbenv (recommended):"
|
||||
log_info " rbenv install 3.1.0"
|
||||
log_info " rbenv global 3.1.0"
|
||||
log_info " gem install cocoapods"
|
||||
log_info ""
|
||||
log_info " 2. Using system Ruby (requires Ruby 3.1+):"
|
||||
log_info " gem install cocoapods"
|
||||
log_info ""
|
||||
log_info " 3. Using Homebrew:"
|
||||
log_info " brew install cocoapods"
|
||||
log_info ""
|
||||
log_info "Current Ruby version: $(ruby --version 2>/dev/null || echo 'not found')"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "Using CocoaPods: $POD_CMD"
|
||||
|
||||
# Get simulator device (default to iPhone 15 Pro)
|
||||
SIMULATOR_DEVICE="${1:-iPhone 15 Pro}"
|
||||
log_info "Using simulator: $SIMULATOR_DEVICE"
|
||||
@@ -76,8 +99,16 @@ fi
|
||||
# Install CocoaPods dependencies
|
||||
log_step "Installing CocoaPods dependencies..."
|
||||
cd App
|
||||
export LANG=en_US.UTF-8 # Required for CocoaPods
|
||||
|
||||
if [ ! -f "Podfile.lock" ] || [ "Podfile" -nt "Podfile.lock" ]; then
|
||||
pod install
|
||||
if eval "$POD_CMD install"; then
|
||||
log_info "✓ CocoaPods dependencies installed"
|
||||
else
|
||||
log_error "Failed to install CocoaPods dependencies"
|
||||
log_info "Try running manually: export LANG=en_US.UTF-8 && $POD_CMD install"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log_info "CocoaPods dependencies up to date"
|
||||
fi
|
||||
@@ -95,7 +126,7 @@ xcodebuild -workspace "$WORKSPACE" \
|
||||
-sdk "$SDK" \
|
||||
-destination "platform=iOS Simulator,name=$SIMULATOR_DEVICE" \
|
||||
-derivedDataPath build/derivedData \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
CODE_SIGN_IDENTITY='' \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
clean build
|
||||
|
||||
Reference in New Issue
Block a user