Skip to content

Instantly share code, notes, and snippets.

@inamiy
Last active December 27, 2015 12:59
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 inamiy/7329935 to your computer and use it in GitHub Desktop.
Save inamiy/7329935 to your computer and use it in GitHub Desktop.
Generate CoreData files using mogenerator for each xcdatamodeld.
#!/bin/sh
modelds=`find . -name '*.xcdatamodeld'`
for modeld in $modelds; do
# if xccurrentversion exists
if [ -a "${modeld}/.xccurrentversion" ]; then
currentModel=`/usr/libexec/PlistBuddy "${modeld}/.xccurrentversion" -c 'print _XCCurrentVersionName'`
else
currentModel=`ls ${modeld} | grep .xcdatamodel | head -1`
fi
echo "mogenerator -m "${modeld}/${currentModel}" -O "${modeld}/../" --template-var arc=true"
mogenerator -m "${modeld}/${currentModel}" -O "${modeld}/../" --template-var arc=true
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment