Skip to content

Instantly share code, notes, and snippets.

@BrunoMiguens
Last active May 5, 2017 12:43
Show Gist options
  • Save BrunoMiguens/4e8f5b9a57d7e9b11eaf8fa0c8925b5d to your computer and use it in GitHub Desktop.
Save BrunoMiguens/4e8f5b9a57d7e9b11eaf8fa0c8925b5d to your computer and use it in GitHub Desktop.
This is a script to fetch and install pods on the most recent Podfile. Run 'chmod a+x update_recent_podfile.tool' to make this script runnable.
#!/usr/bin/env bash
BLUE=`tput setaf 4`
CYAN=`tput setaf 6`
NOCOLOR=`tput sgr0`
# Change '~/Documents' to whatever path/directory you want to fetch the pod files.
find ~/Documents -name 'Podfile' -type f -mtime -1 -print0 | xargs -0 | sort -nr | while read str; do
echo ""
echo "${BLUE}#-------------------------- Start Updating Podfile --------------------------#${NOCOLOR}"
echo ""
path=$(echo $str | sed -E 's/\/Podfile//g')
echo "${BLUE}#--------------------------------- Podfile ----------------------------------#${NOCOLOR}"
echo "${CYAN}$path${NOCOLOR}"
echo "${BLUE}#----------------------------------------------------------------------------#${NOCOLOR}"
echo ""
echo "${BLUE}#-------------------------------- Cocoapods ---------------------------------#${NOCOLOR}"
(cd $path ; pod install)
echo "${BLUE}#----------------------------------------------------------------------------#${NOCOLOR}"
echo ""
echo "${BLUE}#------------------------ Finished Updating Podfile -------------------------#${NOCOLOR}"
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment