Skip to content

Instantly share code, notes, and snippets.

@dpettigrew
Created June 3, 2015 21:18
Show Gist options
  • Save dpettigrew/851482c48e51acdd0eeb to your computer and use it in GitHub Desktop.
Save dpettigrew/851482c48e51acdd0eeb to your computer and use it in GitHub Desktop.
Script for conditionally calling "carthage update" or "carthage copy-frameworks" based upon modifications to the Cartfile
#!/bin/sh
export PATH=/opt/local/bin/:/opt/local/sbin:$PATH:/usr/local/bin:
carthagePath=`which carthage`
if [[ ! -f ${carthagePath} ]]; then
echo "ERROR: You need to install Carthage first, you can use brew to simplify process:
brew install carthage, OR,
download package from https://github.com/Carthage/Carthage"
exit 0;
fi
carthageFile="./Cartfile"
carthageFileTimestamp="./Cartfile.timestamp"
if [ "$carthageFileTimestamp" -ot "$carthageFile" ];
then
echo Cartfile updated, performing carthage update
${carthagePath} update
touch -m -r "$carthageFile" "$carthageFileTimestamp"
else
${carthagePath} copy-frameworks
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment