Created
July 6, 2011 13:47
-
-
Save casademora/1067256 to your computer and use it in GitHub Desktop.
Regenerate Core Data files in an Xcode project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Add this as a 'Run Script' step in your Xcode Project prior to the compile step | |
mogen=`which mogenerator` | |
if [[ -x $mogen ]]; then | |
echo "Updating data objects using $mogen" | |
cd "$PROJECT_DIR/Model" && $mogen -m MyProject.xcdatamodeld/MyProject.xcdatamodel -M ./generated -H ./entities | |
fi |
mogen=`which mogenerator`
PlistBuddy=/usr/libexec/PlistBuddy
HUMAN_FILES_OUTPUT_FOLDER=$PROJECT_DIR/Application/Models/entities
MACHINE_FILES_OUTPUT_FOLDER=$PROJECT_DIR/Application/Models/generated
MODEL_DATA_FOLDER=$PROJECT_DIR/Application/Models/MyProject.xcdatamodeld
#figure out current model version
CURRENT_MODEL_VERSION=`"$PlistBuddy" -c 'Print _XCCurrentVersionName' "$MODEL_DATA_FOLDER/.xccurrentversion"`
if [[ -x $mogen ]]; then
echo "Updating data objects from $MODEL_DATA_FOLDER/$CURRENT_MODEL_VERSION using $mogen"
"$mogen" -m "$MODEL_DATA_FOLDER/$CURRENT_MODEL_VERSION" -M "$MACHINE_FILES_OUTPUT_FOLDER" -H "$HUMAN_FILES_OUTPUT_FOLDER" --template-var arc=true
fi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this as a 'Run Script' step in your Xcode Project prior to the compile step