1#!/usr/bin/env bash
2
3# Early exit when script is run on platforms other than macOS
4if [[ "$OSTYPE" != "darwin"* ]]; then
5  exit 0
6fi
7
8green="tput setaf 2"
9yellow="tput setaf 3"
10blue="tput setaf 4"
11reset="tput sgr0"
12
13pathsToCheck=("ios" "apps/bare-expo/ios")
14pathsToUpdate=()
15
16for path in ${pathsToCheck[@]}; do
17  podfileLockPath="$path/Podfile.lock"
18  manifestLockPath="$path/Pods/Manifest.lock"
19  podfileLock=$(md5 -q "$podfileLockPath" 2>/dev/null)
20  manifestLock=$(md5 -q $manifestLockPath 2>/dev/null)
21
22  if [ "$podfileLock" != "$manifestLock" ]; then
23    pathsToUpdate+=($path)
24  fi
25done
26
27if [ ${#pathsToUpdate[@]} -ne 0 ]; then
28  dirs=$(printf " or $($green)%s$($yellow)" "${pathsToUpdate[@]}")
29  printf "\\n⚠️  $($yellow)Update your local CocoaPods with $($blue)et pod-install$($yellow) if you're working in "
30  printf "${dirs:4}$($reset)\\n"
31fi
32