Skip to content

Instantly share code, notes, and snippets.

@jeeftor
Last active August 7, 2017 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeeftor/66f575ba12cf3971c8a863743ec866fa to your computer and use it in GitHub Desktop.
Save jeeftor/66f575ba12cf3971c8a863743ec866fa to your computer and use it in GitHub Desktop.
Xcode alert for out of date carthage in build process
# Capture output of carthage update - so we only need to run it once
outdated=$(carthage outdated | grep -v "\*\*\* Fetching" | grep -v "following dependencies" )
# Do some fancy grep action to turn the lines into approriate xcode style warnings
echo "$outdated" | cut -d' ' -f1 | xargs -I _ grep _ $(realpath Cartfile) --with-filename --line-number --only-matching | perl -p -e "s/([^:]*:\w+:)(\w+)/\$1 warning: \$2 is out of date -- run carthage update/"
# If there is updates - fire off a notificaiton
if [ "$outdated" == "All dependencies are up to date." ]; then
exit;
else
title="${PRODUCT_NAME} -- Carthage"
text="Dependencies are out of date - run carthage update"
osascript -e "display notification \"$text\" with title \"$title\""
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment