Skip to content

Instantly share code, notes, and snippets.

@Aldaviva
Last active March 28, 2018 05:30
Show Gist options
  • Save Aldaviva/939169ec22095f7a2bf309b2901376a3 to your computer and use it in GitHub Desktop.
Save Aldaviva/939169ec22095f7a2bf309b2901376a3 to your computer and use it in GitHub Desktop.
Carthage's CLI sucks. I need to pass all these flags, it can't remember them. You have to bootstrap each time you pull? "Bootstrap" means first time! "Update" is too ambiguous. The hidden cache gets corrupted. There, I fixed it for you, Carthage developers, you fucking scum of the earth.
#!/bin/bash
PLATFORM=Mac
function main {
if [ "$1" == "repin" ]
then
update
elif [ "$1" == "install" ]
then
bootstrap
elif [ "$1" == "clean" ]
then
clean
else
echo "Usage:"
echo " cart install Run this if someone else updated a dependency."
echo " Downloads and compiles dependencies, based on "
echo " the given pinned hashes in Cartfile.resolved."
echo ""
echo " cart repin Run this if you updated a dependency."
echo " Sets new pinned hashes in Cartfile.resolved, "
echo " based on the given dependencies in Cartfile, "
echo " then installs."
echo ""
echo " cart clean Run this if something's broken."
echo " Blows away all transient builds and dependencies."
echo " Your next \`cart install\` will take a lot longer."
exit 1
fi
}
function update {
runCarthage "update"
}
function bootstrap {
runCarthage "bootstrap"
}
function clean {
rm -rf DerivedData
rm -rf Carthage
rm -rf ~/Library/Caches/carthage
rm -rf ~/Library/Caches/org.carthage.CarthageKit
}
function runCarthage {
cmd="carthage $1 --platform $PLATFORM --configuration Debug --cache-builds"
echo $cmd
eval $cmd
}
main $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment