Skip to content

Instantly share code, notes, and snippets.

@segiddins
Created August 23, 2013 19:31
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 segiddins/6323076 to your computer and use it in GitHub Desktop.
Save segiddins/6323076 to your computer and use it in GitHub Desktop.
#!/bin/sh
# ~/bin/repod
set -e
if [ ! -e Podfile ]; then
echo "Podfile not found" >&2
exit 1
fi
if [ -z "$1" ]; then
echo "Missing pod to reinstall" >&2
exit 1
fi
unpod() {
if ! grep -qs "$1" Podfile; then
echo "Pod $1 not found in Podfile" >&2
exit 1
fi
sed -i '' "s%pod.*$1.*%#&%g" Podfile
}
ununpod() {
if ! grep -qs "$1" Podfile; then
echo "Pod $1 not found in Podfile" >&2
exit 1
fi
sed -i '' "s%^#*\(pod.*$1.*\)$%\1%g" Podfile
}
for POD in "$@"; do
unpod "$POD"
done
pod
for POD in "$@"; do
ununpod "$POD"
done
pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment